diff --git a/DSMeshConvert.sln b/DSMeshConvert.sln new file mode 100644 index 0000000..bdf89d6 --- /dev/null +++ b/DSMeshConvert.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSMeshConvert", "DSMeshConvert\DSMeshConvert.vcxproj", "{97670E69-B730-46FA-AC5B-43A04C8E1F54}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSMeshLoad", "DSMeshLoad\DSMeshLoad.vcxproj", "{F97FBD13-23BC-42C4-A1DC-FA263214ED05}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {97670E69-B730-46FA-AC5B-43A04C8E1F54}.Debug|Win32.ActiveCfg = Debug|Win32 + {97670E69-B730-46FA-AC5B-43A04C8E1F54}.Debug|Win32.Build.0 = Debug|Win32 + {97670E69-B730-46FA-AC5B-43A04C8E1F54}.Release|Win32.ActiveCfg = Release|Win32 + {97670E69-B730-46FA-AC5B-43A04C8E1F54}.Release|Win32.Build.0 = Release|Win32 + {F97FBD13-23BC-42C4-A1DC-FA263214ED05}.Debug|Win32.ActiveCfg = Debug|Win32 + {F97FBD13-23BC-42C4-A1DC-FA263214ED05}.Debug|Win32.Build.0 = Debug|Win32 + {F97FBD13-23BC-42C4-A1DC-FA263214ED05}.Release|Win32.ActiveCfg = Release|Win32 + {F97FBD13-23BC-42C4-A1DC-FA263214ED05}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/DSMeshConvert/Assimp32.dll b/DSMeshConvert/Assimp32.dll new file mode 100644 index 0000000..91e281a Binary files /dev/null and b/DSMeshConvert/Assimp32.dll differ diff --git a/DSMeshConvert/Assimp32d.dll b/DSMeshConvert/Assimp32d.dll new file mode 100644 index 0000000..64704ce Binary files /dev/null and b/DSMeshConvert/Assimp32d.dll differ diff --git a/DSTexCompress/DSTexCompress.vcproj b/DSMeshConvert/DSMeshConvert.vcproj similarity index 65% rename from DSTexCompress/DSTexCompress.vcproj rename to DSMeshConvert/DSMeshConvert.vcproj index 8cda6af..1d067da 100644 --- a/DSTexCompress/DSTexCompress.vcproj +++ b/DSMeshConvert/DSMeshConvert.vcproj @@ -2,9 +2,9 @@ @@ -40,7 +40,7 @@ @@ -113,7 +113,8 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="FreeImage\Dist" + AdditionalIncludeDirectories="assimp--1.1.700-sdk\include" + PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="2" EnableFunctionLevelLinking="true" WarningLevel="3" @@ -130,8 +131,8 @@ /> - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/DSMeshConvert/DSMeshConvert.vcxproj b/DSMeshConvert/DSMeshConvert.vcxproj new file mode 100644 index 0000000..d8993b8 --- /dev/null +++ b/DSMeshConvert/DSMeshConvert.vcxproj @@ -0,0 +1,115 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {97670E69-B730-46FA-AC5B-43A04C8E1F54} + DSMeshConvert + + + + Application + MultiByte + true + + + Application + MultiByte + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + assimp--1.1.700-sdk\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Level3 + EditAndContinue + + + assimp.lib;%(AdditionalDependencies) + assimp--1.1.700-sdk\lib\assimp_debug-dll_win32;%(AdditionalLibraryDirectories) + true + MachineX86 + + + + + MaxSpeed + true + assimp--1.1.700-sdk\include;%(AdditionalIncludeDirectories) + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreadedDLL + true + Level3 + ProgramDatabase + + + assimp.lib;nvtristrip.lib;%(AdditionalDependencies) + assimp--1.1.700-sdk\lib\assimp_release-dll_win32;%(AdditionalLibraryDirectories) + true + true + true + MachineX86 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DSMeshConvert/DSMeshConvert.vcxproj.filters b/DSMeshConvert/DSMeshConvert.vcxproj.filters new file mode 100644 index 0000000..003e1ea --- /dev/null +++ b/DSMeshConvert/DSMeshConvert.vcxproj.filters @@ -0,0 +1,70 @@ + + + + + {71079b66-3d1e-47a0-8158-a600e6e49bc7} + + + {19ec309f-4480-4f3c-9048-b163e75ee401} + + + {a6a88c29-17fe-49f9-a515-c61464a7bed6} + + + + + nvtristrip + + + nvtristrip + + + cets-pterdiman + + + cets-pterdiman + + + cets-pterdiman + + + cets-pterdiman + + + cets-pterdiman + + + ac + + + + + + + nvtristrip + + + nvtristrip + + + nvtristrip + + + cets-pterdiman + + + cets-pterdiman + + + cets-pterdiman + + + cets-pterdiman + + + ac + + + + + \ No newline at end of file diff --git a/DSMeshConvert/NvTriStrip.h b/DSMeshConvert/NvTriStrip.h new file mode 100644 index 0000000..9d95bd7 --- /dev/null +++ b/DSMeshConvert/NvTriStrip.h @@ -0,0 +1,145 @@ +#ifndef NVTRISTRIP_H +#define NVTRISTRIP_H + +#ifndef NULL +#define NULL 0 +#endif + +#pragma comment(lib, "nvtristrip") + +//////////////////////////////////////////////////////////////////////////////////////// +// Public interface for stripifier +//////////////////////////////////////////////////////////////////////////////////////// + +//GeForce1 and 2 cache size +#define CACHESIZE_GEFORCE1_2 16 + +//GeForce3 cache size +#define CACHESIZE_GEFORCE3 24 + +enum PrimType +{ + PT_LIST, + PT_STRIP, + PT_FAN +}; + +struct PrimitiveGroup +{ + PrimType type; + unsigned int numIndices; + unsigned short* indices; + +//////////////////////////////////////////////////////////////////////////////////////// + + PrimitiveGroup() : type(PT_STRIP), numIndices(0), indices(NULL) {} + ~PrimitiveGroup() + { + if(indices) + delete[] indices; + indices = NULL; + } +}; + + +//////////////////////////////////////////////////////////////////////////////////////// +// EnableRestart() +// +// For GPUs that support primitive restart, this sets a value as the restart index +// +// Restart is meaningless if strips are not being stitched together, so enabling restart +// makes NvTriStrip forcing stitching. So, you'll get back one strip. +// +// Default value: disabled +// +void EnableRestart(const unsigned int restartVal); + +//////////////////////////////////////////////////////////////////////////////////////// +// DisableRestart() +// +// For GPUs that support primitive restart, this disables using primitive restart +// +void DisableRestart(); + + +//////////////////////////////////////////////////////////////////////////////////////// +// SetCacheSize() +// +// Sets the cache size which the stripfier uses to optimize the data. +// Controls the length of the generated individual strips. +// This is the "actual" cache size, so 24 for GeForce3 and 16 for GeForce1/2 +// You may want to play around with this number to tweak performance. +// +// Default value: 16 +// +void SetCacheSize(const unsigned int cacheSize); + + +//////////////////////////////////////////////////////////////////////////////////////// +// SetStitchStrips() +// +// bool to indicate whether to stitch together strips into one huge strip or not. +// If set to true, you'll get back one huge strip stitched together using degenerate +// triangles. +// If set to false, you'll get back a large number of separate strips. +// +// Default value: true +// +void SetStitchStrips(const bool bStitchStrips); + + +//////////////////////////////////////////////////////////////////////////////////////// +// SetMinStripSize() +// +// Sets the minimum acceptable size for a strip, in triangles. +// All strips generated which are shorter than this will be thrown into one big, separate list. +// +// Default value: 0 +// +void SetMinStripSize(const unsigned int minSize); + + +//////////////////////////////////////////////////////////////////////////////////////// +// SetListsOnly() +// +// If set to true, will return an optimized list, with no strips at all. +// +// Default value: false +// +void SetListsOnly(const bool bListsOnly); + + +//////////////////////////////////////////////////////////////////////////////////////// +// GenerateStrips() +// +// in_indices: input index list, the indices you would use to render +// in_numIndices: number of entries in in_indices +// primGroups: array of optimized/stripified PrimitiveGroups +// numGroups: number of groups returned +// +// Be sure to call delete[] on the returned primGroups to avoid leaking mem +// +bool GenerateStrips(const unsigned short* in_indices, const unsigned int in_numIndices, + PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled = false); + + +//////////////////////////////////////////////////////////////////////////////////////// +// RemapIndices() +// +// Function to remap your indices to improve spatial locality in your vertex buffer. +// +// in_primGroups: array of PrimitiveGroups you want remapped +// numGroups: number of entries in in_primGroups +// numVerts: number of vertices in your vertex buffer, also can be thought of as the range +// of acceptable values for indices in your primitive groups. +// remappedGroups: array of remapped PrimitiveGroups +// +// Note that, according to the remapping handed back to you, you must reorder your +// vertex buffer. +// +// Credit goes to the MS Xbox crew for the idea for this interface. +// +void RemapIndices(const PrimitiveGroup* in_primGroups, const unsigned short numGroups, + const unsigned short numVerts, PrimitiveGroup** remappedGroups); + +#endif \ No newline at end of file diff --git a/DSMeshConvert/NvTriStrip.lib b/DSMeshConvert/NvTriStrip.lib new file mode 100644 index 0000000..530d384 Binary files /dev/null and b/DSMeshConvert/NvTriStrip.lib differ diff --git a/DSMeshConvert/NvTriStrip/NvTriStrip.cpp b/DSMeshConvert/NvTriStrip/NvTriStrip.cpp new file mode 100644 index 0000000..f97fd35 --- /dev/null +++ b/DSMeshConvert/NvTriStrip/NvTriStrip.cpp @@ -0,0 +1,500 @@ + +#include "NvTriStripObjects.h" +#include "NvTriStrip.h" + +//////////////////////////////////////////////////////////////////////////////////////// +//private data +static unsigned int cacheSize = CACHESIZE_GEFORCE1_2; +static bool bStitchStrips = true; +static unsigned int minStripSize = 0; +static bool bListsOnly = false; +static unsigned int restartVal = 0; +static bool bRestart = false; + +void EnableRestart(const unsigned int _restartVal) +{ + bRestart = true; + restartVal = _restartVal; +} + +void DisableRestart() +{ + bRestart = false; +} + +//////////////////////////////////////////////////////////////////////////////////////// +// SetListsOnly() +// +// If set to true, will return an optimized list, with no strips at all. +// +// Default value: false +// +void SetListsOnly(const bool _bListsOnly) +{ + bListsOnly = _bListsOnly; +} + +//////////////////////////////////////////////////////////////////////////////////////// +// SetCacheSize() +// +// Sets the cache size which the stripfier uses to optimize the data. +// Controls the length of the generated individual strips. +// This is the "actual" cache size, so 24 for GeForce3 and 16 for GeForce1/2 +// You may want to play around with this number to tweak performance. +// +// Default value: 16 +// +void SetCacheSize(const unsigned int _cacheSize) +{ + cacheSize = _cacheSize; +} + + +//////////////////////////////////////////////////////////////////////////////////////// +// SetStitchStrips() +// +// bool to indicate whether to stitch together strips into one huge strip or not. +// If set to true, you'll get back one huge strip stitched together using degenerate +// triangles. +// If set to false, you'll get back a large number of separate strips. +// +// Default value: true +// +void SetStitchStrips(const bool _bStitchStrips) +{ + bStitchStrips = _bStitchStrips; +} + + +//////////////////////////////////////////////////////////////////////////////////////// +// SetMinStripSize() +// +// Sets the minimum acceptable size for a strip, in triangles. +// All strips generated which are shorter than this will be thrown into one big, separate list. +// +// Default value: 0 +// +void SetMinStripSize(const unsigned int _minStripSize) +{ + minStripSize = _minStripSize; +} + + +//////////////////////////////////////////////////////////////////////////////////////// +//Cleanup strips / faces, used by generatestrips +void Cleanup(NvStripInfoVec& tempStrips, NvFaceInfoVec& tempFaces) +{ + int i; + //delete strips + for(i = 0; i < tempStrips.size(); i++) + { + for(int j = 0; j < tempStrips[i]->m_faces.size(); j++) + { + delete tempStrips[i]->m_faces[j]; + tempStrips[i]->m_faces[j] = NULL; + } + tempStrips[i]->m_faces.resize(0); + delete tempStrips[i]; + tempStrips[i] = NULL; + } + + //delete faces + for(i = 0; i < tempFaces.size(); i++) + { + delete tempFaces[i]; + tempFaces[i] = NULL; + } +} + + +//////////////////////////////////////////////////////////////////////////////////////// +//SameTriangle() +// +//Returns true if the two triangles defined by firstTri and secondTri are the same +// The "same" is defined in this case as having the same indices with the same winding order +// +bool SameTriangle(unsigned short firstTri0, unsigned short firstTri1, unsigned short firstTri2, + unsigned short secondTri0, unsigned short secondTri1, unsigned short secondTri2) +{ + bool isSame = false; + + if (firstTri0 == secondTri0) + { + if (firstTri1 == secondTri1) + { + if (firstTri2 == secondTri2) + isSame = true; + } + } + else if (firstTri0 == secondTri1) + { + if (firstTri1 == secondTri2) + { + if (firstTri2 == secondTri0) + isSame = true; + } + } + else if (firstTri0 == secondTri2) + { + if (firstTri1 == secondTri0) + { + if (firstTri2 == secondTri1) + isSame = true; + } + } + + return isSame; +} + + +bool TestTriangle(const unsigned short v0, const unsigned short v1, const unsigned short v2, const std::vector* in_bins, const int NUMBINS) +{ + //hash this triangle + bool isLegit = false; + int ctr = v0 % NUMBINS; + for (int k = 0; k < in_bins[ctr].size(); ++k) + { + //check triangles in this bin + if (SameTriangle(in_bins[ctr][k].m_v0, in_bins[ctr][k].m_v1, in_bins[ctr][k].m_v2, + v0, v1, v2)) + { + isLegit = true; + break; + } + } + if (!isLegit) + { + ctr = v1 % NUMBINS; + for (int k = 0; k < in_bins[ctr].size(); ++k) + { + //check triangles in this bin + if (SameTriangle(in_bins[ctr][k].m_v0, in_bins[ctr][k].m_v1, in_bins[ctr][k].m_v2, + v0, v1, v2)) + { + isLegit = true; + break; + } + } + + if (!isLegit) + { + ctr = v2 % NUMBINS; + for (int k = 0; k < in_bins[ctr].size(); ++k) + { + //check triangles in this bin + if (SameTriangle(in_bins[ctr][k].m_v0, in_bins[ctr][k].m_v1, in_bins[ctr][k].m_v2, + v0, v1, v2)) + { + isLegit = true; + break; + } + } + + } + } + + return isLegit; +} + + +//////////////////////////////////////////////////////////////////////////////////////// +// GenerateStrips() +// +// in_indices: input index list, the indices you would use to render +// in_numIndices: number of entries in in_indices +// primGroups: array of optimized/stripified PrimitiveGroups +// numGroups: number of groups returned +// +// Be sure to call delete[] on the returned primGroups to avoid leaking mem +// +bool GenerateStrips(const unsigned short* in_indices, const unsigned int in_numIndices, + PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled) +{ + //put data in format that the stripifier likes + WordVec tempIndices; + tempIndices.resize(in_numIndices); + unsigned short maxIndex = 0; + unsigned short minIndex = 0xFFFF; + for(int i = 0; i < in_numIndices; i++) + { + tempIndices[i] = in_indices[i]; + if (in_indices[i] > maxIndex) + maxIndex = in_indices[i]; + if (in_indices[i] < minIndex) + minIndex = in_indices[i]; + } + NvStripInfoVec tempStrips; + NvFaceInfoVec tempFaces; + + NvStripifier stripifier; + + //do actual stripification + stripifier.Stripify(tempIndices, cacheSize, minStripSize, maxIndex, tempStrips, tempFaces); + + //stitch strips together + IntVec stripIndices; + unsigned int numSeparateStrips = 0; + + if(bListsOnly) + { + //if we're outputting only lists, we're done + *numGroups = 1; + (*primGroups) = new PrimitiveGroup[*numGroups]; + PrimitiveGroup* primGroupArray = *primGroups; + + int i; + //count the total number of indices + unsigned int numIndices = 0; + for( i = 0; i < tempStrips.size(); i++) + { + numIndices += tempStrips[i]->m_faces.size() * 3; + } + + //add in the list + numIndices += tempFaces.size() * 3; + + primGroupArray[0].type = PT_LIST; + primGroupArray[0].numIndices = numIndices; + primGroupArray[0].indices = new unsigned short[numIndices]; + + //do strips + unsigned int indexCtr = 0; + for(i = 0; i < tempStrips.size(); i++) + { + for(int j = 0; j < tempStrips[i]->m_faces.size(); j++) + { + //degenerates are of no use with lists + if(!NvStripifier::IsDegenerate(tempStrips[i]->m_faces[j])) + { + primGroupArray[0].indices[indexCtr++] = tempStrips[i]->m_faces[j]->m_v0; + primGroupArray[0].indices[indexCtr++] = tempStrips[i]->m_faces[j]->m_v1; + primGroupArray[0].indices[indexCtr++] = tempStrips[i]->m_faces[j]->m_v2; + } + else + { + //we've removed a tri, reduce the number of indices + primGroupArray[0].numIndices -= 3; + } + } + } + + //do lists + for(i = 0; i < tempFaces.size(); i++) + { + primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v0; + primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v1; + primGroupArray[0].indices[indexCtr++] = tempFaces[i]->m_v2; + } + } + else + { + stripifier.CreateStrips(tempStrips, stripIndices, bStitchStrips, numSeparateStrips, bRestart, restartVal); + + //if we're stitching strips together, we better get back only one strip from CreateStrips() + assert( (bStitchStrips && (numSeparateStrips == 1)) || !bStitchStrips); + + //convert to output format + *numGroups = numSeparateStrips; //for the strips + if(tempFaces.size() != 0) + (*numGroups)++; //we've got a list as well, increment + (*primGroups) = new PrimitiveGroup[*numGroups]; + + PrimitiveGroup* primGroupArray = *primGroups; + + //first, the strips + int startingLoc = 0; + for(int stripCtr = 0; stripCtr < numSeparateStrips; stripCtr++) + { + int stripLength = 0; + + if(!bStitchStrips) + { + int i; + //if we've got multiple strips, we need to figure out the correct length + for( i = startingLoc; i < stripIndices.size(); i++) + { + if(stripIndices[i] == -1) + break; + } + + stripLength = i - startingLoc; + } + else + stripLength = stripIndices.size(); + + primGroupArray[stripCtr].type = PT_STRIP; + primGroupArray[stripCtr].indices = new unsigned short[stripLength]; + primGroupArray[stripCtr].numIndices = stripLength; + + int indexCtr = 0; + for(int i = startingLoc; i < stripLength + startingLoc; i++) + primGroupArray[stripCtr].indices[indexCtr++] = stripIndices[i]; + + //we add 1 to account for the -1 separating strips + //this doesn't break the stitched case since we'll exit the loop + startingLoc += stripLength + 1; + } + + //next, the list + if(tempFaces.size() != 0) + { + int faceGroupLoc = (*numGroups) - 1; //the face group is the last one + primGroupArray[faceGroupLoc].type = PT_LIST; + primGroupArray[faceGroupLoc].indices = new unsigned short[tempFaces.size() * 3]; + primGroupArray[faceGroupLoc].numIndices = tempFaces.size() * 3; + int indexCtr = 0; + for(int i = 0; i < tempFaces.size(); i++) + { + primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v0; + primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v1; + primGroupArray[faceGroupLoc].indices[indexCtr++] = tempFaces[i]->m_v2; + } + } + } + + //validate generated data against input + if (validateEnabled) + { + const int NUMBINS = 100; + + std::vector in_bins[NUMBINS]; + int i; + //hash input indices on first index + for ( i = 0; i < in_numIndices; i += 3) + { + NvFaceInfo faceInfo(in_indices[i], in_indices[i + 1], in_indices[i + 2]); + in_bins[in_indices[i] % NUMBINS].push_back(faceInfo); + } + + for (i = 0; i < *numGroups; ++i) + { + switch ((*primGroups)[i].type) + { + case PT_LIST: + { + for (int j = 0; j < (*primGroups)[i].numIndices; j += 3) + { + unsigned short v0 = (*primGroups)[i].indices[j]; + unsigned short v1 = (*primGroups)[i].indices[j + 1]; + unsigned short v2 = (*primGroups)[i].indices[j + 2]; + + //ignore degenerates + if (NvStripifier::IsDegenerate(v0, v1, v2)) + continue; + + if (!TestTriangle(v0, v1, v2, in_bins, NUMBINS)) + { + Cleanup(tempStrips, tempFaces); + return false; + } + } + break; + } + + case PT_STRIP: + { + int brokenCtr = 0; + bool flip = false; + for (int j = 2; j < (*primGroups)[i].numIndices; ++j) + { + unsigned short v0 = (*primGroups)[i].indices[j - 2]; + unsigned short v1 = (*primGroups)[i].indices[j - 1]; + unsigned short v2 = (*primGroups)[i].indices[j]; + + if (flip) + { + //swap v1 and v2 + unsigned short swap = v1; + v1 = v2; + v2 = swap; + } + + //ignore degenerates + if (NvStripifier::IsDegenerate(v0, v1, v2)) + { + flip = !flip; + continue; + } + + if (!TestTriangle(v0, v1, v2, in_bins, NUMBINS)) + { + Cleanup(tempStrips, tempFaces); + return false; + } + + flip = !flip; + } + break; + } + + case PT_FAN: + default: + break; + } + } + + } + + //clean up everything + Cleanup(tempStrips, tempFaces); + + return true; +} + + +//////////////////////////////////////////////////////////////////////////////////////// +// RemapIndices() +// +// Function to remap your indices to improve spatial locality in your vertex buffer. +// +// in_primGroups: array of PrimitiveGroups you want remapped +// numGroups: number of entries in in_primGroups +// numVerts: number of vertices in your vertex buffer, also can be thought of as the range +// of acceptable values for indices in your primitive groups. +// remappedGroups: array of remapped PrimitiveGroups +// +// Note that, according to the remapping handed back to you, you must reorder your +// vertex buffer. +// +void RemapIndices(const PrimitiveGroup* in_primGroups, const unsigned short numGroups, + const unsigned short numVerts, PrimitiveGroup** remappedGroups) +{ + (*remappedGroups) = new PrimitiveGroup[numGroups]; + + //caches oldIndex --> newIndex conversion + int *indexCache; + indexCache = new int[numVerts]; + memset(indexCache, -1, sizeof(int)*numVerts); + + //loop over primitive groups + unsigned int indexCtr = 0; + for(int i = 0; i < numGroups; i++) + { + unsigned int numIndices = in_primGroups[i].numIndices; + + //init remapped group + (*remappedGroups)[i].type = in_primGroups[i].type; + (*remappedGroups)[i].numIndices = numIndices; + (*remappedGroups)[i].indices = new unsigned short[numIndices]; + + for(int j = 0; j < numIndices; j++) + { + int cachedIndex = indexCache[in_primGroups[i].indices[j]]; + if(cachedIndex == -1) //we haven't seen this index before + { + //point to "last" vertex in VB + (*remappedGroups)[i].indices[j] = indexCtr; + + //add to index cache, increment + indexCache[in_primGroups[i].indices[j]] = indexCtr++; + } + else + { + //we've seen this index before + (*remappedGroups)[i].indices[j] = cachedIndex; + } + } + } + + delete[] indexCache; +} \ No newline at end of file diff --git a/DSMeshConvert/NvTriStrip/NvTriStrip.dsp b/DSMeshConvert/NvTriStrip/NvTriStrip.dsp new file mode 100644 index 0000000..7ae4cd1 --- /dev/null +++ b/DSMeshConvert/NvTriStrip/NvTriStrip.dsp @@ -0,0 +1,112 @@ +# Microsoft Developer Studio Project File - Name="NvTriStrip" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 60000 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Static Library" 0x0104 + +CFG=NvTriStrip - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "NvTriStrip.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "NvTriStrip.mak" CFG="NvTriStrip - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "NvTriStrip - Win32 Release" (based on "Win32 (x86) Static Library") +!MESSAGE "NvTriStrip - Win32 Debug" (based on "Win32 (x86) Static Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "NVIDIA_XBOX03" +# PROP Scc_LocalPath "." +CPP=xicl6.exe +RSC=rc.exe + +!IF "$(CFG)" == "NvTriStrip - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=xilink6.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"..\..\lib\Release\NvTriStrip.lib" + +!ELSEIF "$(CFG)" == "NvTriStrip - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LIB32=xilink6.exe -lib +# ADD BASE LIB32 /nologo +# ADD LIB32 /nologo /out:"..\..\lib\Debug\NvTriStrip.lib" + +!ENDIF + +# Begin Target + +# Name "NvTriStrip - Win32 Release" +# Name "NvTriStrip - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\NvTriStrip.cpp +# End Source File +# Begin Source File + +SOURCE=.\NvTriStripObjects.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=..\..\include\NvTriStrip.h +# End Source File +# Begin Source File + +SOURCE=.\NvTriStripObjects.h +# End Source File +# Begin Source File + +SOURCE=.\VertexCache.h +# End Source File +# End Group +# End Target +# End Project diff --git a/DSMeshConvert/NvTriStrip/NvTriStrip.dsw b/DSMeshConvert/NvTriStrip/NvTriStrip.dsw new file mode 100644 index 0000000..ffb4e0b --- /dev/null +++ b/DSMeshConvert/NvTriStrip/NvTriStrip.dsw @@ -0,0 +1,33 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "NvTriStrip"=.\NvTriStrip.dsp - Package Owner=<4> + +Package=<5> +{{{ + begin source code control + NVIDIA_XBOX03 + . + end source code control +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/DSMeshConvert/NvTriStrip/NvTriStrip.h b/DSMeshConvert/NvTriStrip/NvTriStrip.h new file mode 100644 index 0000000..9d95bd7 --- /dev/null +++ b/DSMeshConvert/NvTriStrip/NvTriStrip.h @@ -0,0 +1,145 @@ +#ifndef NVTRISTRIP_H +#define NVTRISTRIP_H + +#ifndef NULL +#define NULL 0 +#endif + +#pragma comment(lib, "nvtristrip") + +//////////////////////////////////////////////////////////////////////////////////////// +// Public interface for stripifier +//////////////////////////////////////////////////////////////////////////////////////// + +//GeForce1 and 2 cache size +#define CACHESIZE_GEFORCE1_2 16 + +//GeForce3 cache size +#define CACHESIZE_GEFORCE3 24 + +enum PrimType +{ + PT_LIST, + PT_STRIP, + PT_FAN +}; + +struct PrimitiveGroup +{ + PrimType type; + unsigned int numIndices; + unsigned short* indices; + +//////////////////////////////////////////////////////////////////////////////////////// + + PrimitiveGroup() : type(PT_STRIP), numIndices(0), indices(NULL) {} + ~PrimitiveGroup() + { + if(indices) + delete[] indices; + indices = NULL; + } +}; + + +//////////////////////////////////////////////////////////////////////////////////////// +// EnableRestart() +// +// For GPUs that support primitive restart, this sets a value as the restart index +// +// Restart is meaningless if strips are not being stitched together, so enabling restart +// makes NvTriStrip forcing stitching. So, you'll get back one strip. +// +// Default value: disabled +// +void EnableRestart(const unsigned int restartVal); + +//////////////////////////////////////////////////////////////////////////////////////// +// DisableRestart() +// +// For GPUs that support primitive restart, this disables using primitive restart +// +void DisableRestart(); + + +//////////////////////////////////////////////////////////////////////////////////////// +// SetCacheSize() +// +// Sets the cache size which the stripfier uses to optimize the data. +// Controls the length of the generated individual strips. +// This is the "actual" cache size, so 24 for GeForce3 and 16 for GeForce1/2 +// You may want to play around with this number to tweak performance. +// +// Default value: 16 +// +void SetCacheSize(const unsigned int cacheSize); + + +//////////////////////////////////////////////////////////////////////////////////////// +// SetStitchStrips() +// +// bool to indicate whether to stitch together strips into one huge strip or not. +// If set to true, you'll get back one huge strip stitched together using degenerate +// triangles. +// If set to false, you'll get back a large number of separate strips. +// +// Default value: true +// +void SetStitchStrips(const bool bStitchStrips); + + +//////////////////////////////////////////////////////////////////////////////////////// +// SetMinStripSize() +// +// Sets the minimum acceptable size for a strip, in triangles. +// All strips generated which are shorter than this will be thrown into one big, separate list. +// +// Default value: 0 +// +void SetMinStripSize(const unsigned int minSize); + + +//////////////////////////////////////////////////////////////////////////////////////// +// SetListsOnly() +// +// If set to true, will return an optimized list, with no strips at all. +// +// Default value: false +// +void SetListsOnly(const bool bListsOnly); + + +//////////////////////////////////////////////////////////////////////////////////////// +// GenerateStrips() +// +// in_indices: input index list, the indices you would use to render +// in_numIndices: number of entries in in_indices +// primGroups: array of optimized/stripified PrimitiveGroups +// numGroups: number of groups returned +// +// Be sure to call delete[] on the returned primGroups to avoid leaking mem +// +bool GenerateStrips(const unsigned short* in_indices, const unsigned int in_numIndices, + PrimitiveGroup** primGroups, unsigned short* numGroups, bool validateEnabled = false); + + +//////////////////////////////////////////////////////////////////////////////////////// +// RemapIndices() +// +// Function to remap your indices to improve spatial locality in your vertex buffer. +// +// in_primGroups: array of PrimitiveGroups you want remapped +// numGroups: number of entries in in_primGroups +// numVerts: number of vertices in your vertex buffer, also can be thought of as the range +// of acceptable values for indices in your primitive groups. +// remappedGroups: array of remapped PrimitiveGroups +// +// Note that, according to the remapping handed back to you, you must reorder your +// vertex buffer. +// +// Credit goes to the MS Xbox crew for the idea for this interface. +// +void RemapIndices(const PrimitiveGroup* in_primGroups, const unsigned short numGroups, + const unsigned short numVerts, PrimitiveGroup** remappedGroups); + +#endif \ No newline at end of file diff --git a/DSMeshConvert/NvTriStrip/NvTriStrip.ncb b/DSMeshConvert/NvTriStrip/NvTriStrip.ncb new file mode 100644 index 0000000..ea91085 Binary files /dev/null and b/DSMeshConvert/NvTriStrip/NvTriStrip.ncb differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.sln b/DSMeshConvert/NvTriStrip/NvTriStrip.sln similarity index 55% rename from DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.sln rename to DSMeshConvert/NvTriStrip/NvTriStrip.sln index 05a1faf..f464911 100644 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.sln +++ b/DSMeshConvert/NvTriStrip/NvTriStrip.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 10.00 # Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fipTest", "fipTest.2008.vcproj", "{66DCA866-A381-42D5-97FB-9792066C0F20}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NvTriStrip", "NvTriStrip.vcproj", "{D9F6019E-E223-4C1F-ABE2-539308020302}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -9,10 +9,10 @@ Global Release|Win32 = Release|Win32 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {66DCA866-A381-42D5-97FB-9792066C0F20}.Debug|Win32.ActiveCfg = Debug|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Debug|Win32.Build.0 = Debug|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Release|Win32.ActiveCfg = Release|Win32 - {66DCA866-A381-42D5-97FB-9792066C0F20}.Release|Win32.Build.0 = Release|Win32 + {D9F6019E-E223-4C1F-ABE2-539308020302}.Debug|Win32.ActiveCfg = Debug|Win32 + {D9F6019E-E223-4C1F-ABE2-539308020302}.Debug|Win32.Build.0 = Debug|Win32 + {D9F6019E-E223-4C1F-ABE2-539308020302}.Release|Win32.ActiveCfg = Release|Win32 + {D9F6019E-E223-4C1F-ABE2-539308020302}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DSMeshConvert/NvTriStrip/NvTriStrip.suo b/DSMeshConvert/NvTriStrip/NvTriStrip.suo new file mode 100644 index 0000000..be4e1f0 Binary files /dev/null and b/DSMeshConvert/NvTriStrip/NvTriStrip.suo differ diff --git a/DSMeshConvert/NvTriStrip/NvTriStrip.vcproj b/DSMeshConvert/NvTriStrip/NvTriStrip.vcproj new file mode 100644 index 0000000..94a6830 --- /dev/null +++ b/DSMeshConvert/NvTriStrip/NvTriStrip.vcproj @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DSMeshConvert/NvTriStrip/NvTriStripObjects.cpp b/DSMeshConvert/NvTriStrip/NvTriStripObjects.cpp new file mode 100644 index 0000000..5f4b88f --- /dev/null +++ b/DSMeshConvert/NvTriStrip/NvTriStripObjects.cpp @@ -0,0 +1,1769 @@ + +#pragma warning( disable : 4786 ) + +#include +#include +#include "NvTriStripObjects.h" +#include "VertexCache.h" + +#define CACHE_INEFFICIENCY 6 + +NvStripifier::NvStripifier() +{ + +} + +NvStripifier::~NvStripifier() +{ + +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// FindEdgeInfo() +// +// find the edge info for these two indices +// +NvEdgeInfo * NvStripifier::FindEdgeInfo(NvEdgeInfoVec &edgeInfos, int v0, int v1){ + + // we can get to it through either array + // because the edge infos have a v0 and v1 + // and there is no order except how it was + // first created. + NvEdgeInfo *infoIter = edgeInfos[v0]; + while (infoIter != NULL){ + if (infoIter->m_v0 == v0){ + if (infoIter->m_v1 == v1) + return infoIter; + else + infoIter = infoIter->m_nextV0; + } + else { + assert(infoIter->m_v1 == v0); + if (infoIter->m_v0 == v1) + return infoIter; + else + infoIter = infoIter->m_nextV1; + } + } + return NULL; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// FindOtherFace +// +// find the other face sharing these vertices +// exactly like the edge info above +// +NvFaceInfo * NvStripifier::FindOtherFace(NvEdgeInfoVec &edgeInfos, int v0, int v1, NvFaceInfo *faceInfo){ + NvEdgeInfo *edgeInfo = FindEdgeInfo(edgeInfos, v0, v1); + + if( (edgeInfo == NULL) && (v0 == v1)) + { + //we've hit a degenerate + return NULL; + } + + assert(edgeInfo != NULL); + return (edgeInfo->m_face0 == faceInfo ? edgeInfo->m_face1 : edgeInfo->m_face0); +} + + +bool NvStripifier::AlreadyExists(NvFaceInfo* faceInfo, NvFaceInfoVec& faceInfos) +{ + for(int i = 0; i < faceInfos.size(); ++i) + { + if( (faceInfos[i]->m_v0 == faceInfo->m_v0) && + (faceInfos[i]->m_v1 == faceInfo->m_v1) && + (faceInfos[i]->m_v2 == faceInfo->m_v2) ) + return true; + } + + return false; +} + +/////////////////////////////////////////////////////////////////////////////////////////// +// BuildStripifyInfo() +// +// Builds the list of all face and edge infos +// +void NvStripifier::BuildStripifyInfo(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos, + const unsigned short maxIndex) +{ + int i; + // reserve space for the face infos, but do not resize them. + int numIndices = indices.size(); + faceInfos.reserve(numIndices / 3); + + // we actually resize the edge infos, so we must initialize to NULL + edgeInfos.resize(maxIndex + 1); + for (i = 0; i < maxIndex + 1; i++) + edgeInfos[i] = NULL; + + // iterate through the triangles of the triangle list + int numTriangles = numIndices / 3; + int index = 0; + bool bFaceUpdated[3]; + + for (i = 0; i < numTriangles; i++) + { + bool bMightAlreadyExist = true; + bFaceUpdated[0] = false; + bFaceUpdated[1] = false; + bFaceUpdated[2] = false; + + // grab the indices + int v0 = indices[index++]; + int v1 = indices[index++]; + int v2 = indices[index++]; + + //we disregard degenerates + if(IsDegenerate(v0, v1, v2)) + continue; + + // create the face info and add it to the list of faces, but only if this exact face doesn't already + // exist in the list + NvFaceInfo *faceInfo = new NvFaceInfo(v0, v1, v2); + + // grab the edge infos, creating them if they do not already exist + NvEdgeInfo *edgeInfo01 = FindEdgeInfo(edgeInfos, v0, v1); + if (edgeInfo01 == NULL) + { + //since one of it's edges isn't in the edge data structure, it can't already exist in the face structure + bMightAlreadyExist = false; + + // create the info + edgeInfo01 = new NvEdgeInfo(v0, v1); + + // update the linked list on both + edgeInfo01->m_nextV0 = edgeInfos[v0]; + edgeInfo01->m_nextV1 = edgeInfos[v1]; + edgeInfos[v0] = edgeInfo01; + edgeInfos[v1] = edgeInfo01; + + // set face 0 + edgeInfo01->m_face0 = faceInfo; + } + else + { + if (edgeInfo01->m_face1 != NULL) + { + printf("BuildStripifyInfo: > 2 triangles on an edge... uncertain consequences\n"); + } + else + { + edgeInfo01->m_face1 = faceInfo; + bFaceUpdated[0] = true; + } + } + + // grab the edge infos, creating them if they do not already exist + NvEdgeInfo *edgeInfo12 = FindEdgeInfo(edgeInfos, v1, v2); + if (edgeInfo12 == NULL) + { + bMightAlreadyExist = false; + + // create the info + edgeInfo12 = new NvEdgeInfo(v1, v2); + + // update the linked list on both + edgeInfo12->m_nextV0 = edgeInfos[v1]; + edgeInfo12->m_nextV1 = edgeInfos[v2]; + edgeInfos[v1] = edgeInfo12; + edgeInfos[v2] = edgeInfo12; + + // set face 0 + edgeInfo12->m_face0 = faceInfo; + } + else + { + if (edgeInfo12->m_face1 != NULL) + { + printf("BuildStripifyInfo: > 2 triangles on an edge... uncertain consequences\n"); + } + else + { + edgeInfo12->m_face1 = faceInfo; + bFaceUpdated[1] = true; + } + } + + // grab the edge infos, creating them if they do not already exist + NvEdgeInfo *edgeInfo20 = FindEdgeInfo(edgeInfos, v2, v0); + if (edgeInfo20 == NULL) + { + bMightAlreadyExist = false; + + // create the info + edgeInfo20 = new NvEdgeInfo(v2, v0); + + // update the linked list on both + edgeInfo20->m_nextV0 = edgeInfos[v2]; + edgeInfo20->m_nextV1 = edgeInfos[v0]; + edgeInfos[v2] = edgeInfo20; + edgeInfos[v0] = edgeInfo20; + + // set face 0 + edgeInfo20->m_face0 = faceInfo; + } + else + { + if (edgeInfo20->m_face1 != NULL) + { + printf("BuildStripifyInfo: > 2 triangles on an edge... uncertain consequences\n"); + } + else + { + edgeInfo20->m_face1 = faceInfo; + bFaceUpdated[2] = true; + } + } + + if(bMightAlreadyExist) + { + if(!AlreadyExists(faceInfo, faceInfos)) + faceInfos.push_back(faceInfo); + else + { + delete faceInfo; + + //cleanup pointers that point to this deleted face + if(bFaceUpdated[0]) + edgeInfo01->m_face1 = NULL; + if(bFaceUpdated[1]) + edgeInfo12->m_face1 = NULL; + if(bFaceUpdated[2]) + edgeInfo20->m_face1 = NULL; + } + } + else + { + faceInfos.push_back(faceInfo); + } + + } +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// FindStartPoint() +// +// Finds a good starting point, namely one which has only one neighbor +// +int NvStripifier::FindStartPoint(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos) +{ + int bestCtr = -1; + int bestIndex = -1; + + for(int i = 0; i < faceInfos.size(); i++) + { + int ctr = 0; + + if(FindOtherFace(edgeInfos, faceInfos[i]->m_v0, faceInfos[i]->m_v1, faceInfos[i]) == NULL) + ctr++; + if(FindOtherFace(edgeInfos, faceInfos[i]->m_v1, faceInfos[i]->m_v2, faceInfos[i]) == NULL) + ctr++; + if(FindOtherFace(edgeInfos, faceInfos[i]->m_v2, faceInfos[i]->m_v0, faceInfos[i]) == NULL) + ctr++; + if(ctr > bestCtr) + { + bestCtr = ctr; + bestIndex = i; + //return i; + } + } + //return -1; + + if(bestCtr == 0) + return -1; + else + return bestIndex; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// FindGoodResetPoint() +// +// A good reset point is one near other commited areas so that +// we know that when we've made the longest strips its because +// we're stripifying in the same general orientation. +// +NvFaceInfo* NvStripifier::FindGoodResetPoint(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos){ + // we hop into different areas of the mesh to try to get + // other large open spans done. Areas of small strips can + // just be left to triangle lists added at the end. + NvFaceInfo *result = NULL; + + if(result == NULL) + { + int numFaces = faceInfos.size(); + int startPoint; + if(bFirstTimeResetPoint) + { + //first time, find a face with few neighbors (look for an edge of the mesh) + startPoint = FindStartPoint(faceInfos, edgeInfos); + bFirstTimeResetPoint = false; + } + else + startPoint = (int)(((float) numFaces - 1) * meshJump); + + if(startPoint == -1) + { + startPoint = (int)(((float) numFaces - 1) * meshJump); + + //meshJump += 0.1f; + //if (meshJump > 1.0f) + // meshJump = .05f; + } + + int i = startPoint; + do { + + // if this guy isn't visited, try him + if (faceInfos[i]->m_stripId < 0){ + result = faceInfos[i]; + break; + } + + // update the index and clamp to 0-(numFaces-1) + if (++i >= numFaces) + i = 0; + + } while (i != startPoint); + + // update the meshJump + meshJump += 0.1f; + if (meshJump > 1.0f) + meshJump = .05f; + } + + // return the best face we found + return result; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// GetUniqueVertexInB() +// +// Returns the vertex unique to faceB +// +int NvStripifier::GetUniqueVertexInB(NvFaceInfo *faceA, NvFaceInfo *faceB){ + + int facev0 = faceB->m_v0; + if (facev0 != faceA->m_v0 && + facev0 != faceA->m_v1 && + facev0 != faceA->m_v2) + return facev0; + + int facev1 = faceB->m_v1; + if (facev1 != faceA->m_v0 && + facev1 != faceA->m_v1 && + facev1 != faceA->m_v2) + return facev1; + + int facev2 = faceB->m_v2; + if (facev2 != faceA->m_v0 && + facev2 != faceA->m_v1 && + facev2 != faceA->m_v2) + return facev2; + + // nothing is different + return -1; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// GetSharedVertices() +// +// Returns the (at most) two vertices shared between the two faces +// +void NvStripifier::GetSharedVertices(NvFaceInfo *faceA, NvFaceInfo *faceB, int* vertex0, int* vertex1) +{ + *vertex0 = -1; + *vertex1 = -1; + + int facev0 = faceB->m_v0; + if (facev0 == faceA->m_v0 || + facev0 == faceA->m_v1 || + facev0 == faceA->m_v2) + { + if(*vertex0 == -1) + *vertex0 = facev0; + else + { + *vertex1 = facev0; + return; + } + } + + int facev1 = faceB->m_v1; + if (facev1 == faceA->m_v0 || + facev1 == faceA->m_v1 || + facev1 == faceA->m_v2) + { + if(*vertex0 == -1) + *vertex0 = facev1; + else + { + *vertex1 = facev1; + return; + } + } + + int facev2 = faceB->m_v2; + if (facev2 == faceA->m_v0 || + facev2 == faceA->m_v1 || + facev2 == faceA->m_v2) + { + if(*vertex0 == -1) + *vertex0 = facev2; + else + { + *vertex1 = facev2; + return; + } + } + +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// GetNextIndex() +// +// Returns vertex of the input face which is "next" in the input index list +// +inline int NvStripifier::GetNextIndex(const WordVec &indices, NvFaceInfo *face){ + + int numIndices = indices.size(); + assert(numIndices >= 2); + + int v0 = indices[numIndices-2]; + int v1 = indices[numIndices-1]; + + int fv0 = face->m_v0; + int fv1 = face->m_v1; + int fv2 = face->m_v2; + + if (fv0 != v0 && fv0 != v1){ + if ((fv1 != v0 && fv1 != v1) || (fv2 != v0 && fv2 != v1)){ + printf("GetNextIndex: Triangle doesn't have all of its vertices\n"); + printf("GetNextIndex: Duplicate triangle probably got us derailed\n"); + } + return fv0; + } + if (fv1 != v0 && fv1 != v1){ + if ((fv0 != v0 && fv0 != v1) || (fv2 != v0 && fv2 != v1)){ + printf("GetNextIndex: Triangle doesn't have all of its vertices\n"); + printf("GetNextIndex: Duplicate triangle probably got us derailed\n"); + } + return fv1; + } + if (fv2 != v0 && fv2 != v1){ + if ((fv0 != v0 && fv0 != v1) || (fv1 != v0 && fv1 != v1)){ + printf("GetNextIndex: Triangle doesn't have all of its vertices\n"); + printf("GetNextIndex: Duplicate triangle probably got us derailed\n"); + } + return fv2; + } + + // shouldn't get here, but let's try and fail gracefully + if( (fv0 == fv1) || (fv0 == fv2) ) + return fv0; + else if( (fv1 == fv0) || (fv1 == fv2) ) + return fv1; + else if( (fv2 == fv0) || (fv2 == fv1) ) + return fv2; + else + return -1; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// IsMarked() +// +// If either the faceInfo has a real strip index because it is +// already assign to a committed strip OR it is assigned in an +// experiment and the experiment index is the one we are building +// for, then it is marked and unavailable +inline bool NvStripInfo::IsMarked(NvFaceInfo *faceInfo){ + return (faceInfo->m_stripId >= 0) || (IsExperiment() && faceInfo->m_experimentId == m_experimentId); +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// MarkTriangle() +// +// Marks the face with the current strip ID +// +inline void NvStripInfo::MarkTriangle(NvFaceInfo *faceInfo){ + assert(!IsMarked(faceInfo)); + if (IsExperiment()){ + faceInfo->m_experimentId = m_experimentId; + faceInfo->m_testStripId = m_stripId; + } + else{ + assert(faceInfo->m_stripId == -1); + faceInfo->m_experimentId = -1; + faceInfo->m_stripId = m_stripId; + } +} + + +bool NvStripInfo::Unique(NvFaceInfoVec& faceVec, NvFaceInfo* face) +{ + bool bv0, bv1, bv2; //bools to indicate whether a vertex is in the faceVec or not + bv0 = bv1 = bv2 = false; + + for(int i = 0; i < faceVec.size(); i++) + { + if(!bv0) + { + if( (faceVec[i]->m_v0 == face->m_v0) || + (faceVec[i]->m_v1 == face->m_v0) || + (faceVec[i]->m_v2 == face->m_v0) ) + bv0 = true; + } + + if(!bv1) + { + if( (faceVec[i]->m_v0 == face->m_v1) || + (faceVec[i]->m_v1 == face->m_v1) || + (faceVec[i]->m_v2 == face->m_v1) ) + bv1 = true; + } + + if(!bv2) + { + if( (faceVec[i]->m_v0 == face->m_v2) || + (faceVec[i]->m_v1 == face->m_v2) || + (faceVec[i]->m_v2 == face->m_v2) ) + bv2 = true; + } + + //the face is not unique, all it's vertices exist in the face vector + if(bv0 && bv1 && bv2) + return false; + } + + //if we get out here, it's unique + return true; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// Build() +// +// Builds a strip forward as far as we can go, then builds backwards, and joins the two lists +// +void NvStripInfo::Build(NvEdgeInfoVec &edgeInfos, NvFaceInfoVec &faceInfos) +{ + // used in building the strips forward and backward + WordVec scratchIndices; + + // build forward... start with the initial face + NvFaceInfoVec forwardFaces, backwardFaces; + forwardFaces.push_back(m_startInfo.m_startFace); + + MarkTriangle(m_startInfo.m_startFace); + + int v0 = (m_startInfo.m_toV1 ? m_startInfo.m_startEdge->m_v0 : m_startInfo.m_startEdge->m_v1); + int v1 = (m_startInfo.m_toV1 ? m_startInfo.m_startEdge->m_v1 : m_startInfo.m_startEdge->m_v0); + + // easiest way to get v2 is to use this function which requires the + // other indices to already be in the list. + scratchIndices.push_back(v0); + scratchIndices.push_back(v1); + int v2 = NvStripifier::GetNextIndex(scratchIndices, m_startInfo.m_startFace); + scratchIndices.push_back(v2); + + // + // build the forward list + // + int nv0 = v1; + int nv1 = v2; + + NvFaceInfo *nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, m_startInfo.m_startFace); + while (nextFace != NULL && !IsMarked(nextFace)) + { + //check to see if this next face is going to cause us to die soon + int testnv0 = nv1; + int testnv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace); + + NvFaceInfo* nextNextFace = NvStripifier::FindOtherFace(edgeInfos, testnv0, testnv1, nextFace); + + if( (nextNextFace == NULL) || (IsMarked(nextNextFace)) ) + { + //uh, oh, we're following a dead end, try swapping + NvFaceInfo* testNextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, testnv1, nextFace); + + if( ((testNextFace != NULL) && !IsMarked(testNextFace)) ) + { + //we only swap if it buys us something + + //add a "fake" degenerate face + NvFaceInfo* tempFace = new NvFaceInfo(nv0, nv1, nv0, true); + + forwardFaces.push_back(tempFace); + MarkTriangle(tempFace); + + scratchIndices.push_back(nv0); + testnv0 = nv0; + + ++m_numDegenerates; + } + + } + + // add this to the strip + forwardFaces.push_back(nextFace); + + MarkTriangle(nextFace); + + // add the index + //nv0 = nv1; + //nv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace); + scratchIndices.push_back(testnv1); + + // and get the next face + nv0 = testnv0; + nv1 = testnv1; + + nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, nextFace); + + } + + // tempAllFaces is going to be forwardFaces + backwardFaces + // it's used for Unique() + NvFaceInfoVec tempAllFaces; + for(int i = 0; i < forwardFaces.size(); i++) + tempAllFaces.push_back(forwardFaces[i]); + + // + // reset the indices for building the strip backwards and do so + // + scratchIndices.resize(0); + scratchIndices.push_back(v2); + scratchIndices.push_back(v1); + scratchIndices.push_back(v0); + nv0 = v1; + nv1 = v0; + nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, m_startInfo.m_startFace); + while (nextFace != NULL && !IsMarked(nextFace)) + { + //this tests to see if a face is "unique", meaning that its vertices aren't already in the list + // so, strips which "wrap-around" are not allowed + if(!Unique(tempAllFaces, nextFace)) + break; + + //check to see if this next face is going to cause us to die soon + int testnv0 = nv1; + int testnv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace); + + NvFaceInfo* nextNextFace = NvStripifier::FindOtherFace(edgeInfos, testnv0, testnv1, nextFace); + + if( (nextNextFace == NULL) || (IsMarked(nextNextFace)) ) + { + //uh, oh, we're following a dead end, try swapping + NvFaceInfo* testNextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, testnv1, nextFace); + if( ((testNextFace != NULL) && !IsMarked(testNextFace)) ) + { + //we only swap if it buys us something + + //add a "fake" degenerate face + NvFaceInfo* tempFace = new NvFaceInfo(nv0, nv1, nv0, true); + + backwardFaces.push_back(tempFace); + MarkTriangle(tempFace); + scratchIndices.push_back(nv0); + testnv0 = nv0; + + ++m_numDegenerates; + } + + } + + // add this to the strip + backwardFaces.push_back(nextFace); + + //this is just so Unique() will work + tempAllFaces.push_back(nextFace); + + MarkTriangle(nextFace); + + // add the index + //nv0 = nv1; + //nv1 = NvStripifier::GetNextIndex(scratchIndices, nextFace); + scratchIndices.push_back(testnv1); + + // and get the next face + nv0 = testnv0; + nv1 = testnv1; + nextFace = NvStripifier::FindOtherFace(edgeInfos, nv0, nv1, nextFace); + } + + // Combine the forward and backwards stripification lists and put into our own face vector + Combine(forwardFaces, backwardFaces); +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// Combine() +// +// Combines the two input face vectors and puts the result into m_faces +// +void NvStripInfo::Combine(const NvFaceInfoVec &forward, const NvFaceInfoVec &backward) +{ + int i; + // add backward faces + int numFaces = backward.size(); + for (i = numFaces - 1; i >= 0; i--) + m_faces.push_back(backward[i]); + + // add forward faces + numFaces = forward.size(); + for (i = 0; i < numFaces; i++) + m_faces.push_back(forward[i]); +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// SharesEdge() +// +// Returns true if the input face and the current strip share an edge +// +bool NvStripInfo::SharesEdge(const NvFaceInfo* faceInfo, NvEdgeInfoVec &edgeInfos) +{ + //check v0->v1 edge + NvEdgeInfo* currEdge = NvStripifier::FindEdgeInfo(edgeInfos, faceInfo->m_v0, faceInfo->m_v1); + + if(IsInStrip(currEdge->m_face0) || IsInStrip(currEdge->m_face1)) + return true; + + //check v1->v2 edge + currEdge = NvStripifier::FindEdgeInfo(edgeInfos, faceInfo->m_v1, faceInfo->m_v2); + + if(IsInStrip(currEdge->m_face0) || IsInStrip(currEdge->m_face1)) + return true; + + //check v2->v0 edge + currEdge = NvStripifier::FindEdgeInfo(edgeInfos, faceInfo->m_v2, faceInfo->m_v0); + + if(IsInStrip(currEdge->m_face0) || IsInStrip(currEdge->m_face1)) + return true; + + return false; + +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// CommitStrips() +// +// "Commits" the input strips by setting their m_experimentId to -1 and adding to the allStrips +// vector +// +void NvStripifier::CommitStrips(NvStripInfoVec &allStrips, const NvStripInfoVec &strips) +{ + // Iterate through strips + int numStrips = strips.size(); + for (int i = 0; i < numStrips; i++){ + + // Tell the strip that it is now real + NvStripInfo *strip = strips[i]; + strip->m_experimentId = -1; + + // add to the list of real strips + allStrips.push_back(strip); + + // Iterate through the faces of the strip + // Tell the faces of the strip that they belong to a real strip now + const NvFaceInfoVec &faces = strips[i]->m_faces; + int numFaces = faces.size(); + + for (int j = 0; j < numFaces; j++) + { + strip->MarkTriangle(faces[j]); + } + } +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// FindTraversal() +// +// Finds the next face to start the next strip on. +// +bool NvStripifier::FindTraversal(NvFaceInfoVec &faceInfos, + NvEdgeInfoVec &edgeInfos, + NvStripInfo *strip, + NvStripStartInfo &startInfo){ + + // if the strip was v0->v1 on the edge, then v1 will be a vertex in the next edge. + int v = (strip->m_startInfo.m_toV1 ? strip->m_startInfo.m_startEdge->m_v1 : strip->m_startInfo.m_startEdge->m_v0); + + NvFaceInfo *untouchedFace = NULL; + NvEdgeInfo *edgeIter = edgeInfos[v]; + while (edgeIter != NULL){ + NvFaceInfo *face0 = edgeIter->m_face0; + NvFaceInfo *face1 = edgeIter->m_face1; + if ((face0 != NULL && !strip->IsInStrip(face0)) && face1 != NULL && !strip->IsMarked(face1)) + { + untouchedFace = face1; + break; + } + if ((face1 != NULL && !strip->IsInStrip(face1)) && face0 != NULL && !strip->IsMarked(face0)){ + untouchedFace = face0; + break; + } + + // find the next edgeIter + edgeIter = (edgeIter->m_v0 == v ? edgeIter->m_nextV0 : edgeIter->m_nextV1); + } + + startInfo.m_startFace = untouchedFace; + startInfo.m_startEdge = edgeIter; + if (edgeIter != NULL) + { + if(strip->SharesEdge(startInfo.m_startFace, edgeInfos)) + startInfo.m_toV1 = (edgeIter->m_v0 == v); //note! used to be m_v1 + else + startInfo.m_toV1 = (edgeIter->m_v1 == v); + } + return (startInfo.m_startFace != NULL); +} + + +//////////////////////////////////////////////////////////////////////////////////////// +// RemoveSmallStrips() +// +// allStrips is the whole strip vector...all small strips will be deleted from this list, to avoid leaking mem +// allBigStrips is an out parameter which will contain all strips above minStripLength +// faceList is an out parameter which will contain all faces which were removed from the striplist +// +void NvStripifier::RemoveSmallStrips(NvStripInfoVec& allStrips, NvStripInfoVec& allBigStrips, NvFaceInfoVec& faceList) +{ + faceList.clear(); + allBigStrips.clear(); //make sure these are empty + NvFaceInfoVec tempFaceList; + + for(int i = 0; i < allStrips.size(); i++) + { + if(allStrips[i]->m_faces.size() < minStripLength) + { + //strip is too small, add faces to faceList + for(int j = 0; j < allStrips[i]->m_faces.size(); j++) + tempFaceList.push_back(allStrips[i]->m_faces[j]); + + //and free memory + delete allStrips[i]; + } + else + { + allBigStrips.push_back(allStrips[i]); + } + } + + if(tempFaceList.size()) + { + bool *bVisitedList = new bool[tempFaceList.size()]; + memset(bVisitedList, 0, tempFaceList.size()*sizeof(bool)); + + VertexCache* vcache = new VertexCache(cacheSize); + + int bestNumHits = -1; + int numHits; + int bestIndex; + + while(1) + { + bestNumHits = -1; + + //find best face to add next, given the current cache + for(int i = 0; i < tempFaceList.size(); i++) + { + if(bVisitedList[i]) + continue; + + numHits = CalcNumHitsFace(vcache, tempFaceList[i]); + if(numHits > bestNumHits) + { + bestNumHits = numHits; + bestIndex = i; + } + } + + if(bestNumHits == -1.0f) + break; + bVisitedList[bestIndex] = true; + UpdateCacheFace(vcache, tempFaceList[bestIndex]); + faceList.push_back(tempFaceList[bestIndex]); + } + + delete vcache; + delete[] bVisitedList; + } +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// NextIsCW() +// +// Returns true if the next face should be ordered in CW fashion +// +bool NvStripifier::NextIsCW(const int numIndices) +{ + return ((numIndices % 2) == 0); +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// IsCW() +// +// Returns true if the face is ordered in CW fashion +// +bool NvStripifier::IsCW(NvFaceInfo *faceInfo, int v0, int v1) +{ + if (faceInfo->m_v0 == v0) + return (faceInfo->m_v1 == v1); + + else if (faceInfo->m_v1 == v0) + return (faceInfo->m_v2 == v1); + + else + return (faceInfo->m_v0 == v1); + + // shouldn't get here + assert(0); + return false; +} + +bool NvStripifier::FaceContainsIndex(const NvFaceInfo& face, const unsigned int index) +{ + return ( (face.m_v0 == index) || (face.m_v1 == index) || (face.m_v2 == index) ); +} + +bool NvStripifier::IsMoneyFace(const NvFaceInfo& face) +{ + if(FaceContainsIndex(face, 800) && + FaceContainsIndex(face, 812) && + FaceContainsIndex(face, 731)) + return true; + + return false; +} + +//////////////////////////////////////////////////////////////////////////////////////// +// CreateStrips() +// +// Generates actual strips from the list-in-strip-order. +// +void NvStripifier::CreateStrips(const NvStripInfoVec& allStrips, IntVec& stripIndices, + const bool bStitchStrips, unsigned int& numSeparateStrips, + const bool bRestart, const unsigned int restartVal) +{ + assert(numSeparateStrips == 0); + + NvFaceInfo tLastFace(0, 0, 0); + NvFaceInfo tPrevStripLastFace(0, 0, 0); + int nStripCount = allStrips.size(); + assert(nStripCount > 0); + + //we infer the cw/ccw ordering depending on the number of indices + //this is screwed up by the fact that we insert -1s to denote changing strips + //this is to account for that + int accountForNegatives = 0; + + for (int i = 0; i < nStripCount; i++) + { + NvStripInfo *strip = allStrips[i]; + int nStripFaceCount = strip->m_faces.size(); + assert(nStripFaceCount > 0); + + // Handle the first face in the strip + { + NvFaceInfo tFirstFace(strip->m_faces[0]->m_v0, strip->m_faces[0]->m_v1, strip->m_faces[0]->m_v2); + + // If there is a second face, reorder vertices such that the + // unique vertex is first + if (nStripFaceCount > 1) + { + int nUnique = NvStripifier::GetUniqueVertexInB(strip->m_faces[1], &tFirstFace); + if (nUnique == tFirstFace.m_v1) + { + SWAP(tFirstFace.m_v0, tFirstFace.m_v1); + } + else if (nUnique == tFirstFace.m_v2) + { + SWAP(tFirstFace.m_v0, tFirstFace.m_v2); + } + + // If there is a third face, reorder vertices such that the + // shared vertex is last + if (nStripFaceCount > 2) + { + if(IsDegenerate(strip->m_faces[1])) + { + int pivot = strip->m_faces[1]->m_v1; + if(tFirstFace.m_v1 == pivot) + { + SWAP(tFirstFace.m_v1, tFirstFace.m_v2); + } + } + else + { + int nShared0, nShared1; + GetSharedVertices(strip->m_faces[2], &tFirstFace, &nShared0, &nShared1); + if ( (nShared0 == tFirstFace.m_v1) && (nShared1 == -1) ) + { + SWAP(tFirstFace.m_v1, tFirstFace.m_v2); + } + } + } + } + + if( (i == 0) || !bStitchStrips || bRestart) + { + if(!IsCW(strip->m_faces[0], tFirstFace.m_v0, tFirstFace.m_v1)) + stripIndices.push_back(tFirstFace.m_v0); + } + else + { + // Double tap the first in the new strip + stripIndices.push_back(tFirstFace.m_v0); + + // Check CW/CCW ordering + if (NextIsCW(stripIndices.size() - accountForNegatives) != IsCW(strip->m_faces[0], tFirstFace.m_v0, tFirstFace.m_v1)) + { + stripIndices.push_back(tFirstFace.m_v0); + } + } + + stripIndices.push_back(tFirstFace.m_v0); + stripIndices.push_back(tFirstFace.m_v1); + stripIndices.push_back(tFirstFace.m_v2); + + // Update last face info + tLastFace = tFirstFace; + } + + for (int j = 1; j < nStripFaceCount; j++) + { + int nUnique = GetUniqueVertexInB(&tLastFace, strip->m_faces[j]); + if (nUnique != -1) + { + stripIndices.push_back(nUnique); + + // Update last face info + tLastFace.m_v0 = tLastFace.m_v1; + tLastFace.m_v1 = tLastFace.m_v2; + tLastFace.m_v2 = nUnique; + } + else + { + //we've hit a degenerate + stripIndices.push_back(strip->m_faces[j]->m_v2); + tLastFace.m_v0 = strip->m_faces[j]->m_v0;//tLastFace.m_v1; + tLastFace.m_v1 = strip->m_faces[j]->m_v1;//tLastFace.m_v2; + tLastFace.m_v2 = strip->m_faces[j]->m_v2;//tLastFace.m_v1; + + } + } + + // Double tap between strips. + if (bStitchStrips && !bRestart) + { + if (i != nStripCount - 1) + stripIndices.push_back(tLastFace.m_v2); + } + else if (bRestart) + { + stripIndices.push_back(restartVal); + } + else + { + //-1 index indicates next strip + stripIndices.push_back(-1); + accountForNegatives++; + numSeparateStrips++; + } + + // Update last face info + tLastFace.m_v0 = tLastFace.m_v1; + tLastFace.m_v1 = tLastFace.m_v2; + tLastFace.m_v2 = tLastFace.m_v2; + } + + if(bStitchStrips || bRestart) + numSeparateStrips = 1; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// Stripify() +// +// +// in_indices are the input indices of the mesh to stripify +// in_cacheSize is the target cache size +// +void NvStripifier::Stripify(const WordVec &in_indices, const int in_cacheSize, + const int in_minStripLength, const unsigned short maxIndex, + NvStripInfoVec &outStrips, NvFaceInfoVec& outFaceList) +{ + meshJump = 0.0f; + bFirstTimeResetPoint = true; //used in FindGoodResetPoint() + + //the number of times to run the experiments + int numSamples = 10; + + //the cache size, clamped to one + cacheSize = max(1, in_cacheSize - CACHE_INEFFICIENCY); + + minStripLength = in_minStripLength; //this is the strip size threshold below which we dump the strip into a list + + indices = in_indices; + + // build the stripification info + NvFaceInfoVec allFaceInfos; + NvEdgeInfoVec allEdgeInfos; + + BuildStripifyInfo(allFaceInfos, allEdgeInfos, maxIndex); + + NvStripInfoVec allStrips; + + // stripify + FindAllStrips(allStrips, allFaceInfos, allEdgeInfos, numSamples); + + //split up the strips into cache friendly pieces, optimize them, then dump these into outStrips + SplitUpStripsAndOptimize(allStrips, outStrips, allEdgeInfos, outFaceList); + + int i; + //clean up + for(i = 0; i < allStrips.size(); i++) + { + delete allStrips[i]; + } + + for (i = 0; i < allEdgeInfos.size(); i++) + { + NvEdgeInfo *info = allEdgeInfos[i]; + while (info != NULL) + { + NvEdgeInfo *next = (info->m_v0 == i ? info->m_nextV0 : info->m_nextV1); + info->Unref(); + info = next; + } + } + +} + + +bool NvStripifier::IsDegenerate(const NvFaceInfo* face) +{ + if(face->m_v0 == face->m_v1) + return true; + else if(face->m_v0 == face->m_v2) + return true; + else if(face->m_v1 == face->m_v2) + return true; + else + return false; +} + +bool NvStripifier::IsDegenerate(const unsigned short v0, const unsigned short v1, const unsigned short v2) +{ + if(v0 == v1) + return true; + else if(v0 == v2) + return true; + else if(v1 == v2) + return true; + else + return false; +} + +/////////////////////////////////////////////////////////////////////////////////////////// +// SplitUpStripsAndOptimize() +// +// Splits the input vector of strips (allBigStrips) into smaller, cache friendly pieces, then +// reorders these pieces to maximize cache hits +// The final strips are output through outStrips +// +void NvStripifier::SplitUpStripsAndOptimize(NvStripInfoVec &allStrips, NvStripInfoVec &outStrips, + NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& outFaceList) +{ + int threshold = cacheSize; + NvStripInfoVec tempStrips; + int i; + //split up strips into threshold-sized pieces + for(i = 0; i < allStrips.size(); i++) + { + NvStripInfo* currentStrip; + NvStripStartInfo startInfo(NULL, NULL, false); + + int actualStripSize = 0; + for(int j = 0; j < allStrips[i]->m_faces.size(); ++j) + { + if( !IsDegenerate(allStrips[i]->m_faces[j]) ) + actualStripSize++; + } + + if(actualStripSize /*allStrips[i]->m_faces.size()*/ > threshold) + { + + int numTimes = actualStripSize /*allStrips[i]->m_faces.size()*/ / threshold; + int numLeftover = actualStripSize /*allStrips[i]->m_faces.size()*/ % threshold; + + int degenerateCount = 0; + int j; + for(j = 0; j < numTimes; j++) + { + currentStrip = new NvStripInfo(startInfo, 0, -1); + + int faceCtr = j*threshold + degenerateCount; + bool bFirstTime = true; + while(faceCtr < threshold+(j*threshold)+degenerateCount) + { + if(IsDegenerate(allStrips[i]->m_faces[faceCtr])) + { + degenerateCount++; + + //last time or first time through, no need for a degenerate + if( (((faceCtr + 1) != threshold+(j*threshold)+degenerateCount) || + ((j == numTimes - 1) && (numLeftover < 4) && (numLeftover > 0))) && + !bFirstTime) + { + currentStrip->m_faces.push_back(allStrips[i]->m_faces[faceCtr++]); + } + else + { + //but, we do need to delete the degenerate, if it's marked fake, to avoid leaking + if(allStrips[i]->m_faces[faceCtr]->m_bIsFake) + { + delete allStrips[i]->m_faces[faceCtr], allStrips[i]->m_faces[faceCtr] = NULL; + } + ++faceCtr; + } + } + else + { + currentStrip->m_faces.push_back(allStrips[i]->m_faces[faceCtr++]); + bFirstTime = false; + } + } + /* + for(int faceCtr = j*threshold; faceCtr < threshold+(j*threshold); faceCtr++) + { + currentStrip->m_faces.push_back(allStrips[i]->m_faces[faceCtr]); + } + */ + if(j == numTimes - 1) //last time through + { + if( (numLeftover < 4) && (numLeftover > 0) ) //way too small + { + //just add to last strip + int ctr = 0; + while(ctr < numLeftover) + { + IsDegenerate( allStrips[i]->m_faces[faceCtr] ) ? ++degenerateCount : ++ctr; + currentStrip->m_faces.push_back(allStrips[i]->m_faces[faceCtr++]); + } + numLeftover = 0; + } + } + tempStrips.push_back(currentStrip); + } + + int leftOff = j * threshold + degenerateCount; + + if(numLeftover != 0) + { + currentStrip = new NvStripInfo(startInfo, 0, -1); + + int ctr = 0; + bool bFirstTime = true; + while(ctr < numLeftover) + { + if( !IsDegenerate(allStrips[i]->m_faces[leftOff]) ) + { + ctr++; + bFirstTime = false; + currentStrip->m_faces.push_back(allStrips[i]->m_faces[leftOff++]); + } + else if(!bFirstTime) + currentStrip->m_faces.push_back(allStrips[i]->m_faces[leftOff++]); + else + { + //don't leak + if(allStrips[i]->m_faces[leftOff]->m_bIsFake) + { + delete allStrips[i]->m_faces[leftOff], allStrips[i]->m_faces[leftOff] = NULL; + } + + leftOff++; + } + } + /* + for(int k = 0; k < numLeftover; k++) + { + currentStrip->m_faces.push_back(allStrips[i]->m_faces[leftOff++]); + } + */ + + tempStrips.push_back(currentStrip); + } + } + else + { + //we're not just doing a tempStrips.push_back(allBigStrips[i]) because + // this way we can delete allBigStrips later to free the memory + currentStrip = new NvStripInfo(startInfo, 0, -1); + + for(int j = 0; j < allStrips[i]->m_faces.size(); j++) + currentStrip->m_faces.push_back(allStrips[i]->m_faces[j]); + + tempStrips.push_back(currentStrip); + } + } + + //add small strips to face list + NvStripInfoVec tempStrips2; + RemoveSmallStrips(tempStrips, tempStrips2, outFaceList); + + outStrips.clear(); + //screw optimization for now +// for(i = 0; i < tempStrips.size(); ++i) +// outStrips.push_back(tempStrips[i]); + + if(tempStrips2.size() != 0) + { + //Optimize for the vertex cache + VertexCache* vcache = new VertexCache(cacheSize); + + float bestNumHits = -1.0f; + float numHits; + int bestIndex; + bool done = false; + + int firstIndex = 0; + float minCost = 10000.0f; + + for(i = 0; i < tempStrips2.size(); i++) + { + int numNeighbors = 0; + + //find strip with least number of neighbors per face + for(int j = 0; j < tempStrips2[i]->m_faces.size(); j++) + { + numNeighbors += NumNeighbors(tempStrips2[i]->m_faces[j], edgeInfos); + } + + float currCost = (float)numNeighbors / (float)tempStrips2[i]->m_faces.size(); + if(currCost < minCost) + { + minCost = currCost; + firstIndex = i; + } + } + + UpdateCacheStrip(vcache, tempStrips2[firstIndex]); + outStrips.push_back(tempStrips2[firstIndex]); + + tempStrips2[firstIndex]->visited = true; + + bool bWantsCW = (tempStrips2[firstIndex]->m_faces.size() % 2) == 0; + + //this n^2 algo is what slows down stripification so much.... + // needs to be improved + while(1) + { + bestNumHits = -1.0f; + + //find best strip to add next, given the current cache + for(int i = 0; i < tempStrips2.size(); i++) + { + if(tempStrips2[i]->visited) + continue; + + numHits = CalcNumHitsStrip(vcache, tempStrips2[i]); + if(numHits > bestNumHits) + { + bestNumHits = numHits; + bestIndex = i; + } + else if(numHits >= bestNumHits) + { + //check previous strip to see if this one requires it to switch polarity + NvStripInfo *strip = tempStrips2[i]; + int nStripFaceCount = strip->m_faces.size(); + + NvFaceInfo tFirstFace(strip->m_faces[0]->m_v0, strip->m_faces[0]->m_v1, strip->m_faces[0]->m_v2); + + // If there is a second face, reorder vertices such that the + // unique vertex is first + if (nStripFaceCount > 1) + { + int nUnique = NvStripifier::GetUniqueVertexInB(strip->m_faces[1], &tFirstFace); + if (nUnique == tFirstFace.m_v1) + { + SWAP(tFirstFace.m_v0, tFirstFace.m_v1); + } + else if (nUnique == tFirstFace.m_v2) + { + SWAP(tFirstFace.m_v0, tFirstFace.m_v2); + } + + // If there is a third face, reorder vertices such that the + // shared vertex is last + if (nStripFaceCount > 2) + { + int nShared0, nShared1; + GetSharedVertices(strip->m_faces[2], &tFirstFace, &nShared0, &nShared1); + if ( (nShared0 == tFirstFace.m_v1) && (nShared1 == -1) ) + { + SWAP(tFirstFace.m_v1, tFirstFace.m_v2); + } + } + } + + // Check CW/CCW ordering + if (bWantsCW == IsCW(strip->m_faces[0], tFirstFace.m_v0, tFirstFace.m_v1)) + { + //I like this one! + bestIndex = i; + } + } + } + + if(bestNumHits == -1.0f) + break; + tempStrips2[bestIndex]->visited = true; + UpdateCacheStrip(vcache, tempStrips2[bestIndex]); + outStrips.push_back(tempStrips2[bestIndex]); + bWantsCW = (tempStrips2[bestIndex]->m_faces.size() % 2 == 0) ? bWantsCW : !bWantsCW; + } + + delete vcache; + } +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// UpdateCacheStrip() +// +// Updates the input vertex cache with this strip's vertices +// +void NvStripifier::UpdateCacheStrip(VertexCache* vcache, NvStripInfo* strip) +{ + for(int i = 0; i < strip->m_faces.size(); ++i) + { + if(!vcache->InCache(strip->m_faces[i]->m_v0)) + vcache->AddEntry(strip->m_faces[i]->m_v0); + + if(!vcache->InCache(strip->m_faces[i]->m_v1)) + vcache->AddEntry(strip->m_faces[i]->m_v1); + + if(!vcache->InCache(strip->m_faces[i]->m_v2)) + vcache->AddEntry(strip->m_faces[i]->m_v2); + } +} + +/////////////////////////////////////////////////////////////////////////////////////////// +// UpdateCacheFace() +// +// Updates the input vertex cache with this face's vertices +// +void NvStripifier::UpdateCacheFace(VertexCache* vcache, NvFaceInfo* face) +{ + if(!vcache->InCache(face->m_v0)) + vcache->AddEntry(face->m_v0); + + if(!vcache->InCache(face->m_v1)) + vcache->AddEntry(face->m_v1); + + if(!vcache->InCache(face->m_v2)) + vcache->AddEntry(face->m_v2); +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// CalcNumHitsStrip() +// +// returns the number of cache hits per face in the strip +// +float NvStripifier::CalcNumHitsStrip(VertexCache* vcache, NvStripInfo* strip) +{ + int numHits = 0; + int numFaces = 0; + + for(int i = 0; i < strip->m_faces.size(); i++) + { + if(vcache->InCache(strip->m_faces[i]->m_v0)) + ++numHits; + + if(vcache->InCache(strip->m_faces[i]->m_v1)) + ++numHits; + + if(vcache->InCache(strip->m_faces[i]->m_v2)) + ++numHits; + + numFaces++; + } + + return ((float)numHits / (float)numFaces); +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// CalcNumHitsFace() +// +// returns the number of cache hits in the face +// +int NvStripifier::CalcNumHitsFace(VertexCache* vcache, NvFaceInfo* face) +{ + int numHits = 0; + + if(vcache->InCache(face->m_v0)) + numHits++; + + if(vcache->InCache(face->m_v1)) + numHits++; + + if(vcache->InCache(face->m_v2)) + numHits++; + + return numHits; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// NumNeighbors() +// +// Returns the number of neighbors that this face has +// +int NvStripifier::NumNeighbors(NvFaceInfo* face, NvEdgeInfoVec& edgeInfoVec) +{ + int numNeighbors = 0; + + if(FindOtherFace(edgeInfoVec, face->m_v0, face->m_v1, face) != NULL) + { + numNeighbors++; + } + + if(FindOtherFace(edgeInfoVec, face->m_v1, face->m_v2, face) != NULL) + { + numNeighbors++; + } + + if(FindOtherFace(edgeInfoVec, face->m_v2, face->m_v0, face) != NULL) + { + numNeighbors++; + } + + return numNeighbors; +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// AvgStripSize() +// +// Finds the average strip size of the input vector of strips +// +float NvStripifier::AvgStripSize(const NvStripInfoVec &strips){ + int sizeAccum = 0; + int numStrips = strips.size(); + for (int i = 0; i < numStrips; i++){ + NvStripInfo *strip = strips[i]; + sizeAccum += strip->m_faces.size(); + sizeAccum -= strip->m_numDegenerates; + } + return ((float)sizeAccum) / ((float)numStrips); +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// FindAllStrips() +// +// Does the stripification, puts output strips into vector allStrips +// +// Works by setting runnning a number of experiments in different areas of the mesh, and +// accepting the one which results in the longest strips. It then accepts this, and moves +// on to a different area of the mesh. We try to jump around the mesh some, to ensure that +// large open spans of strips get generated. +// +void NvStripifier::FindAllStrips(NvStripInfoVec &allStrips, + NvFaceInfoVec &allFaceInfos, + NvEdgeInfoVec &allEdgeInfos, + int numSamples){ + // the experiments + int experimentId = 0; + int stripId = 0; + bool done = false; + + int loopCtr = 0; + + while (!done) + { + loopCtr++; + + // + // PHASE 1: Set up numSamples * numEdges experiments + // + int i; + NvStripInfoVec *experiments = new NvStripInfoVec [numSamples * 6]; + int experimentIndex = 0; + std::set resetPoints; + for (i = 0; i < numSamples; i++) + { + + // Try to find another good reset point. + // If there are none to be found, we are done + NvFaceInfo *nextFace = FindGoodResetPoint(allFaceInfos, allEdgeInfos); + if (nextFace == NULL){ + done = true; + break; + } + // If we have already evaluated starting at this face in this slew + // of experiments, then skip going any further + else if (resetPoints.find(nextFace) != resetPoints.end()){ + continue; + } + + // trying it now... + resetPoints.insert(nextFace); + + // otherwise, we shall now try experiments for starting on the 01,12, and 20 edges + assert(nextFace->m_stripId < 0); + + // build the strip off of this face's 0-1 edge + NvEdgeInfo *edge01 = FindEdgeInfo(allEdgeInfos, nextFace->m_v0, nextFace->m_v1); + NvStripInfo *strip01 = new NvStripInfo(NvStripStartInfo(nextFace, edge01, true), stripId++, experimentId++); + experiments[experimentIndex++].push_back(strip01); + + // build the strip off of this face's 1-0 edge + NvEdgeInfo *edge10 = FindEdgeInfo(allEdgeInfos, nextFace->m_v0, nextFace->m_v1); + NvStripInfo *strip10 = new NvStripInfo(NvStripStartInfo(nextFace, edge10, false), stripId++, experimentId++); + experiments[experimentIndex++].push_back(strip10); + + // build the strip off of this face's 1-2 edge + NvEdgeInfo *edge12 = FindEdgeInfo(allEdgeInfos, nextFace->m_v1, nextFace->m_v2); + NvStripInfo *strip12 = new NvStripInfo(NvStripStartInfo(nextFace, edge12, true), stripId++, experimentId++); + experiments[experimentIndex++].push_back(strip12); + + // build the strip off of this face's 2-1 edge + NvEdgeInfo *edge21 = FindEdgeInfo(allEdgeInfos, nextFace->m_v1, nextFace->m_v2); + NvStripInfo *strip21 = new NvStripInfo(NvStripStartInfo(nextFace, edge21, false), stripId++, experimentId++); + experiments[experimentIndex++].push_back(strip21); + + // build the strip off of this face's 2-0 edge + NvEdgeInfo *edge20 = FindEdgeInfo(allEdgeInfos, nextFace->m_v2, nextFace->m_v0); + NvStripInfo *strip20 = new NvStripInfo(NvStripStartInfo(nextFace, edge20, true), stripId++, experimentId++); + experiments[experimentIndex++].push_back(strip20); + + // build the strip off of this face's 0-2 edge + NvEdgeInfo *edge02 = FindEdgeInfo(allEdgeInfos, nextFace->m_v2, nextFace->m_v0); + NvStripInfo *strip02 = new NvStripInfo(NvStripStartInfo(nextFace, edge02, false), stripId++, experimentId++); + experiments[experimentIndex++].push_back(strip02); + } + + // + // PHASE 2: Iterate through that we setup in the last phase + // and really build each of the strips and strips that follow to see how + // far we get + // + int numExperiments = experimentIndex; + for (i = 0; i < numExperiments; i++){ + + // get the strip set + + // build the first strip of the list + experiments[i][0]->Build(allEdgeInfos, allFaceInfos); + int experimentId = experiments[i][0]->m_experimentId; + + NvStripInfo *stripIter = experiments[i][0]; + NvStripStartInfo startInfo(NULL, NULL, false); + while (FindTraversal(allFaceInfos, allEdgeInfos, stripIter, startInfo)){ + + // create the new strip info + stripIter = new NvStripInfo(startInfo, stripId++, experimentId); + + // build the next strip + stripIter->Build(allEdgeInfos, allFaceInfos); + + // add it to the list + experiments[i].push_back(stripIter); + } + } + + // + // Phase 3: Find the experiment that has the most promise + // + int bestIndex = 0; + double bestValue = 0; + for (i = 0; i < numExperiments; i++) + { + const float avgStripSizeWeight = 1.0f; + const float numTrisWeight = 0.0f; + const float numStripsWeight = 0.0f; + float avgStripSize = AvgStripSize(experiments[i]); + float numStrips = (float) experiments[i].size(); + float value = avgStripSize * avgStripSizeWeight + (numStrips * numStripsWeight); + //float value = 1.f / numStrips; + //float value = numStrips * avgStripSize; + + if (value > bestValue) + { + bestValue = value; + bestIndex = i; + } + } + + // + // Phase 4: commit the best experiment of the bunch + // + CommitStrips(allStrips, experiments[bestIndex]); + + // and destroy all of the others + for (i = 0; i < numExperiments; i++) + { + if (i != bestIndex) + { + int numStrips = experiments[i].size(); + for (int j = 0; j < numStrips; j++) + { + NvStripInfo* currStrip = experiments[i][j]; + //delete all bogus faces in the experiments + for (int k = 0; k < currStrip->m_faces.size(); ++k) + { + if(currStrip->m_faces[k]->m_bIsFake) + { + delete currStrip->m_faces[k], currStrip->m_faces[k] = NULL; + } + } + delete currStrip, currStrip = NULL, experiments[i][j] = NULL; + } + } + } + + // delete the array that we used for all experiments + delete [] experiments; + } +} + + +/////////////////////////////////////////////////////////////////////////////////////////// +// CountRemainingTris() +// +// This will count the number of triangles left in the +// strip list starting at iter and finishing up at end +// +int NvStripifier::CountRemainingTris(std::list::iterator iter, + std::list::iterator end){ + int count = 0; + while (iter != end){ + count += (*iter)->m_faces.size(); + iter++; + } + return count; +} + diff --git a/DSMeshConvert/NvTriStrip/NvTriStripObjects.h b/DSMeshConvert/NvTriStrip/NvTriStripObjects.h new file mode 100644 index 0000000..861b3b3 --- /dev/null +++ b/DSMeshConvert/NvTriStrip/NvTriStripObjects.h @@ -0,0 +1,244 @@ + +#ifndef NV_TRISTRIP_OBJECTS_H +#define NV_TRISTRIP_OBJECTS_H + +#include +#include +#include +#include +#include "VertexCache.h" + +///////////////////////////////////////////////////////////////////////////////// +// +// Types defined for stripification +// +///////////////////////////////////////////////////////////////////////////////// + +struct MyVertex { + float x, y, z; + float nx, ny, nz; +}; + +typedef MyVertex MyVector; + +struct MyFace { + int v1, v2, v3; + float nx, ny, nz; +}; + + +class NvFaceInfo { +public: + + // vertex indices + NvFaceInfo(int v0, int v1, int v2, bool bIsFake = false){ + m_v0 = v0; m_v1 = v1; m_v2 = v2; + m_stripId = -1; + m_testStripId = -1; + m_experimentId = -1; + m_bIsFake = bIsFake; + } + + // data members are left public + int m_v0, m_v1, m_v2; + int m_stripId; // real strip Id + int m_testStripId; // strip Id in an experiment + int m_experimentId; // in what experiment was it given an experiment Id? + bool m_bIsFake; //if true, will be deleted when the strip it's in is deleted +}; + +// nice and dumb edge class that points knows its +// indices, the two faces, and the next edge using +// the lesser of the indices +class NvEdgeInfo { +public: + + // constructor puts 1 ref on us + NvEdgeInfo (int v0, int v1){ + m_v0 = v0; + m_v1 = v1; + m_face0 = NULL; + m_face1 = NULL; + m_nextV0 = NULL; + m_nextV1 = NULL; + + // we will appear in 2 lists. this is a good + // way to make sure we delete it the second time + // we hit it in the edge infos + m_refCount = 2; + + } + + // ref and unref + void Unref () { if (--m_refCount == 0) delete this; } + + // data members are left public + UINT m_refCount; + NvFaceInfo *m_face0, *m_face1; + int m_v0, m_v1; + NvEdgeInfo *m_nextV0, *m_nextV1; +}; + + +// This class is a quick summary of parameters used +// to begin a triangle strip. Some operations may +// want to create lists of such items, so they were +// pulled out into a class +class NvStripStartInfo { +public: + NvStripStartInfo(NvFaceInfo *startFace, NvEdgeInfo *startEdge, bool toV1){ + m_startFace = startFace; + m_startEdge = startEdge; + m_toV1 = toV1; + } + NvFaceInfo *m_startFace; + NvEdgeInfo *m_startEdge; + bool m_toV1; +}; + + +typedef std::vector NvFaceInfoVec; +typedef std::list NvFaceInfoList; +typedef std::list NvStripList; +typedef std::vector NvEdgeInfoVec; + +typedef std::vector WordVec; +typedef std::vector IntVec; +typedef std::vector MyVertexVec; +typedef std::vector MyFaceVec; + +template +inline void SWAP(T& first, T& second) +{ + T temp = first; + first = second; + second = temp; +} + +// This is a summary of a strip that has been built +class NvStripInfo { +public: + + // A little information about the creation of the triangle strips + NvStripInfo(const NvStripStartInfo &startInfo, int stripId, int experimentId = -1) : + m_startInfo(startInfo) + { + m_stripId = stripId; + m_experimentId = experimentId; + visited = false; + m_numDegenerates = 0; + } + + // This is an experiment if the experiment id is >= 0 + inline bool IsExperiment () const { return m_experimentId >= 0; } + + inline bool IsInStrip (const NvFaceInfo *faceInfo) const + { + if(faceInfo == NULL) + return false; + + return (m_experimentId >= 0 ? faceInfo->m_testStripId == m_stripId : faceInfo->m_stripId == m_stripId); + } + + bool SharesEdge(const NvFaceInfo* faceInfo, NvEdgeInfoVec &edgeInfos); + + // take the given forward and backward strips and combine them together + void Combine(const NvFaceInfoVec &forward, const NvFaceInfoVec &backward); + + //returns true if the face is "unique", i.e. has a vertex which doesn't exist in the faceVec + bool Unique(NvFaceInfoVec& faceVec, NvFaceInfo* face); + + // mark the triangle as taken by this strip + bool IsMarked (NvFaceInfo *faceInfo); + void MarkTriangle(NvFaceInfo *faceInfo); + + // build the strip + void Build(NvEdgeInfoVec &edgeInfos, NvFaceInfoVec &faceInfos); + + // public data members + NvStripStartInfo m_startInfo; + NvFaceInfoVec m_faces; + int m_stripId; + int m_experimentId; + + bool visited; + + int m_numDegenerates; +}; + +typedef std::vector NvStripInfoVec; + + +//The actual stripifier +class NvStripifier { +public: + + // Constructor + NvStripifier(); + ~NvStripifier(); + + //the target vertex cache size, the structure to place the strips in, and the input indices + void Stripify(const WordVec &in_indices, const int in_cacheSize, const int in_minStripLength, + const unsigned short maxIndex, NvStripInfoVec &allStrips, NvFaceInfoVec &allFaces); + void CreateStrips(const NvStripInfoVec& allStrips, IntVec& stripIndices, const bool bStitchStrips, unsigned int& numSeparateStrips, const bool bRestart, const unsigned int restartVal); + + static int GetUniqueVertexInB(NvFaceInfo *faceA, NvFaceInfo *faceB); + //static int GetSharedVertex(NvFaceInfo *faceA, NvFaceInfo *faceB); + static void GetSharedVertices(NvFaceInfo *faceA, NvFaceInfo *faceB, int* vertex0, int* vertex1); + + static bool IsDegenerate(const NvFaceInfo* face); + static bool IsDegenerate(const unsigned short v0, const unsigned short v1, const unsigned short v2); + +protected: + + WordVec indices; + int cacheSize; + int minStripLength; + float meshJump; + bool bFirstTimeResetPoint; + + ///////////////////////////////////////////////////////////////////////////////// + // + // Big mess of functions called during stripification + // + ///////////////////////////////////////////////////////////////////////////////// + + //******************** + bool IsMoneyFace(const NvFaceInfo& face); + bool FaceContainsIndex(const NvFaceInfo& face, const unsigned int index); + + bool IsCW(NvFaceInfo *faceInfo, int v0, int v1); + bool NextIsCW(const int numIndices); + + static int GetNextIndex(const WordVec &indices, NvFaceInfo *face); + static NvEdgeInfo *FindEdgeInfo(NvEdgeInfoVec &edgeInfos, int v0, int v1); + static NvFaceInfo *FindOtherFace(NvEdgeInfoVec &edgeInfos, int v0, int v1, NvFaceInfo *faceInfo); + NvFaceInfo *FindGoodResetPoint(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos); + + void FindAllStrips(NvStripInfoVec &allStrips, NvFaceInfoVec &allFaceInfos, NvEdgeInfoVec &allEdgeInfos, int numSamples); + void SplitUpStripsAndOptimize(NvStripInfoVec &allStrips, NvStripInfoVec &outStrips, NvEdgeInfoVec& edgeInfos, NvFaceInfoVec& outFaceList); + void RemoveSmallStrips(NvStripInfoVec& allStrips, NvStripInfoVec& allBigStrips, NvFaceInfoVec& faceList); + + bool FindTraversal(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos, NvStripInfo *strip, NvStripStartInfo &startInfo); + int CountRemainingTris(std::list::iterator iter, std::list::iterator end); + + void CommitStrips(NvStripInfoVec &allStrips, const NvStripInfoVec &strips); + + float AvgStripSize(const NvStripInfoVec &strips); + int FindStartPoint(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos); + + void UpdateCacheStrip(VertexCache* vcache, NvStripInfo* strip); + void UpdateCacheFace(VertexCache* vcache, NvFaceInfo* face); + float CalcNumHitsStrip(VertexCache* vcache, NvStripInfo* strip); + int CalcNumHitsFace(VertexCache* vcache, NvFaceInfo* face); + int NumNeighbors(NvFaceInfo* face, NvEdgeInfoVec& edgeInfoVec); + + void BuildStripifyInfo(NvFaceInfoVec &faceInfos, NvEdgeInfoVec &edgeInfos, const unsigned short maxIndex); + bool AlreadyExists(NvFaceInfo* faceInfo, NvFaceInfoVec& faceInfos); + + // let our strip info classes and the other classes get + // to these protected stripificaton methods if they want + friend NvStripInfo; +}; + +#endif diff --git a/DSMeshConvert/NvTriStrip/README.txt b/DSMeshConvert/NvTriStrip/README.txt new file mode 100644 index 0000000..c88ea27 --- /dev/null +++ b/DSMeshConvert/NvTriStrip/README.txt @@ -0,0 +1,32 @@ +README for NvTriStrip, library version +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To use: +-#include "NvTriStrip.h" +-put nvtristrip.lib in your library path (the pragma in nvtristrip.h will automatically look for the library). + +Check out NvTriStrip.h for the interface. + +See the StripTest source code (in function LoadXFileStripped) for an example of using the library. + +Features: +-generates strips from arbitrary geometry. +-flexibly optimizes for post TnL vertex caches (16 on GeForce1/2, 24 on GeForce3). +-can stitch together strips using degenerate triangles, or not. +-can output lists instead of strips. +-can optionally throw excessively small strips into a list instead. +-can remap indices to improve spatial locality in your vertex buffers. + +On cache sizes: +Note that it's better to UNDERESTIMATE the cache size instead of OVERESTIMATING. +So, if you're targetting GeForce1, 2, and 3, be conservative and use the GeForce1_2 cache +size, NOT the GeForce3 cache size. +This will make sure you don't "blow" the cache of the GeForce1 and 2. +Also note that the cache size you specify is the "actual" cache size, not the "effective" +cache size you may have heard about. This is 16 for GeForce1 and 2, and 24 for GeForce3. + +Credit goes to Curtis Beeson and Joe Demers for the basis for this stripifier and to Jason Regier and +Jon Stone at Blizzard for providing a much cleaner version of CreateStrips(). + +Questions/comments email cem@nvidia.com + diff --git a/DSMeshConvert/NvTriStrip/VertexCache.cpp b/DSMeshConvert/NvTriStrip/VertexCache.cpp new file mode 100644 index 0000000..56899b6 --- /dev/null +++ b/DSMeshConvert/NvTriStrip/VertexCache.cpp @@ -0,0 +1,88 @@ + + +#include "VertexCache.h" + +VertexCache::VertexCache() +{ + VertexCache(16); +} + + +VertexCache::VertexCache(int size) +{ + numEntries = size; + + entries = new unsigned short[numEntries]; + + for(int i = 0; i < numEntries; i++) + entries[i] = -1; +} + + +VertexCache::~VertexCache() +{ + delete[] entries; +} + + +int VertexCache::At(int index) +{ + return entries[index]; +} + + +void VertexCache::Set(int index, int value) +{ + entries[index] = value; +} + + +void VertexCache::Clear() +{ + for(int i = 0; i < numEntries; i++) + entries[i] = -1; +} + +void VertexCache::Copy(VertexCache* inVcache) +{ + for(int i = 0; i < numEntries; i++) + { + inVcache->Set(i, entries[i]); + } +} + +bool VertexCache::InCache(int entry) +{ + bool returnVal = false; + + for(int i = 0; i < numEntries; i++) + { + if(entries[i] == entry) + { + returnVal = true; + break; + } + } + + return returnVal; +} + + +int VertexCache::AddEntry(int entry) +{ + int removed; + + removed = entries[numEntries - 1]; + + //push everything right one + for(int i = numEntries - 2; i >= 0; i--) + { + entries[i + 1] = entries[i]; + } + + entries[0] = entry; + + return removed; +} + + \ No newline at end of file diff --git a/DSMeshConvert/NvTriStrip/VertexCache.h b/DSMeshConvert/NvTriStrip/VertexCache.h new file mode 100644 index 0000000..469e80b --- /dev/null +++ b/DSMeshConvert/NvTriStrip/VertexCache.h @@ -0,0 +1,81 @@ + +#ifndef VERTEX_CACHE_H + +#define VERTEX_CACHE_H + +#include + +class VertexCache +{ + +public: + + VertexCache(int size) + { + numEntries = size; + + entries = new int[numEntries]; + + for(int i = 0; i < numEntries; i++) + entries[i] = -1; + } + + VertexCache() { VertexCache(16); } + ~VertexCache() { delete[] entries; entries = 0; } + + bool InCache(int entry) + { + bool returnVal = false; + for(int i = 0; i < numEntries; i++) + { + if(entries[i] == entry) + { + returnVal = true; + break; + } + } + + return returnVal; + } + + int AddEntry(int entry) + { + int removed; + + removed = entries[numEntries - 1]; + + //push everything right one + for(int i = numEntries - 2; i >= 0; i--) + { + entries[i + 1] = entries[i]; + } + + entries[0] = entry; + + return removed; + } + + void Clear() + { + memset(entries, -1, sizeof(int) * numEntries); + } + + void Copy(VertexCache* inVcache) + { + for(int i = 0; i < numEntries; i++) + { + inVcache->Set(i, entries[i]); + } + } + + int At(int index) { return entries[index]; } + void Set(int index, int value) { entries[index] = value; } + +private: + + int *entries; + int numEntries; + +}; + +#endif diff --git a/DSMeshConvert/NvTriStripd.lib b/DSMeshConvert/NvTriStripd.lib new file mode 100644 index 0000000..3334bf0 Binary files /dev/null and b/DSMeshConvert/NvTriStripd.lib differ diff --git a/DSMeshConvert/ac/COPYRIGHT b/DSMeshConvert/ac/COPYRIGHT new file mode 100644 index 0000000..93eef4a --- /dev/null +++ b/DSMeshConvert/ac/COPYRIGHT @@ -0,0 +1,25 @@ +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + This product includes software developed by Brad Grantham and + Applied Conjecture. + 4. Neither the name Brad Grantham nor Applied Conjecture + may be used to endorse or promote products derived from this software + without specific prior written permission. + 5. Notification must be made to Brad Grantham about inclusion of this + software in a product including the author of the product and the name + and purpose of the product. Notification can be made using email + to Brad Grantham's current address (grantham@plunk.org as of September + 20th, 2000) or current U.S. mail address. + +$Header: /home/grantham/cvsroot/projects/modules/tc/COPYRIGHT,v 1.1 2000/09/21 19:36:56 grantham Exp $ + +# vi:tabstop=8 +# diff --git a/DSMeshConvert/ac/README b/DSMeshConvert/ac/README new file mode 100644 index 0000000..40da713 --- /dev/null +++ b/DSMeshConvert/ac/README @@ -0,0 +1,31 @@ +ACTC 1.1 - Brad's Triangle Consolidator + +ACTC converts independent triangles into triangle strips or fans. You +can approach a three times geometry speedup on OpenGL and Direct3D +using triangle strips and fans. If the speed of your application is +limited by how fast your graphics card can paint pixels (and not +transform vertices) then this speedup won't help your frame rate, but +it may free up CPU cycles for more work in your program, which can in +turn do a better job of telling the card what to draw. You'll find +a more detailed introduction to using ACTC in "manual.html". + +ACTC does *not* turn unindexed triangle data into indexed triangle data. +In other words, it will not turn find duplicate vertices in raw 3D vertex +data. (I'm hoping to write a layer on ACTC for that.) + +I am not aware of any bugs but I haven't tested the module very +thoroughly against real-life data. If you find bugs, please visit the +ACTC page on SourceForge at ... and submit a descriptive bug report +including the offending data file, and ACTC's version number. + +You can find the most recent release of ACTC by navigating my home page +at http://www.plunk.org/~grantham/. + +A quick note about clause #5 in the COPYRIGHT. All I really want is +to feel some amount of satisfaction that you're using something on +which I worked hard. An email saying something like "Hey, I'm Joe +Shmoe, and I'm using your code in my widget counter for Orchard Supply +Hardware" is sufficient. + + -Brad Grantham + November 23rd, 2000 diff --git a/DSMeshConvert/ac/manual.html b/DSMeshConvert/ac/manual.html new file mode 100644 index 0000000..ee5bd64 --- /dev/null +++ b/DSMeshConvert/ac/manual.html @@ -0,0 +1,578 @@ + + + +Triangle Consolidator 1.1 +

Triangle Consolidator 1.1

+ +

Introduction

+ +I imagine most people would only have come looking for TC if they +knew what they wanted in the first place. The programmers' guide +that you probably want is in the next section. The following is +just a little purpose and history.

+ +TC, or "triangle consolidator", constructs triangle strips or triangle +fans from independent triangle data. The geometric transformation of +3D points onto a 2D screen involves some heavy math, and you can realize +a performance benefit by reusing the results of that math where possible. +Each new triangle strip or fan is constructed from one of the edges of +the previous triangle and a new vertex.

+ +

+ +You can achieve 3x performance minus the cost of +transforming the first two vertices per strip. Thus it's important +that strips and fans are made as long as possible (fewer strips and +fans). Some architectures have a +maximum preferred strip length, after which the engine may stall.

+ +I wrote meshifier in 1995 because Sharon Clay at Silicon Graphics +asked me how I might construct strips from a lattice of triangles +as an interview question. It has some fundamental architectural +limitations. Some, like an error in the reset code and being able +to specify that triangles should not be output in reverse order, +have been fixed by Neal Tringham and are incorporated in the new version +available from his web page. Others, such as the limitation on numbers +of vertices and connectivity, are harder to repair.

+ +In "TC" I've attempted to fix those old errors. +TC attempts to consolidate triangles limited only by the +limits of the machine' available memory and +speed. I have changed the API, using OpenGL as a loose model +(although OpenGL arguably has its shape because it provides a hardware +abstraction layer), so that more algorithmic abstractions and +optimizations are possible. I have tried to build in features which +are useful to modelers and offline optimization tools, such as whether +or not to honor vertex ordering. I have also spent a few days +trying to test the code nominally and attempt to have some confidence +that even its low-memory behavior is predictable.

+ +I hope you find it useful. ---Brad +Grantham

+ +


+ +

Triangle Consolidator API

+ +TC is meant to be used in an offline modeling process. It is probably +too slow to be used to optimize data per frame for the purpose of +interactive display. It also does not provide any facility (yet) for +merging spacial coordinates together to form an indexed vertex list. TC only +operates on the indices of indexed triangles. Maintaining the actual +vertex array (containing the traditional v3f, n3f, etc) is up to the +application. I perceive this is useful, however, in that TC needs no +knowledge of how vertex data is stored; it only needs to know +connectivity information. An application program creates an ACTCData +structure and then repeats a cycle of optionally setting flags, +inputting triangles, and then receiving the output primitives.

+ +

Language and Namespace

+ +TC 1.1 is provided with a C language interface. Mostly this is +because many people (including me) still prefer to program in C and I +don't want to force people to write C++. TC is also implemented in +C, but I don't think this is that important, since you could implement +the library internals in C++ and still export a C API.

+ +The namespace of all functions and identifiers in TC is protected using +the initials of my software organization Applied Conjecture and +TC. All functions in TC are prefixed with actc. +All symbolic constants and #defines are prefixed with +ACTC_. All exported data structures are prefixed with +ACTC.

+ +

Initialization and Errors

+ +An ACTCData consolidator object is created using the +following code. This structure contains state data about optional +parameters and triangle connectivity. actcNew returns +either an initialized ACTCData object if successful or +NULL if memory cannot be allocated.

+ + +

+    #include <ac/tc.h>
+
+    ACTCData *tc;
+
+    tc = actcNew();
+    if(tc == NULL) {
+	/* memory allocation failed */
+	/* print error here and exit or whatever */
+    }
+
+ +Any errors encountered during execution are typically both returned as +results from a TC function and stored in the structure. The error +can be retrieved using actcGetError. Here is an example of adding a +triangle and checking the error.

+ +

+    actcAddTriangle(tc, v1, v2, v3);
+    if((e = actcGetError(tc)) != ACTC_NO_ERROR) {
+	/* something bad happened */
+	/* print error and exit or whatever */
+    }
+
+ +A more compact representation may not use actcGetError at +all, since many functions return either the error or +ACTC_NO_ERROR.

+ +

+    if((e = actcAddTriangle(tc, v1, v2, v3)) != ACTC_NO_ERROR) {
+	/* something bad happened */
+	/* print error and exit or whatever */
+    }
+
+ +Since the error is reset in the structure by +actcGetError, it makes sense to go with either one style or +the other, to avoid being confused when a later return from +actcGetError returns an error which has already been +handled. Errors are represented by negative integers, so some +functions may return non-error information as a positive integer. +Slightly smarter applications may try +to detect some failure conditions and proceed after some kind of +repair.

+ +

+    actcAddTriangle(tc, v1, v2, v3);
+    e = actcGetError(tc);
+    if(e == ACTC_ALLOC_FAILED) {
+	/* couldn't alloc memory using one of the malloc(3) family */
+	/* application can free unused memory and try again */
+    } else if(e != ACTC_NO_ERROR) {
+	/* something bad happened other than malloc failure */
+	/* print error and exit or whatever */
+    }
+
+ +For simplicity, examples in the remainder of the programmers' guide will not +check for errors but will mention where errors may occur. Several +functions can result in the error ACTC_DATABASE_CORRUPT but are not +noted here; that particular error return indicates corruption of +ACTC's internal data structures and really requires debugging (as +described below).

+ +

Parameters

+ +There are several options that may be set in the TC structure. For +example, whether TC honors triangle vertex ordering is controlled by +the ACTC_OUT_HONOR_WINDING symbolic constant. These values are set +by actcParami and retrieved by actcGetParami.

+ +

+    int isHonoringWinding;
+
+    actcParami(tc, ACTC_OUT_HONOR_WINDING, ACTC_TRUE);
+    actcGetParami(tc, ACTC_OUT_HONOR_WINDING, &isHonoringWinding);
+
+ +actcGetParami accepts two additional symbolic +constants which may +not be set by the application. ACTC_MAJOR_VERSION and +ACTC_MINOR_VERSION return the major version number and +minor version number, respectively.

+ +Parameters are differentiated by the direction of the data they +control. OUT parameters control how TC hands its +consolidated primitives back to you. IN parameters tell +TC the limits you intend to guarantee on your input data, which may +used for optimization purposes. ALG parameters directly +affect the internal algorithms used by TC. Some parameters require +the extended range of unsigned int, and they can be set +and queried by actcParamu and actcGetParamu, +but both sets of Param... functions take the same symbolic +constants and convert to-and-from the range of their parameter or +return variable. Here are the parameters available in TC 1.1:

+ + + + + + + + + + +
EnumerantData typeMeaningPrefer Paramu
ACTC_OUT_MIN_FAN_VERTSintegerMinimum number of vertices +returnable in a triangle fanNo
ACTC_OUT_HONOR_WINDINGbooleanWhether triangles may be output in reverse vertex orderNo
ACTC_OUT_MAX_PRIM_VERTSintegerMaximum number of vertices to output in a primitiveNo
ACTC_IN_MIN_VERTintegerMinimum vertex indexYes
ACTC_IN_MAX_VERTintegerMaximum vertex indexYes
ACTC_IN_MAX_VERT_SHARINGintegerMaximum number of edges that will share a vertexNo
ACTC_IN_MAX_EDGE_SHARINGintegerMaximum number of triangles that will share an edgeNo

+ +If called during INPUT or OUTPUT, +actcParami can result in ACTC_DURING_INPUT, +or ACTC_DURING_OUTPUT, respectively. If called to set +ACTC_IN_MIN_VERT or ACTC_IN_MAX_VERT so the +vertex range is negative, or to set +ACTC_OUT_MAX_PRIM_VERTS to less than 3, or to set a value +associated with a symbolic constant ACTC does not know about, then the +error ACTC_INVALID_VALUE will result.

+ +

Input/Output

+ +A TC structure is always in one of three modes; idle, inputting, or +outputting. Some operations are valid only in some modes. For example, +setting a parameter is an error unless the consolidator object is idle. +Triangle data may only be entered in input mode. Primitives may only +be fetched in output mode. Here's an example of how the modes work. +Please keep in mind that this example assumes a particular +primitive.

+ +

+    actcParami(tc, ACTC_OUT_MAX_PRIM_VERTS, 14);
+    actcBeginInput(tc);
+    actcAddTriangle(tc, 1, 2, 3);
+    actcEndInput(tc);
+    actcBeginOutput(tc);
+    prim = actcStartNextPrim(tc, &v1, &v2);
+    actcGetNextVert(tc, &v3);
+    actcEndOutput(tc);
+    
+    /* v1, v2, and v3 are now set to 1, 2, and 3. */
+
+ +actcEndInput and actcEndOutput are intended as +checkpoints for optimization, compaction, etc. Your application can +call actcGetIsDuringInput and +actcGetIsDuringOutput to determine if the TC object is +currently ready in the input or output stages (or is otherwise idle). +If actcParami is called during input or output, an error of +either ACTC_DURING_INPUT or ACTC_DURING_OUTPUT +results, respectively.

+ +

Giving Triangles as Input

+ +Each triangle is entered into the TC database using +actcAddTriangle, and the possible results may be +ACTC_DURING_OUTPUT if TC is in output mode, +ACTC_IDLE if TC is not in input mode, or +ACTC_ALLOC_FAILED if an internal data structure could not +be allocated. In the last case, the database is not altered. An +application could perform compaction on its own data and try +actcAddTriangle again, or it could attempt to retrieve all +the primitives currently available from the database. This would +probably give worse results (more primitives, fewer vertices per +primitive) than retrieving primitives from the complete database but +may be better than getting no primitives at all.

+ +

+     int triCount;
+     int tris[][3]; 
+
+     actcBeginInput(tc);
+     for(i = 0; i < triCount; i++)
+	 actcAddTriangle(tc, tris[i][0], tris[i][1], tris[i][2]);
+     actcEndInput(tc);
+
+ +

Ranges of Various Input Data

+ +Vertex indices can be any unsigned int, and so +anywhere from 0 to UINT_MAX, inclusive. Internal data +structures allow quantity INT_MAX vertices, edges, triangles, +vertex valences, and edge valences to be input. With the data +structures TC uses +as of version 1.1, on most machines at the time of writing, a process' +memory space will be exhausted before the range of any of these items +is exhausted. As of version 1.1, TC has not been tested on an +architecture with integers or pointers larger that 32 bits.

+ +

Getting the Output Primitives

+ +Strips and fans are retrieved one at a time from TC starting with +actcStartNextPrim. The primitive type is returned, either +ACTC_PRIM_STRIP or ACTC_PRIM_FAN. +actcStartNextPrim may also return +ACTC_DATABASE_EMPTY if all triangles input so far have been +returned in primitives. actcStartNextPrim stores the first +two vertices by reference, and +actcGetNextVert provides each subsequent vertex. +actcGetNextVert will return ACTC_PRIM_COMPLETE +when their are no more vertices to return. + +
+     int prim;
+     int v1, v2;
+
+     actcBeginOutput(tc);
+     while((prim = actcStartNextPrim(tc, &v1, &v2) != ACTC_DATABASE_EMPTY) {
+	 /* start a primitive of type "prim" with v1 and v2 */
+	 while(actcGetNextVert(tc, &v3) != ACTC_PRIM_COMPLETE)
+	     /* continue primitive using v3 */
+     }
+     actcEndOutput(tc);
+
+ +

One-Stop-Shopping (Convenience Function)

+ +There is a single function called +actcTrianglesToPrimitives which inputs triangles and +extracts primitives, including attempting to recover from low-memory +situations by first draining the primitive database, and then by +cleaning up unused memory if draining is not sufficient. Since TC +cannot know in advance how many primitives it can find (and thus how +many vertices), the application will have to provide primitive storage +large enough to hold the input data as independent triangles. The +application may also tell actcTrianglesToPrimitives how +many triangles to input to TC before draining the database. +The following example shows how an application might call +actcTrianglesToPrimitives; here the application has provided +INT_MAX as the maximum batch size in triangles, which +effectively means input all the triangles first before outputting.

+ + +

+    int triangleCount;
+    int triangles[][3];
+    int *primLengths;
+    int *primVerts;
+    int *primCount;
+
+    /* get triangleCount and triangles from somewhere */
+    primLengths = (int *)malloc(sizeof(int) * triangleCount);
+    primTypes = (int *)malloc(sizeof(int) * triangleCount);
+    primVerts = (int *)malloc(sizeof(int) * 3 * triangleCount);
+    primCount = actcTrianglesToPrimitives(tc, triangleCount, triangles,
+	primTypes, primLengths, primVerts, INT_MAX);
+    if(primCount < 0) {
+	/* something bad happened */
+	/* print error and exit or whatever */
+    }
+
+ +actcTrianglesToPrimitives calls +actc{Begin,End}{Input,Output}, actcAddTriangle, +actcGetNext{Prim,Vertex}, and actcMakeEmpty. +It returns any unrecoverable error it may receive from these functions, +or it will return the total number of strips and fans it finds. The types +and length in vertices of all primitives are stored in primTypes and +primLengths, and then the vertices for each primitive in turn are +stored sequentially in primVerts.

+ +

Memory Usage Statistics

+ +Call actcGetMemoryAllocation to make TC search how much +memory is being used in data structures. This may be an expensive +operation in TC 1.1 in that it searches the allocated data structures.

+ +

Dumping Internal State

+ +See below for information on compiled TC so that it automatically dumps +debugging +information on an internal error. If you believe you are getting +incorrect results from TC, your application can call +actcDumpState to print out the internal state of a TC +object (in no particular format). In order for me to help you debug a +problem, it would be useful to print out the TC version number, the +triangles you input to TC (in the order you input them), and the +output of actcDumpState at the beginning and end of your +output phase. actcDumpState has no return value.

+ +

Cleaning Up

+ +To stop input or output with TC and empty the database for a +particular TC object, use actcMakeEmpty; the TC object will +be reset to idle, contain no triangles, and will be ready for another +set of input triangles. actcMakeEmpty returns any error +that occurs during cleanup, but for the 1.1 release it can only return +ACTC_NO_ERROR.

+ +To free the memory associated with a TC object, call +actcDelete with the pointer to the object; this function +effectively calls actcMakeEmpty and then frees the TC +internal data. Further use of that TC object pointer will have +undefined results but will probably crash your application.

+ +


+

Specific Solutions

+ +

Producing Only Strips

+ +To produce only triangle strips, set +ACTC_OUT_MIN_FAN_VERTS to INT_MAX. Technically, a very +large triangle fan could still be formed, but when someone creates a +two billion vertex triangle fan with TC, I will consider it a success +rather than a failure.

+ +

+    actcParami(tc, ACTC_OUT_MIN_FAN_VERTS, INT_MAX);
+
+ +

Producing Limited-Length Primitives

+ +I have heard that Silicon Graphics' RealityEngine graphics and +derivatives have an optimium strip size of 12 vertices. Set +ACTC_OUT_MAX_PRIM_VERTS to set the maximum number of vertices to produce +per primitive.

+ +

+    actcParami(tc, ACTC_OUT_MAX_PRIM_VERTS, 12);
+
+ +

Ignoring Triangle Winding

+ +If your triangle set does not have a preferred triangle winding, +set ACTC_OUT_HONOR_WINDING to FALSE or 0. This has the effect of allowing +a triangle to be included in a primitive even if its vertices would +be drawn in reverse order. Note that every odd triangle in a strip +(counting from 0) will normally be wound backwards if winding is +honored.

+ +

+    actcParami(tc, ACTC_OUT_HONOR_WINDING, ACTC_TRUE);
+
+ +


+

TC SDK

+ +

Building TC

+ +My preference for using this module is to compile tc into a .a +library. The makefile provided by default has targets for the library and +the sample programs: + +
+    make libactc.a
+
+ +To turn on some simple debugging assistance, compile TC with the +DEBUG preprocessor symbol defined (-DDEBUG +for most UNIX compilers). Error conditions should print the reason +and the function in which the error occurred. Any function finding an +unexpected inconsistency in data structures (like performing a table +search and not finding an element which must be there) will call +abort() and presumably dump core. I wouldn't expect any +ordinary application developer to be able to debug TC from a core +file, of course. If INFO is also defined, then the +abort() call will be preceded by a dump of the internal +data structures in tc. If you would like me to debug TC based on your +input, it would help me to have this output as well as the set of +triangles originally input to TC.

+ +

Sample Programs and Tests

+ +The actctest program makes sure the basic TC functions +work. If it prints anything when compiled with actc.c without +DEBUG and INFO, then something bad +happened.

+ +The actctest2 program repeatedly inputs random data into TC +and makes sure it gets the same thing out as it received. You can +specify settings for any of the OUT parameters, and change the +seed that actctest2 uses to initialize the random number +generator.

+ +The actcsample program takes in a particular word-based format +containing +vertices and triangles, and converts that data into strips and fans. It +passes the vertex list through verbatim. Someone could +use this either as an element in a tool pipeline or as the basis for a +new offline or interactive stripping tool. Here's what the input format +looks like: +

+    [x y z nx ny nz r g b]
+    [x y z nx ny nz r g b]
+    [...]
+    end
+    triangle v1 v2 v3 end
+    [triangle v1 v2 v3 end]
+    [...]
+    end
+
+In this example, x, y, and z are the vertex coordinates, +nx, ny, and nz are the vertex normals, and +r, g, and b are the vertex colors. The set of +vertices are terminated by the word end. Vertices are +optional and are only passed straight through. For each triangle, v1, +v2, and v3 are the indices of each vertex in the triangle. +Each triangle is terminated by the word end, and the list +of triangles is terminated by end. The output format is +similar, except that the triangle section is replaced by a list +of primitives. Here's what the output format looks like: +
+    [x y z nx ny nz r g b]
+    [x y z nx ny nz r g b]
+    [...]
+    end
+    strip v1 v2 v3 [v4 [v5 [...]]] end
+    fan v1 v2 v3 [v4 [v5 [...]]] end
+    [...]
+    end
+
+Running + +

Portability

+ +TC should be pretty portable, for the most part. I placed my "timer" +snippet in actctest2, and it will need tweaking on anything +but Linux, IRIX, and Windows 98. If you'd like to submit a patch to +"timer" for another operating system, I will place it on my web page +and incorporate it into TC.

+ +


+

Miscellaneous

+ +

Reliability

+ +I've spent some time testing TC against some strange triangle sets. I've +gone so far as to create random triangle data (random numbers of +triangles with random ranges of vertices), put it in to TC, and check +to make sure the same triangles come out as went in. I've even gone +as far as to artificially reduce the amount of memory available to 8M, +under which TC seems to reliably consolidate triangles, but the data set +may degenerate under such conditions to being exactly the input data.

+ +

Runtime Performance

+ +TC 1.1 looks like it can consolidate somewhere around one hundred +thousand triangles per second on a 400 MHz Pentium III for data sets +in the thousands of vertices, and somewhere around thirty thousand +triangles per second for data sets around three hundred thousand +vertices. I suspect this could be improved only a little bit more with +some clever avoidance of searching the vertex-to-edge mapping. +Most of the data structures internal to TC are constant-time operations, +especially if the vertex range is small.

+ +I have tested TC's performance against an optimized meshifier +modified by Randall Frank at Lawrence Livermore National Labs and +meshifier appears to run about twice as fast, probably because it +doesn't check for errors internally very well and makes some assumptions +about vertex and edge connectivity. Perhaps TC could approach that +performance level if the internal consistency checks were made to compile +conditionally.

+ +

Stripping Performance

+ +TC uses a least-connected-vertex approach to making triangle strips, +under the assumption that such vertices will be at the corners of +patches of connected triangles, and the stripification algorithm will +hopefully peel triangle strips off the outside of the patch first, +in order to avoid fragmenting the triangle set. This is the same +approach Neal Tringham's improved meshifier used. +I have yet to test TC's vertices-per-strip performance against other +triangle strippers, but it should do at least as well as meshifier.

+ +The algorithm attempts to remove all the triangle fans first. I've found +that this works for fewer than half of the simple data files I've tried. +For 1.1 the default value associated with ACTC_OUT_MIN_FAN_VERTS +is set to INT_MAX. Other good values appear to be near 8 and 16. You'll +have to try it yourself to see how it works with your data.

+ +One could conceivably implement simulated annealing with TC. An +application would repeatedly calculate solutions to triangle sets with +TC, swapping the order of some number of triangles, each time choosing +the better solution. As time goes on, the number of triangles rotated +could be reduced. Simulated annealing will typically give a pretty +good solution while allowing the application to choose how much time +it cares to spend to find a solution.

+ +


+ +Revision Control Information: $Header: /home/grantham/cvsroot/projects/modules/tc/manual.html,v 1.15 2000/11/22 20:18:26 grantham Exp $

+ + + + + diff --git a/DSMeshConvert/ac/prims.gif b/DSMeshConvert/ac/prims.gif new file mode 100644 index 0000000..5ddb47c Binary files /dev/null and b/DSMeshConvert/ac/prims.gif differ diff --git a/DSMeshConvert/ac/tc.c b/DSMeshConvert/ac/tc.c new file mode 100644 index 0000000..b308470 --- /dev/null +++ b/DSMeshConvert/ac/tc.c @@ -0,0 +1,1448 @@ +/* + * $Header: /home/grantham/cvsroot/projects/modules/tc/tc.c,v 1.27 2000/10/10 16:09:23 grantham Exp $ + */ + +#include +#include +#include +#include +#include "tc.h" + +/* SNIPPET "table.c" Inducted Wed Nov 22 09:36:55 2000 */ + +#include +#include +#include + +#if !defined(MEM_CHART) +#define chartedSetLabel(a) +#endif + +#define LEVEL1COUNT 16384 +#define LEVEL2COUNT 1024 +#define LEVEL3COUNT 256 + +typedef struct TableLevel3 +{ + int EntryCount; + void *Table[LEVEL3COUNT]; + char IsSet[LEVEL3COUNT]; +} TableLevel3; + +typedef struct TableLevel2 +{ + int EntryCount; + TableLevel3 *Table[LEVEL2COUNT]; +} TableLevel2; + +typedef struct TableRoot +{ + size_t EntryCount; + size_t TotalEntryCount; + size_t TotalAllocatedBytes; + int EmptyEntryCount; + TableLevel2 *Table[LEVEL1COUNT]; +} TableRoot; + +typedef struct TableIterator { + int i1, i2, i3; + u32 i; + TableLevel3 *CurLevel3; + int CheckLevel1, CheckLevel2; +} TableIterator; + +TableRoot *tableNew(void) +{ + TableRoot *tr; + + chartedSetLabel("table root"); + tr = (TableRoot *)calloc(sizeof(TableRoot), 1); + return tr; +} + +TableIterator *tableNewIterator(void) +{ + TableIterator *ti; + + chartedSetLabel("table iterator"); + ti = (TableIterator *)malloc(sizeof(TableIterator)); + return ti; +} + +int tableRetrieve(u32 a, TableRoot *table, void **ref) +{ + int i1 = a / (LEVEL2COUNT * LEVEL3COUNT); + int i2 = (a / LEVEL3COUNT) % LEVEL2COUNT; + int i3 = a % LEVEL3COUNT; + + if(table->Table[i1] == NULL) + return 0; + if(table->Table[i1]->Table[i2] == NULL) + return 0; + if(!table->Table[i1]->Table[i2]->IsSet[i3]) + return 0; + if(ref != NULL) + *ref = table->Table[i1]->Table[i2]->Table[i3]; + return 1; +} + +int tableInsert(u32 a, TableRoot *table, void *ref) +{ + int i1 = a / (LEVEL2COUNT * LEVEL3COUNT); + int i2 = (a / LEVEL3COUNT) % LEVEL2COUNT; + int i3 = a % LEVEL3COUNT; + + if(table->Table[i1] == NULL) { + chartedSetLabel("table level 2"); + table->Table[i1] = (TableLevel2 *)calloc(1, sizeof(TableLevel2)); + table->TotalAllocatedBytes += sizeof(TableLevel2); + if(table->Table[i1] == NULL) + return 0; + } + if(table->Table[i1]->Table[i2] == NULL) { + chartedSetLabel("table level 3"); + table->Table[i1]->Table[i2] = + (TableLevel3 *)calloc(1, sizeof(TableLevel3)); + table->TotalAllocatedBytes += sizeof(TableLevel3); + if(table->Table[i1]->Table[i2] == NULL) + return 0; + table->Table[i1]->EntryCount++; + table->TotalEntryCount += LEVEL3COUNT; + table->EmptyEntryCount += LEVEL3COUNT; + } + if(!table->Table[i1]->Table[i2]->IsSet[i3]) { + table->Table[i1]->Table[i2]->EntryCount++; + table->EmptyEntryCount --; + table->Table[i1]->Table[i2]->IsSet[i3] = 1; + } + table->Table[i1]->Table[i2]->Table[i3] = ref; + return 1; +} + +int tableRemove(u32 a, TableRoot *table, void **wasref) +{ + int i1 = a / (LEVEL2COUNT * LEVEL3COUNT); + int i2 = (a / LEVEL3COUNT) % LEVEL2COUNT; + int i3 = a % LEVEL3COUNT; + + if(table->Table[i1] == NULL) + return 0; + if(table->Table[i1]->Table[i2] == NULL) + return 0; + if(!table->Table[i1]->Table[i2]->IsSet[i3]) + return 0; + if(wasref != NULL) + *wasref = table->Table[i1]->Table[i2]->Table[i3]; + table->Table[i1]->Table[i2]->IsSet[i3] = 0; + table->EmptyEntryCount ++; + if(--table->Table[i1]->Table[i2]->EntryCount == 0) { + table->EmptyEntryCount -= LEVEL3COUNT; + table->TotalEntryCount -= LEVEL3COUNT; + free(table->Table[i1]->Table[i2]); + table->TotalAllocatedBytes -= sizeof(TableLevel3); + table->Table[i1]->Table[i2] = NULL; + if(--table->Table[i1]->EntryCount == 0) { + table->TotalAllocatedBytes -= sizeof(TableLevel2); + free(table->Table[i1]); + table->Table[i1] = NULL; + } + } + return 1; +} + +void tableResetIterator(TableIterator *ti) +{ + ti->i1 = 0; + ti->i2 = 0; + ti->i3 = 0; + ti->i = 0; + ti->CheckLevel1 = 1; + ti->CheckLevel2 = 1; +} + +int tableIterate(TableRoot *table, TableIterator *ti, u32 *i, void **ref) +{ + int done; + + done = 0; + while(ti->i1 < LEVEL1COUNT) { + if(ti->CheckLevel1 && table->Table[ti->i1] == NULL) { + ti->i += LEVEL2COUNT * LEVEL3COUNT; + ti->i1++; + continue; + } else + ti->CheckLevel1 = 0; + if(ti->CheckLevel2 && table->Table[ti->i1]->Table[ti->i2] == NULL) { + ti->i += LEVEL3COUNT; + if(++ti->i2 >= LEVEL2COUNT) { + ti->i2 = 0; + ti->i1++; + ti->CheckLevel1 = 1; + } + continue; + } else + ti->CheckLevel2 = 0; + if(ti->i3 == 0) + ti->CurLevel3 = table->Table[ti->i1]->Table[ti->i2]; + if(ti->CurLevel3->IsSet[ti->i3]) { + if(ref != NULL) + *ref = ti->CurLevel3->Table[ti->i3]; + if(i != NULL) + *i = ti->i; + done = 1; + } + ti->i++; + if(++ti->i3 >= LEVEL3COUNT) { + ti->i3 = 0; + ti->CheckLevel2 = 1; + if(++ti->i2 >= LEVEL2COUNT) { + ti->i2 = 0; + ti->i1++; + ti->CheckLevel1 = 1; + } + } + if(done) + return 1; + } + return 0; +} + +void tableDelete(TableRoot *table, void (*datumDelete)(void *datum)) +{ + int i1, i2, i3; + + for(i1 = 0; i1 < LEVEL1COUNT; i1++) { + if(table->Table[i1] != NULL) { + for(i2 = 0; i2 < LEVEL2COUNT; i2++) { + if(table->Table[i1]->Table[i2] != NULL) { + for(i3 = 0; i3 < LEVEL3COUNT; i3++) { + if(table->Table[i1]->Table[i2]->IsSet[i3]) + datumDelete(table->Table[i1]->Table[i2]->Table[i3]); + } + free(table->Table[i1]->Table[i2]); + } + } + free(table->Table[i1]); + table->Table[i1] = NULL; + } + } + table->TotalEntryCount = 0; + table->EmptyEntryCount = 0; + table->TotalAllocatedBytes = 0; +} + +void tableGetStats(TableRoot *table, size_t *totalBytes, size_t *emptyCount, + size_t *totalCount) +{ + if(emptyCount != NULL) + *emptyCount = table->EmptyEntryCount; + if(totalCount != NULL) + *totalCount = table->TotalEntryCount; + if(totalBytes != NULL) + *totalBytes = table->TotalAllocatedBytes; +} + +size_t tableGetIteratorSize(void) +{ + return sizeof(TableIterator); +} + +/* "table.c" ENDSNIPPET */ + +#if !defined(MEM_CHART) +#define chartedSetLabel(a) +#endif + +#if defined(DEBUG) +#define ACTC_DEBUG(a) a +#else +#define ACTC_DEBUG(a) +#endif + +#if defined(INFO) +#define ACTC_INFO(a) a +#else +#define ACTC_INFO(a) +#endif + + +#define ACTC_CHECK(a) \ + { \ + int theErrorNow; \ + theErrorNow = (a); \ + if(theErrorNow < 0) \ + return theErrorNow; \ + } + +typedef struct { + struct ACTCVertex *FinalVert; +} ACTCTriangle; + +typedef struct { + struct ACTCVertex *V2; + int Count; + int TriangleCount; + ACTCTriangle *Triangles; +} ACTCEdge; + +typedef struct ACTCVertex { + u32 V; + int Count; + struct ACTCVertex **PointsToMe; + struct ACTCVertex *Next; + int EdgeCount; + ACTCEdge *Edges; +} ACTCVertex; + +/* private tokens */ +#define ACTC_NO_MATCHING_VERT -0x3000 +#define ACTC_FWD_ORDER 0 +#define ACTC_REV_ORDER 1 + +#define MAX_STATIC_VERTS 10000000 /* buh? */ + +struct _ACTCData { + + /* vertex and edge database */ + int VertexCount; + TableRoot *Vertices; + TableIterator *VertexIterator; + int CurMaxVertValence; + int CurMinVertValence; + ACTCVertex **VertexBins; + + /* alternate vertex array if range small enough */ + ACTCVertex *StaticVerts; + int UsingStaticVerts; + u32 VertRange; + + /* During consolidation */ + int CurWindOrder; + int PrimType; + ACTCVertex *V1; + ACTCVertex *V2; + int VerticesSoFar; + + /* Error and state handling */ + int IsInputting; + int IsOutputting; + int Error; + + /* actcParam-settable parameters */ + u32 MinInputVert; + u32 MaxInputVert; + int MaxVertShare; + int MaxEdgeShare; + int MinFanVerts; + int MaxPrimVerts; + int HonorWinding; +}; + +#if defined(DEBUG) || defined(INFO) + +static void dumpTriangles(ACTCEdge *e, FILE *fp) +{ + int i; + int c; + char v[12]; + + c = fprintf(fp, " %d triangles: "); + for(i = 0; i < e->TriangleCount; i++) { + if(c + 1 + sprintf(v, "%u", e->Triangles[i].FinalVert) > 78) { + fputs("\n", fp); + c = fprintf(fp, " "); + } + c += fprintf(fp, " %s", v); + } + fputs("\n", fp); +} + +static void dumpEdges(ACTCVertex *vert, FILE *fp) +{ + int i; + int c; + char v[26]; /* two signed ints plus x plus NUL */ + + for(i = 0; i < vert->EdgeCount; i++) { + fprintf(fp, " %u->%u (%d times)\n", vert->V, vert->Edges[i].V2->V, + vert->Edges[i].Count); + dumpTriangles(&vert->Edges[i], fp); + } + fputs("\n", fp); +} + +static void dumpVertices(ACTCData *tc, FILE *fp) +{ + int i; + ACTCVertex *v; + + if(!tc->UsingStaticVerts) + tableResetIterator(tc->VertexIterator); + + fprintf(fp, "%d vertices in valences list\n", tc->VertexCount); + if(tc->UsingStaticVerts) { + for(i = 0; i < tc->VertRange; i++) { + v = &tc->StaticVerts[i]; + if(v->Count > 0) { + fprintf(fp, " vertex %u, valence %d, %d edges\n", v->V, + v->Count, v->EdgeCount); + dumpEdges(v, fp); + } + } + } else { + for(i = 0; i < tc->VertexCount; i++) { + if(tableIterate(tc->Vertices, tc->VertexIterator, NULL, + (void **)&v) == 0) { + fprintf(fp, "ACTC::dumpVertices : fewer vertices in the table " + "than we expected!\n"); + fprintf(stderr, "ACTC::dumpVertices : fewer vertices in the table " + "than we expected!\n"); + } + if(v == NULL) { + fprintf(fp, "ACTC::dumpVertices : did not expect to get a NULL" + "Vertex from the table iterator!\n"); + fprintf(stderr, "ACTC::dumpVertices : did not expect to get a NULL" + "Vertex from the table iterator!\n"); + } + fprintf(fp, " vertex %u, valence %d, %d edges\n", v->V, v->Count, + v->EdgeCount); + dumpEdges(v, fp); + } + } +} + +static void dumpVertexBins(ACTCData *tc, FILE *fp) +{ + ACTCVertex *cur; + int i; + int c; + char v[26]; /* two signed ints plus x plus NUL */ + + fprintf(fp, "vertex bins:\n"); + if(tc->VertexBins == NULL) { + fprintf(fp, " empty.\n"); + return; + } + for(i = 1; i <= tc->CurMaxVertValence; i++) { + cur = tc->VertexBins[i]; + c = fprintf(fp, " bin %d -> ", i); + while(cur != NULL) { + if(c + 1 + sprintf(v, "%ux%d", cur->V, cur->Count) > 78) { + fputs("\n", fp); + c = fprintf(fp, " "); + } + c += fprintf(fp, " %s", v); + cur = cur->Next; + } + fputs("\n", fp); + } +} + +void actcDumpState(ACTCData *tc, FILE *fp) +{ + dumpVertices(tc, fp); + dumpVertexBins(tc, fp); +} + +#endif /* DEBUG || INFO */ + +#if defined(DEBUG) + +static int abortWithOptionalDump(ACTCData *tc) +{ + ACTC_INFO(actcDumpState(tc, stderr)); + abort(); +} + +#endif /* defined(DEBUG) */ + +int actcGetError(ACTCData *tc) +{ + int error = tc->Error; + tc->Error = ACTC_NO_ERROR; + return error; +} + +static void *reallocAndAppend(void **ptr, u32 *itemCount, size_t itemBytes, + void *append) +{ + void *t; + + t = realloc(*ptr, itemBytes * (*itemCount + 1)); + if(t == NULL) + return NULL; + *ptr = t; + + memcpy((unsigned char *)*ptr + *itemCount * itemBytes, append, itemBytes); + (*itemCount) += 1; + + return *ptr; +} + +/* + * Call only during input; changes vertices' valences and does not + * fix the bins that are ordered by vertex valence. (It's usually cheaper + * to traverse the vertex list once after all are added, since that's + * linear in the NUMBER OF UNIQUE VERTEX INDICES, which is almost always + * going to be less than the number of vertices.) + */ +static int incVertexValence(ACTCData *tc, u32 v, ACTCVertex **found) +{ + ACTCVertex *vertex; + + if(tc->UsingStaticVerts) { + vertex = &tc->StaticVerts[v]; + vertex->Count++; + if(vertex->Count == 1) { + vertex->V = v; + tc->VertexCount++; + } + } else { + if(tableRetrieve(v, tc->Vertices, (void **)&vertex) == 1) { + if(vertex->V != v) { + ACTC_DEBUG( + fprintf(stderr, "ACTC::incVertexValence : Got vertex %d when " + "looking for vertex %d?!?\n", vertex->V, v); + abortWithOptionalDump(tc); + ) + return tc->Error = ACTC_DATABASE_CORRUPT; + } + vertex->Count++; + } else { + chartedSetLabel("new Vertex"); + vertex = (ACTCVertex *)malloc(sizeof(ACTCVertex)); + vertex->V = v; + vertex->Count = 1; + vertex->Edges = NULL; + vertex->EdgeCount = 0; + if(tableInsert(v, tc->Vertices, vertex) == 0) { + ACTC_DEBUG(fprintf(stderr, "ACTC::incVertexValence : Failed " + "to insert vertex into table\n");) + return tc->Error = ACTC_ALLOC_FAILED; + } + tc->VertexCount++; + } + } + if(vertex->Count > tc->CurMaxVertValence) + tc->CurMaxVertValence = vertex->Count; + + *found = vertex; + + return ACTC_NO_ERROR; +} + +static int decVertexValence(ACTCData *tc, ACTCVertex **vptr) +{ + ACTCVertex *v = *vptr; + + v->Count--; + if(v->Count < 0) { + ACTC_DEBUG( + fprintf(stderr, "ACTC::decVertexValence : Valence went " + "negative?!?\n"); + abortWithOptionalDump(tc); + ) + return tc->Error = ACTC_DATABASE_CORRUPT; + } + + if(v->PointsToMe != NULL) { + *v->PointsToMe = v->Next; + if(v->Next != NULL) + v->Next->PointsToMe = v->PointsToMe; + v->Next = NULL; + } + + if(v->Count == 0) { + tc->VertexCount--; + if(v->Edges != NULL) + free(v->Edges); + if(!tc->UsingStaticVerts) { + tableRemove(v->V, tc->Vertices, NULL); + free(v); + } + *vptr = NULL; + } else { + if(tc->VertexBins != NULL) { + v->Next = tc->VertexBins[v->Count]; + v->PointsToMe = &tc->VertexBins[v->Count]; + if(v->Next != NULL) + v->Next->PointsToMe = &v->Next; + tc->VertexBins[v->Count] = v; + if(v->Count < tc->CurMinVertValence) + tc->CurMinVertValence = v->Count; + } + } + + return ACTC_NO_ERROR; +} + +static int findNextFanVertex(ACTCData *tc, ACTCVertex **vert) +{ + if(tc->CurMaxVertValence < tc->MinFanVerts) { + return ACTC_NO_MATCHING_VERT; + } + while(tc->VertexBins[tc->CurMaxVertValence] == NULL) { + tc->CurMaxVertValence--; + if(tc->CurMaxVertValence < tc->CurMinVertValence) { + if(tc->VertexCount > 0) { + ACTC_DEBUG(fprintf(stderr, "tc::findNextFanVertex : no more " + "vertices in bins but VertexCount > 0\n");) + return tc->Error = ACTC_DATABASE_CORRUPT; + } + return ACTC_NO_MATCHING_VERT; + } + } + *vert = tc->VertexBins[tc->CurMaxVertValence]; + return ACTC_NO_ERROR; +} + +static int findNextStripVertex(ACTCData *tc, ACTCVertex **vert) +{ + while(tc->VertexBins[tc->CurMinVertValence] == NULL) { + tc->CurMinVertValence++; + if(tc->CurMinVertValence > tc->CurMaxVertValence) { + if(tc->VertexCount > 0) { + ACTC_DEBUG(fprintf(stderr, "tc::findNextStripVertex : no more " + "vertices in bins but VertexCount > 0\n");) + return tc->Error = ACTC_DATABASE_CORRUPT; + } + return ACTC_NO_MATCHING_VERT; + } + } + *vert = tc->VertexBins[tc->CurMinVertValence]; + return ACTC_NO_ERROR; +} + +int actcGetIsDuringInput(ACTCData *tc) { + return tc->IsInputting; +} + +int actcBeginInput(ACTCData *tc) +{ + if(tc->IsOutputting) { + ACTC_DEBUG(fprintf(stderr, "actcBeginInput : called within " + "BeginOutput/EndOutput\n");) + return tc->Error = ACTC_DURING_INPUT; + } + + if(tc->IsInputting) { + ACTC_DEBUG(fprintf(stderr, "actcBeginInput : called within " + "BeginInput/EndInput\n");) + return tc->Error = ACTC_DURING_INPUT; + } + + tc->IsInputting = 1; + tc->CurMaxVertValence = 0; + + if(tc->MaxInputVert < MAX_STATIC_VERTS - 1) { + size_t byteCount; + tc->UsingStaticVerts = 1; + tc->VertRange = tc->MaxInputVert + 1; + byteCount = sizeof(ACTCVertex) * tc->VertRange; + chartedSetLabel("static verts"); + tc->StaticVerts = (ACTCVertex *)calloc(sizeof(ACTCVertex), tc->VertRange); + if(tc->StaticVerts == NULL) { + ACTC_INFO(printf("Couldn't allocate static %d vert block of %u " + "bytes\n", tc->VertRange, byteCount);) + tc->UsingStaticVerts = 0; + } + } else + tc->UsingStaticVerts = 0; + + return ACTC_NO_ERROR; +} + +int actcEndInput(ACTCData *tc) +{ + if(tc->IsOutputting) { + ACTC_DEBUG(fprintf(stderr, "actcEndInput : called within " + "BeginOutput/EndOutput\n");) + return tc->Error = ACTC_DURING_OUTPUT; + } + + if(!tc->IsInputting) { + ACTC_DEBUG(fprintf(stderr, "actcEndInput : called outside " + "BeginInput/EndInput\n");) + return tc->Error = ACTC_IDLE; + } + + tc->IsInputting = 0; + + return ACTC_NO_ERROR; +} + +int actcGetIsDuringOutput(ACTCData *tc) { + return tc->IsOutputting; +} + +int actcBeginOutput(ACTCData *tc) +{ + ACTCVertex *v; + int i; + + if(tc->IsInputting) { + ACTC_DEBUG(fprintf(stderr, "actcBeginOutput : called within " + "BeginInput/EndInput\n");) + return tc->Error = ACTC_DURING_INPUT; + } + + if(tc->IsOutputting) { + ACTC_DEBUG(fprintf(stderr, "actcBeginOutput : called within " + "BeginOutput/EndOutput\n");) + return tc->Error = ACTC_DURING_OUTPUT; + } + + tc->IsOutputting = 1; + + tc->CurMinVertValence = INT_MAX; + chartedSetLabel("vertex bins"); + tc->VertexBins = (ACTCVertex **)calloc(sizeof(ACTCVertex *), tc->CurMaxVertValence + 1); + if(tc->VertexBins == NULL) { + ACTC_DEBUG(fprintf(stderr, "actcBeginOutput : couldn't allocate %d bytes " + "for Vertex Bins\n", + sizeof(ACTCVertex *) * tc->CurMaxVertValence);) + return tc->Error = ACTC_ALLOC_FAILED; + } + + if(tc->UsingStaticVerts) { + double edgeTotal; + for(i = 0; i < tc->VertRange; i++) { + v = &tc->StaticVerts[i]; + if(v->Count > 0) { + v->Next = tc->VertexBins[v->Count]; + v->PointsToMe = &tc->VertexBins[v->Count]; + tc->VertexBins[v->Count] = v; + if(v->Next != NULL) + v->Next->PointsToMe = &v->Next; + if(v->Count < tc->CurMinVertValence) + tc->CurMinVertValence = v->Count; + edgeTotal += v->EdgeCount; + } + } + } else { + tableResetIterator(tc->VertexIterator); + for(i = 0; i < tc->VertexCount; i++) { + if(tableIterate(tc->Vertices, tc->VertexIterator, NULL, (void **)&v) + == 0) { + ACTC_DEBUG(fprintf(stderr, "actcBeginOutput : fewer vertices in " + "the table than we expected!\n");) + return tc->Error = ACTC_DATABASE_CORRUPT; + } + v->Next = tc->VertexBins[v->Count]; + v->PointsToMe = &tc->VertexBins[v->Count]; + tc->VertexBins[v->Count] = v; + if(v->Next != NULL) + v->Next->PointsToMe = &v->Next; + if(v->Count < tc->CurMinVertValence) + tc->CurMinVertValence = v->Count; + } + } + + return ACTC_NO_ERROR; +} + +int actcEndOutput(ACTCData *tc) +{ + if(tc->IsInputting) { + ACTC_DEBUG(fprintf(stderr, "actcEndOutput : called within " + "BeginInput/EndInput\n");) + return tc->Error = ACTC_DURING_INPUT; + } + + if(!tc->IsOutputting) { + ACTC_DEBUG(fprintf(stderr, "actcEndOutput : called outside " + "BeginOutput/EndOutput\n");) + return tc->Error = ACTC_IDLE; + } + + tc->IsOutputting = 0; + + if(tc->UsingStaticVerts) { + free(tc->StaticVerts); + tc->StaticVerts = NULL; + tc->UsingStaticVerts = 0; + } + + free(tc->VertexBins); + tc->VertexBins = NULL; + + return ACTC_NO_ERROR; +} + +ACTCData *actcNew(void) +{ + ACTCData *tc; +#if defined(DEBUG) || defined(INFO) + static int didPrintVersion = 0; + + if(!didPrintVersion) { + int verMinor, verMajor; + didPrintVersion = 1; + + actcGetParami(tc, ACTC_MAJOR_VERSION, &verMajor); + actcGetParami(tc, ACTC_MINOR_VERSION, &verMinor); + fprintf(stderr, "TC Version %d.%d\n", verMajor, verMinor); + } +#endif /* defined(DEBUG) || defined(INFO) */ + + chartedSetLabel("the tc struct"); + tc = (ACTCData *)calloc(sizeof(*tc), 1); + + if(tc == NULL) { + ACTC_DEBUG(fprintf(stderr, "actcNew : couldn't allocate %d bytes " + "for new ACTCData\n", sizeof(*tc));) + return NULL; + } + + tc->Vertices = tableNew(); + tc->VertexIterator = tableNewIterator(); + + tc->MinFanVerts = INT_MAX; + tc->MaxPrimVerts = INT_MAX; + tc->MaxInputVert = INT_MAX; + tc->MaxEdgeShare = INT_MAX; + tc->MaxVertShare = INT_MAX; + tc->HonorWinding = 1; + /* seed = 0 handled by calloc */ + /* XXX grantham 20000615 - seed ignored for now */ + + return tc; +} + +static size_t allocatedForTriangles(ACTCEdge *e) +{ + return sizeof(ACTCTriangle) * e->TriangleCount; +} + +static size_t allocatedForEdges(ACTCVertex *vert) +{ + int i; + size_t size; + + size = sizeof(ACTCEdge) * vert->EdgeCount; + for(i = 0; i < vert->EdgeCount; i++) { + size += allocatedForTriangles(&vert->Edges[i]); + } + return size; +} + +static size_t allocatedForVertices(ACTCData *tc) +{ + int i; + int size; + ACTCVertex *v; + + if(!tc->UsingStaticVerts) + tableResetIterator(tc->VertexIterator); + + if(tc->UsingStaticVerts) { + size = tc->VertRange * sizeof(ACTCVertex); + for(i = 0; i < tc->VertRange; i++) { + v = &tc->StaticVerts[i]; + if(v->Count > 0) + size += allocatedForEdges(v); + } + } else { + for(i = 0; i < tc->VertexCount; i++) { + tableIterate(tc->Vertices, tc->VertexIterator, NULL, (void **)&v); + size += allocatedForEdges(v); + } + } + return size; +} + +int actcGetMemoryAllocation(ACTCData *tc, size_t *bytesAllocated) +{ + size_t tableBytes; + + tableGetStats(tc->Vertices, NULL, NULL, &tableBytes); + *bytesAllocated = sizeof(ACTCData); + *bytesAllocated += tableBytes; + *bytesAllocated += allocatedForVertices(tc); /* recurses */ + + return ACTC_NO_ERROR; +} + +static void freeVertex(void *p) +{ + ACTCVertex *v = (ACTCVertex *)p; + int i; + + for(i = 0; i < v->EdgeCount; i++) + free(v->Edges[i].Triangles); + free(v->Edges); + free(v); +} + +int actcMakeEmpty(ACTCData *tc) +{ + tc->VertexCount = 0; + if(!tc->UsingStaticVerts) + tableDelete(tc->Vertices, freeVertex); + if(tc->VertexBins != NULL) { + free(tc->VertexBins); + tc->VertexBins = NULL; + } + tc->IsOutputting = 0; + tc->IsInputting = 0; + return ACTC_NO_ERROR; +} + +void actcDelete(ACTCData *tc) +{ + actcMakeEmpty(tc); + free(tc->VertexIterator); + free(tc->Vertices); + free(tc); +} + +int actcParami(ACTCData *tc, int param, int value) +{ + if(tc->IsInputting) { + ACTC_DEBUG(fprintf(stderr, "actcParami : within BeginInput/" + "EndInput\n");) + return tc->Error = ACTC_DURING_INPUT; + } + if(tc->IsOutputting) { + ACTC_DEBUG(fprintf(stderr, "actcParami : within BeginOutput/" + "EndOutput\n");) + return tc->Error = ACTC_DURING_OUTPUT; + } + switch(param) { + case ACTC_OUT_MIN_FAN_VERTS: + tc->MinFanVerts = value; + break; + + case ACTC_IN_MAX_VERT: + if(value < tc->MinInputVert) { + ACTC_DEBUG(fprintf(stderr, "actcParami : tried to set " + "MAX_INPUT_VERT to %d, less than MIN_INPUT_VERT (%d)\n", + value, tc->MinInputVert);) + return tc->Error = ACTC_INVALID_VALUE; + } + tc->MaxInputVert = value; + break; + + case ACTC_IN_MIN_VERT: + if(value > tc->MaxInputVert) { + ACTC_DEBUG(fprintf(stderr, "actcParami : tried to set " + "MIN_INPUT_VERT to %d, greater than MAX_INPUT_VERT (%d)\n", + value, tc->MaxInputVert);) + return tc->Error = ACTC_INVALID_VALUE; + } + tc->MinInputVert = value; + break; + + case ACTC_IN_MAX_EDGE_SHARING: + tc->MaxEdgeShare = value; + break; + + case ACTC_IN_MAX_VERT_SHARING: + tc->MaxVertShare = value; + break; + + case ACTC_OUT_HONOR_WINDING: + tc->HonorWinding = value; + break; + + case ACTC_OUT_MAX_PRIM_VERTS: + if(value < 3) { + ACTC_DEBUG(fprintf(stderr, "actcParami : tried to set " + "MAX_PRIM_VERTS to %d (needed to be 3 or more)\n", value);) + return tc->Error = ACTC_INVALID_VALUE; + } + tc->MaxPrimVerts = value; + break; + + } + return ACTC_NO_ERROR; +} + +int actcParamu(ACTCData *tc, int param, u32 value) +{ + /* + * XXX - yes, this is questionable, but I consulted industry + * experts and we agreed that most common behavior is to copy the + * bits directly, which is what I want. + */ + return actcParami(tc, param, (int)value); +} + +int actcGetParami(ACTCData *tc, int param, int *value) +{ + switch(param) { + case ACTC_MAJOR_VERSION: + *value = 1; + break; + + case ACTC_MINOR_VERSION: + *value = 1; + break; + + case ACTC_IN_MAX_VERT: + *value = tc->MaxInputVert; + break; + + case ACTC_IN_MIN_VERT: + *value = tc->MinInputVert; + break; + + case ACTC_IN_MAX_EDGE_SHARING: + *value = tc->MaxEdgeShare; + break; + + case ACTC_IN_MAX_VERT_SHARING: + *value = tc->MaxVertShare; + break; + + case ACTC_OUT_MIN_FAN_VERTS: + *value = tc->MinFanVerts; + break; + + case ACTC_OUT_HONOR_WINDING: + *value = tc->HonorWinding; + break; + + case ACTC_OUT_MAX_PRIM_VERTS: + *value = tc->MaxPrimVerts; + break; + + default: + *value = 0; + return tc->Error = ACTC_INVALID_VALUE; + /* break; */ + } + return ACTC_NO_ERROR; +} + +int actcGetParamu(ACTCData *tc, int param, u32 *value) +{ + return actcGetParami(tc, param, (int *)value); +} + +static int mapEdgeTriangle(ACTCData *tc, ACTCEdge *edge, ACTCVertex *v3) +{ + ACTCTriangle tmp; + void *r; + + tmp.FinalVert = v3; + chartedSetLabel("triangle list"); + r = reallocAndAppend((void **)&edge->Triangles, &edge->TriangleCount, + sizeof(tmp), &tmp); + if(r == NULL) { + ACTC_DEBUG(fprintf(stderr, "ACTC::mapEdgeTriangle : Couldn't allocate " + "%d bytes for triangles\n", sizeof(tmp) * + (edge->TriangleCount + 1));) + return tc->Error = ACTC_ALLOC_FAILED; + } + + return ACTC_NO_ERROR; +} + +static int unmapEdgeTriangle(ACTCData *tc, ACTCEdge *edge, ACTCVertex *v3) +{ + int i; + + for(i = 0; i < edge->TriangleCount; i++) + if(edge->Triangles[i].FinalVert == v3) + break; + + if(i == edge->TriangleCount) { + ACTC_DEBUG( + fprintf(stderr, "ACTC::unmapEdgeTriangle : Couldn't find third vertex" + " from edge in order to delete it?!?\n"); + abortWithOptionalDump(tc); + ) + return tc->Error = ACTC_DATABASE_CORRUPT; + } + + edge->Triangles[i] = edge->Triangles[edge->TriangleCount - 1]; + edge->TriangleCount --; + + return ACTC_NO_ERROR; +} + +static int mapVertexEdge(ACTCData *tc, ACTCVertex *v1, ACTCVertex *v2, ACTCEdge **edge) +{ + u32 i; + ACTCEdge tmp; + void *r; + + for(i = 0; i < v1->EdgeCount; i++) + if(v1->Edges[i].V2 == v2) { + v1->Edges[i].Count++; + break; + } + + if(i == v1->EdgeCount) { + + tmp.V2 = v2; + tmp.Count = 1; + tmp.Triangles = NULL; + tmp.TriangleCount = 0; + + chartedSetLabel("vert-to-edge mapping"); + r = reallocAndAppend((void **)&v1->Edges, &v1->EdgeCount, + sizeof(tmp), &tmp); + if(r == NULL) { + ACTC_DEBUG(fprintf(stderr, "ACTC::mapVertexEdge : Couldn't reallocate " + "to %d bytes for vertex's edge list\n", sizeof(tmp) * + v1->EdgeCount);) + return tc->Error = ACTC_ALLOC_FAILED; + } + } + *edge = &v1->Edges[i]; + + return ACTC_NO_ERROR; +} + +static int unmapVertexEdge(ACTCData *tc, ACTCVertex *v1, ACTCVertex *v2) +{ + int i; + + for(i = 0; i < v1->EdgeCount; i++) + if(v1->Edges[i].V2 == v2) + break; + + if(i == v1->EdgeCount) { + ACTC_DEBUG( + fprintf(stderr, "ACTC::unmapVertexEdge : Couldn't find edge %d,%d" + " from vertex in order to unmap it?!?\n", v1->V, v2->V); + abortWithOptionalDump(tc); + ) + return tc->Error = ACTC_DATABASE_CORRUPT; + } + + v1->Edges[i].Count --; + if(v1->Edges[i].Count == 0) { + if(v1->Edges[i].Triangles != NULL) + free(v1->Edges[i].Triangles); + v1->Edges[i] = v1->Edges[v1->EdgeCount - 1]; + v1->EdgeCount --; + } + + return ACTC_NO_ERROR; +} + +int actcAddTriangle(ACTCData *tc, u32 v1, u32 v2, u32 v3) +{ + ACTCVertex *vertexRec1; + ACTCVertex *vertexRec2; + ACTCVertex *vertexRec3; + + ACTCEdge *edge12; + ACTCEdge *edge23; + ACTCEdge *edge31; + + if(tc->IsOutputting) { + ACTC_DEBUG(fprintf(stderr, "actcAddTriangle : inside " + "BeginOutput/EndOutput\n");) + return tc->Error = ACTC_IDLE; + } + if(!tc->IsInputting) { + ACTC_DEBUG(fprintf(stderr, "actcAddTriangle : outside " + "BeginInput/EndInput\n");) + return tc->Error = ACTC_DURING_INPUT; + } + + if(incVertexValence(tc, v1, &vertexRec1) != ACTC_NO_ERROR) goto returnError1; + if(incVertexValence(tc, v2, &vertexRec2) != ACTC_NO_ERROR) goto free1; + if(incVertexValence(tc, v3, &vertexRec3) != ACTC_NO_ERROR) goto free2; + + if(mapVertexEdge(tc, vertexRec1, vertexRec2, &edge12) != ACTC_NO_ERROR) + goto free3; + if(mapVertexEdge(tc, vertexRec2, vertexRec3, &edge23) != ACTC_NO_ERROR) + goto free4; + if(mapVertexEdge(tc, vertexRec3, vertexRec1, &edge31) != ACTC_NO_ERROR) + goto free5; + + if(mapEdgeTriangle(tc, edge12, vertexRec3) != ACTC_NO_ERROR) goto free6; + if(mapEdgeTriangle(tc, edge23, vertexRec1) != ACTC_NO_ERROR) goto free7; + if(mapEdgeTriangle(tc, edge31, vertexRec2) != ACTC_NO_ERROR) goto free8; + + return ACTC_NO_ERROR; + + /* + * XXX Unfortunately, while backing out during the following + * statements, we might encounter errors in the database which + * will not get returned properly to the caller; I take heart in + * the fact that if such an error occurs, TC is just a moment from + * core dumping anyway. XXX grantham 20000615 + */ + +free8: + unmapEdgeTriangle(tc, edge23, vertexRec1); +free7: + unmapEdgeTriangle(tc, edge12, vertexRec3); +free6: + unmapVertexEdge(tc, vertexRec3, vertexRec1); +free5: + unmapVertexEdge(tc, vertexRec2, vertexRec3); +free4: + unmapVertexEdge(tc, vertexRec1, vertexRec2); +free3: + decVertexValence(tc, &vertexRec3); +free2: + decVertexValence(tc, &vertexRec2); +free1: + decVertexValence(tc, &vertexRec1); +returnError1: + return tc->Error; +} + +int actcStartNextPrim(ACTCData *tc, u32 *v1Return, u32 *v2Return) +{ + ACTCVertex *v1 = NULL; + ACTCVertex *v2 = NULL; + int findResult; + + if(tc->IsInputting) { + ACTC_DEBUG(fprintf(stderr, "actcStartNextPrim : within " + "BeginInput/EndInput\n");) + return tc->Error = ACTC_DURING_INPUT; + } + if(!tc->IsOutputting) { + ACTC_DEBUG(fprintf(stderr, "actcStartNextPrim : outside " + "BeginOutput/EndOutput\n");) + return tc->Error = ACTC_IDLE; + } + + findResult = findNextFanVertex(tc, &v1); + if(findResult == ACTC_NO_ERROR) + tc->PrimType = ACTC_PRIM_FAN; + else if(findResult != ACTC_NO_MATCHING_VERT) { + ACTC_DEBUG(fprintf(stderr, "actcStartNextPrim : internal " + "error finding next appropriate vertex\n");) + return tc->Error = findResult; + } else { + findResult = findNextStripVertex(tc, &v1); + if(findResult != ACTC_NO_ERROR && findResult != ACTC_NO_MATCHING_VERT) { + ACTC_DEBUG(fprintf(stderr, "actcStartNextPrim : internal " + "error finding next appropriate vertex\n");) + return tc->Error = findResult; + } + tc->PrimType = ACTC_PRIM_STRIP; + } + + if(findResult == ACTC_NO_MATCHING_VERT) { + *v1Return = -1; + *v2Return = -1; + return tc->Error = ACTC_DATABASE_EMPTY; + } + + v2 = v1->Edges[0].V2; + + tc->CurWindOrder = ACTC_FWD_ORDER; + tc->VerticesSoFar = 2; + + tc->V1 = v1; + tc->V2 = v2; + + *v1Return = v1->V; + *v2Return = v2->V; + + ACTC_INFO(printf("starting with edge %u, %u\n", tc->V1->V, tc->V2->V);) + + return tc->PrimType; +} + +static int findEdge(ACTCVertex *v1, ACTCVertex *v2, ACTCEdge **edge) +{ + int i; + + for(i = 0; i < v1->EdgeCount; i++) + if(v1->Edges[i].V2 == v2) { + *edge = &v1->Edges[i]; + return 1; + } + return 0; +} + +int unmapEdgeTriangleByVerts(ACTCData *tc, ACTCVertex *v1, ACTCVertex *v2, + ACTCVertex *v3) +{ + ACTCEdge *e; + + ACTC_CHECK(findEdge(v1, v2, &e)); + unmapEdgeTriangle(tc, e, v3); + return ACTC_NO_ERROR; +} + +int actcGetNextVert(ACTCData *tc, u32 *vertReturn) +{ + ACTCEdge *edge; + int wasEdgeFound = 0; + ACTCVertex *thirdVertex; + int wasFoundReversed; + + if(tc->IsInputting) { + ACTC_DEBUG(fprintf(stderr, "actcGetNextVert : within BeginInput/" + "EndInput\n");) + return tc->Error = ACTC_DURING_INPUT; + } + if(!tc->IsOutputting) { + ACTC_DEBUG(fprintf(stderr, "actcGetNextVert : outside BeginOutput/" + "EndOutput\n");) + return tc->Error = ACTC_IDLE; + } + if(tc->PrimType == -1) { + ACTC_DEBUG(fprintf(stderr, "actcGetNextVert : Asked for next vertex " + "without a primitive (got last\n vertex already?)\n");) + return tc->Error = ACTC_INVALID_VALUE; + } + + if(tc->VerticesSoFar >= tc->MaxPrimVerts) { + tc->PrimType = -1; + return tc->Error = ACTC_PRIM_COMPLETE; + } + + if(tc->V1 == NULL || tc->V2 == NULL) { + tc->PrimType = -1; + return tc->Error = ACTC_PRIM_COMPLETE; + } + + ACTC_INFO(printf("looking for edge %u, %u\n", tc->V1->V, tc->V2->V);) + + wasFoundReversed = 0; + + if(findEdge(tc->V1, tc->V2, &edge) != 0) { + wasEdgeFound = 1; + } else if(!tc->HonorWinding) { + wasFoundReversed = 1; + if(findEdge(tc->V2, tc->V1, &edge) != 0) { + wasEdgeFound = 1; + } + } + + if(!wasEdgeFound) { + tc->PrimType = -1; + return tc->Error = ACTC_PRIM_COMPLETE; + } + + thirdVertex = edge->Triangles[edge->TriangleCount - 1].FinalVert; + + ACTC_INFO(printf("third vertex = %u\n", thirdVertex->V);) + *vertReturn = thirdVertex->V; + + if(wasFoundReversed) { + ACTC_CHECK(unmapEdgeTriangle(tc, edge, thirdVertex)); + ACTC_CHECK(unmapEdgeTriangleByVerts(tc, tc->V1, thirdVertex, tc->V2)); + ACTC_CHECK(unmapEdgeTriangleByVerts(tc, thirdVertex, tc->V2, tc->V1)); + ACTC_CHECK(unmapVertexEdge(tc, tc->V2, tc->V1)); + ACTC_CHECK(unmapVertexEdge(tc, tc->V1, thirdVertex)); + ACTC_CHECK(unmapVertexEdge(tc, thirdVertex, tc->V2)); + } else { + ACTC_CHECK(unmapEdgeTriangle(tc, edge, thirdVertex)); + ACTC_CHECK(unmapEdgeTriangleByVerts(tc, tc->V2, thirdVertex, tc->V1)); + ACTC_CHECK(unmapEdgeTriangleByVerts(tc, thirdVertex, tc->V1, tc->V2)); + ACTC_CHECK(unmapVertexEdge(tc, tc->V1, tc->V2)); + ACTC_CHECK(unmapVertexEdge(tc, tc->V2, thirdVertex)); + ACTC_CHECK(unmapVertexEdge(tc, thirdVertex, tc->V1)); + } + ACTC_CHECK(decVertexValence(tc, &tc->V1)); + ACTC_CHECK(decVertexValence(tc, &tc->V2)); + ACTC_CHECK(decVertexValence(tc, &thirdVertex)); + + if(tc->PrimType == ACTC_PRIM_FAN) { + tc->V2 = thirdVertex; + } else /* PRIM_STRIP */ { + if(tc->CurWindOrder == ACTC_FWD_ORDER) + tc->V1 = thirdVertex; + else + tc->V2 = thirdVertex; + tc->CurWindOrder = !tc->CurWindOrder; + } + + tc->VerticesSoFar++; + return ACTC_NO_ERROR; +} + +int actcTrianglesToPrimitives(ACTCData *tc, int triangleCount, + u32 (*triangles)[3], int primTypes[], int primLengths[], u32 vertices[], + int maxBatchSize) +{ + int r; + int curTriangle; + int curPrimitive; + u32 curVertex; + int prim; + u32 v1, v2, v3; + int lastPrim; + int passesWithoutPrims; + int trisSoFar; + + if(tc->IsInputting) { + ACTC_DEBUG(fprintf(stderr, "actcTrianglesToPrimitives : within BeginInput/" + "EndInput\n");) + return tc->Error = ACTC_DURING_INPUT; + } + if(tc->IsOutputting) { + ACTC_DEBUG(fprintf(stderr, "actcTrianglesToPrimitives : within" + "BeginOutput/EndOutput\n");) + return tc->Error = ACTC_DURING_OUTPUT; + } + curTriangle = 0; + curPrimitive = 0; + curVertex = 0; + passesWithoutPrims = 0; + + actcMakeEmpty(tc); + + ACTC_CHECK(actcBeginInput(tc)); + trisSoFar = 0; + while(curTriangle < triangleCount) { + r = actcAddTriangle(tc, triangles[curTriangle][0], + triangles[curTriangle][1], triangles[curTriangle][2]); + trisSoFar++; + curTriangle++; + if((trisSoFar >= maxBatchSize) || + (r == ACTC_ALLOC_FAILED && curTriangle != triangleCount) || + (r == ACTC_NO_ERROR && curTriangle == triangleCount)) { + + /* drain what we got */ + trisSoFar = 0; + ACTC_CHECK(actcEndInput(tc)); + ACTC_CHECK(actcBeginOutput(tc)); + lastPrim = curPrimitive; + while((prim = actcStartNextPrim(tc, &v1, &v2)) != ACTC_DATABASE_EMPTY) { + ACTC_CHECK(prim); + primTypes[curPrimitive] = prim; + primLengths[curPrimitive] = 2; + vertices[curVertex++] = v1; + vertices[curVertex++] = v2; + while((r = actcGetNextVert(tc, &v3)) != ACTC_PRIM_COMPLETE) { + ACTC_CHECK(r); + vertices[curVertex++] = v3; + primLengths[curPrimitive]++; + } + curPrimitive++; + } + ACTC_CHECK(actcEndOutput(tc)); + if(r == ACTC_ALLOC_FAILED && curPrimitive == lastPrim) { + if(passesWithoutPrims == 0) { + /* not enough memory to add a triangle and */ + /* nothing in the database, better free everything */ + /* and try again */ + actcMakeEmpty(tc); + } else { + /* cleaned up and STILL couldn't get a triangle in; */ + /* give up */ + return tc->Error = ACTC_ALLOC_FAILED; + } + passesWithoutPrims++; + } + ACTC_CHECK(actcBeginInput(tc)); + } else + ACTC_CHECK(r); + if(r == ACTC_ALLOC_FAILED) + curTriangle--; + } + ACTC_CHECK(actcEndInput(tc)); + + actcMakeEmpty(tc); + + return curPrimitive; +} + +/* vi:tabstop=8 + */ diff --git a/DSMeshConvert/ac/tc.h b/DSMeshConvert/ac/tc.h new file mode 100644 index 0000000..5a02f8f --- /dev/null +++ b/DSMeshConvert/ac/tc.h @@ -0,0 +1,86 @@ +/* + * $Header: /home/grantham/cvsroot/projects/modules/tc/tc.h,v 1.14 2000/10/03 07:19:20 grantham Exp $ + */ + +#if !defined(_ACTC_H_) +#define _ACTC_H_ + +#include "../types.h" +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _ACTCData ACTCData; + +/* + Abbreviated: + vertex vert + primitive prim + maximum max + minimum min + parameter param + */ + +#define ACTC_NO_ERROR 0 +#define ACTC_ALLOC_FAILED -0x2000 +#define ACTC_DURING_INPUT -0x2001 +#define ACTC_DURING_OUTPUT -0x2002 +#define ACTC_IDLE -0x2003 +#define ACTC_INVALID_VALUE -0x2004 +#define ACTC_DATABASE_EMPTY -0x2005 +#define ACTC_DATABASE_CORRUPT -0x2006 +#define ACTC_PRIM_COMPLETE -0x2007 + +#define ACTC_OUT_MIN_FAN_VERTS 0x1000 +#define ACTC_OUT_HONOR_WINDING 0x1001 +#define ACTC_OUT_MAX_PRIM_VERTS 0x1004 +#define ACTC_IN_MIN_VERT 0x1005 +#define ACTC_IN_MAX_VERT 0x1006 +#define ACTC_IN_MAX_VERT_SHARING 0x1007 +#define ACTC_IN_MAX_EDGE_SHARING 0x1008 +#define ACTC_MINOR_VERSION 0x1009 +#define ACTC_MAJOR_VERSION 0x1010 + +#define ACTC_PRIM_FAN 0x2000 +#define ACTC_PRIM_STRIP 0x2001 + +#define ACTC_TRUE 1 +#define ACTC_FALSE 0 + +ACTCData *actcNew(void); +int actcParami(ACTCData *tc, int param, int value); +int actcGetParami(ACTCData *tc, int param, int *value); +int actcParamu(ACTCData *tc, int param, u32 value); +int actcGetParamu(ACTCData *tc, int param, u32 *value); +int actcGetError(ACTCData *tc); +int actcMakeEmpty(ACTCData *tc); +void actcDelete(ACTCData *tc); +void actcDumpState(ACTCData *tc, FILE *fp); + +int actcBeginInput(ACTCData *tc); +int actcGetIsDuringInput(ACTCData *tc); +int actcAddTriangle(ACTCData *tc, u32 v1, u32 v2, u32 v3); +int actcEndInput(ACTCData *tc); + +int actcBeginOutput(ACTCData *tc); +int actcGetIsDuringOutput(ACTCData *tc); +int actcStartNextPrim(ACTCData *tc, u32 *v1Return, u32 *v2Return); +int actcGetNextVert(ACTCData *tc, u32 *vReturn); +int actcEndOutput(ACTCData *tc); + +int actcGetMemoryAllocation(ACTCData *tc, size_t *bytesAllocated); + +int actcTrianglesToPrimitives(ACTCData *tc, int triangleCount, + u32 (*triangles)[3], int primTypes[], int primLengths[], u32 vertices[], + int maxBatchSize); + +#ifdef __cplusplus +} +#endif + +#endif /* _ACTC_H_ */ + +/* vi:tabstop=8 + */ diff --git a/DSMeshConvert/cets-pterdiman/Adjacency.cpp b/DSMeshConvert/cets-pterdiman/Adjacency.cpp new file mode 100644 index 0000000..5079511 --- /dev/null +++ b/DSMeshConvert/cets-pterdiman/Adjacency.cpp @@ -0,0 +1,290 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Source code for "Creating Efficient Triangle Strips" +// (C) 2000, Pierre Terdiman (p.terdiman@wanadoo.fr) +// +// Version is 2.0. +// +// Following adjacency structures have been successfully used to implement: +// - a triangle striper +// - a silhouette tracker [used for shadow volumes, occlusion culling, and glow!] +// - local search for collision detection on terrains +// - subdivision surfaces +// +// So that one IS useful.... +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Precompiled Header +//#include "Stdafx.h" +#include "Adjacency.h" +#include "RevisitedRadix.h" +#define RELEASEARRAY(x) { if ( x ) delete[] (x); } +#define RELEASE(x) { if ( x ) delete (x); } +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Adjacencies Class Implementation +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Constructor +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +Adjacencies::Adjacencies() : mNbEdges(0), mCurrentNbFaces(0), mEdges(0), mNbFaces(0), mFaces(0) +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Destructor +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +Adjacencies::~Adjacencies() +{ + RELEASEARRAY(mEdges); + RELEASEARRAY(mFaces); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to initialize the component +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : create, the creation structure +// Output : - +// Return : true if success +// Exception: - +// Remark : - +bool Adjacencies::Init(ADJACENCIESCREATE& create) +{ + // Get some bytes + mNbFaces = create.NbFaces; + mFaces = new AdjTriangle[mNbFaces]; if(!mFaces) return false; + mEdges = new AdjEdge[mNbFaces*3]; if(!mEdges) return false; + + // Feed me with triangles..... + for(u32 i=0;i edge is a boundary edge: it belongs to a single triangle. + // Hence there's no need to update a link to an adjacent triangle. + bool Status = UpdateLink(TmpBuffer[0], TmpBuffer[1], LastRef0, LastRef1); + if(!Status) + { + RELEASEARRAY(VRefs1); + RELEASEARRAY(VRefs0); + RELEASEARRAY(FaceNb); + return Status; + } + } + // Reset for next edge + Count = 0; + TmpBuffer[Count++] = Face; + LastRef0 = Ref0; + LastRef1 = Ref1; + } + } + bool Status = true; + if(Count==2) Status = UpdateLink(TmpBuffer[0], TmpBuffer[1], LastRef0, LastRef1); + + RELEASEARRAY(VRefs1); + RELEASEARRAY(VRefs0); + RELEASEARRAY(FaceNb); + + // We don't need the edges anymore + RELEASEARRAY(mEdges); + + return Status; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to update the links in two adjacent triangles +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : firsttri, index of the first triangle +// secondtri, index of the second triangle +// ref0, ref1, the common edge +// Output : - +// Return : true if success +// Exception: - +// Remark : - +bool Adjacencies::UpdateLink(u32 firsttri, u32 secondtri, u32 ref0, u32 ref1) +{ + AdjTriangle* Tri0 = &mFaces[firsttri]; // Catch the first triangle + AdjTriangle* Tri1 = &mFaces[secondtri]; // Catch the second triangle + + // Get the edge IDs. 0xff means input references are wrong. + u8 EdgeNb0 = Tri0->FindEdge(ref0, ref1); if(EdgeNb0==0xff) return false; + u8 EdgeNb1 = Tri1->FindEdge(ref0, ref1); if(EdgeNb1==0xff) return false; + + // Update links. The two most significant bits contain the counterpart edge's ID. + Tri0->ATri[EdgeNb0] = secondtri |(u32(EdgeNb1)<<30); + Tri1->ATri[EdgeNb1] = firsttri |(u32(EdgeNb0)<<30); + + return true; +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to find an edge in a tri, given two vertex references +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : vref0, vref1, the two vertex references +// Output : - +// Return : the edge number between 0 and 2, or 0xff if input refs are wrong +// Exception: - +// Remark : - +u8 AdjTriangle::FindEdge(u32 vref0, u32 vref1) +{ + u8 EdgeNb = 0xff; + if(VRef[0]==vref0 && VRef[1]==vref1) EdgeNb = 0; + else if(VRef[0]==vref1 && VRef[1]==vref0) EdgeNb = 0; + else if(VRef[0]==vref0 && VRef[2]==vref1) EdgeNb = 1; + else if(VRef[0]==vref1 && VRef[2]==vref0) EdgeNb = 1; + else if(VRef[1]==vref0 && VRef[2]==vref1) EdgeNb = 2; + else if(VRef[1]==vref1 && VRef[2]==vref0) EdgeNb = 2; + return EdgeNb; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to get the last reference given the first two +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : vref0, vref1, the two vertex references +// Output : - +// Return : the last reference, or 0xffffffff if input refs are wrong +// Exception: - +// Remark : - +u32 AdjTriangle::OppositeVertex(u32 vref0, u32 vref1) +{ + u32 Ref = 0xffffffff; + if(VRef[0]==vref0 && VRef[1]==vref1) Ref = VRef[2]; + else if(VRef[0]==vref1 && VRef[1]==vref0) Ref = VRef[2]; + else if(VRef[0]==vref0 && VRef[2]==vref1) Ref = VRef[1]; + else if(VRef[0]==vref1 && VRef[2]==vref0) Ref = VRef[1]; + else if(VRef[1]==vref0 && VRef[2]==vref1) Ref = VRef[0]; + else if(VRef[1]==vref1 && VRef[2]==vref0) Ref = VRef[0]; + return Ref; +} diff --git a/DSMeshConvert/cets-pterdiman/Adjacency.h b/DSMeshConvert/cets-pterdiman/Adjacency.h new file mode 100644 index 0000000..e9ebd8e --- /dev/null +++ b/DSMeshConvert/cets-pterdiman/Adjacency.h @@ -0,0 +1,81 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Source code for "Creating Efficient Triangle Strips" +// (C) 2000, Pierre Terdiman (p.terdiman@wanadoo.fr) +// +// Version is 2.0. +// +// Following adjacency structures have been successfully used to implement: +// - a triangle striper +// - a silhouette tracker [used for shadow volumes, occlusion culling, and glow!] +// - local search for collision detection on terrains +// - subdivision surfaces +// +// So that one IS useful.... +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef __ADJACENCY_H__ +#define __ADJACENCY_H__ +#include "../types.h" + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Class Adjacencies + // + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // MACROS + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + #define MAKE_ADJ_TRI(x) (x&0x3fffffff) + #define GET_EDGE_NB(x) (x>>30) + #define IS_BOUNDARY(x) (x==0xffffffff) + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Structures + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + struct AdjTriangle{ // Should be derived from a triangle structure + u32 VRef[3]; // Vertex-references + u32 ATri[3]; // Links/References of adjacent triangles. The 2 most significant bits contains + // the counterpart edge in the adjacent triangle. + u8 FindEdge(u32 vref0, u32 vref1); + u32 OppositeVertex(u32 vref0, u32 vref1); + }; + + struct AdjEdge{ + u32 Ref0; // Vertex reference + u32 Ref1; // Vertex reference + u32 FaceNb; // Owner face + }; + + struct ADJACENCIESCREATE{ + ADJACENCIESCREATE() { DFaces = 0; WFaces = 0; NbFaces = 0; } + u32 NbFaces; // #faces in source topo + u32* DFaces; // list of faces (dwords) or 0 + u16* WFaces; // list of faces (words) or 0 + }; + + class Adjacencies + { + private: + u32 mNbEdges; + u32 mCurrentNbFaces; + AdjEdge* mEdges; + + bool AddTriangle(u32 ref0, u32 ref1, u32 ref2); + bool AddEdge(u32 ref0, u32 ref1, u32 face); + bool UpdateLink(u32 firsttri, u32 secondtri, u32 ref0, u32 ref1); + u8 FindEdge(AdjTriangle* tri, u32 vref0, u32 vref1); + public: + Adjacencies(); + ~Adjacencies(); + + u32 mNbFaces; + AdjTriangle* mFaces; + + bool Init(ADJACENCIESCREATE& create); + bool CreateDatabase(); + }; + +#endif // __ADJACENCY_H__ diff --git a/DSMeshConvert/cets-pterdiman/CustomArray.cpp b/DSMeshConvert/cets-pterdiman/CustomArray.cpp new file mode 100644 index 0000000..4fbf38b --- /dev/null +++ b/DSMeshConvert/cets-pterdiman/CustomArray.cpp @@ -0,0 +1,1304 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Source code for "Creating Efficient Triangle Strips" +// (C) 2000, Pierre Terdiman (p.terdiman@wanadoo.fr) +// +// Version is 2.0. +// +// This is a versatile and customized import/export array class I use for a long time. +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Precompiled Header +//#include "Stdafx.h" +#include "CustomArray.h" +#include +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Constructor +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +CustomArray::CustomArray(unsigned long startsize, void* inputbuffer) : mNbPushedAddies(0), mNbAllocatedAddies(0), mBitCount(0), mBitMask(0), mAddresses(0), mCollapsed(0) +{ + // Initialize first export block + NewBlock(0, startsize); + + // Keep track of this first cell + mInitCell = mCurrentCell; + + // Fill first block with provided buffer, if needed + if(inputbuffer) memcpy(mCurrentCell->Item.Addy, inputbuffer, startsize); + + // Initialize mLastAddress so that it won't crash if the first thing you ever do is a PushAddress/PopAddressAndStore!! + mLastAddress = mCurrentCell->Item.Addy; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Constructor +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +CustomArray::CustomArray(const char* filename) : mNbPushedAddies(0), mNbAllocatedAddies(0), mBitCount(0), mBitMask(0), mAddresses(0), mCollapsed(0) +{ + // Catch the file's size to initialize first block + unsigned long StartSize = FileSize(filename); + if(!StartSize) StartSize=CUSTOMARRAY_BLOCKSIZE; + + // Initialize first export block + NewBlock(0, StartSize); + + // Keep track of this first cell + mInitCell = mCurrentCell; + + // Fill first block with file data + FILE* fp = fopen(filename, "rb"); + if(fp) + { + fread(mCurrentCell->Item.Addy, StartSize, 1, fp); + fclose(fp); + } + + // Initialize mLastAddress so that it won't crash if the first thing you ever do is a PushAddress/PopAddressAndStore!! + mLastAddress = mCurrentCell->Item.Addy; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Destructor +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +CustomArray::~CustomArray() +{ + // Free possible collapsed array + RELEASEARRAY(mCollapsed); + + // Free possible adress list + RELEASEARRAY(mAddresses); + + // Free linked list + CustomCell* CurCell = mInitCell; + while(CurCell) + { + CustomCell* Cell = CurCell; + CurCell = CurCell->NextCustomCell; + RELEASE(Cell); + } +} + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// MANAGEMENT METHODS +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to create and link a new block to previous ones. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : previouscell = the previous cell, or 0 if this is the first +// size = #bytes to allocate for the first cell +// Output : - +// Return : self-reference +// Exception: - +// Remark : 'size' is only used if previouscell is 0 (i.e. for the first cell) +CustomArray& CustomArray::NewBlock(CustomCell* previouscell, unsigned long size) +{ + // Create a new cell + CustomCell* Cell = new CustomCell; + + // If a previous cell exists, doubles the needed ram, else get default size + Cell->Item.Max = previouscell ? previouscell->Item.Max*2 : size; + + // Get some bytes for this cell + Cell->Item.Addy = (void*)new u8[Cell->Item.Max]; + Cell->Item.Size = 0; + + mCurrentCell = Cell; + + // Update linked list + if(previouscell) previouscell->NextCustomCell = mCurrentCell; + + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to check whether there's enough room in current block for expected datas, or not. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : bytesneeded = #expected bytes +// Output : - +// Return : self-reference +// Exception: - +// Remark : a new block is created if there's no more space left in current block. +CustomArray& CustomArray::CheckArray(unsigned long bytesneeded) +{ + unsigned long ExpectedSize = mCurrentCell->Item.Size + bytesneeded; + if(ExpectedSize > mCurrentCell->Item.Max) NewBlock(mCurrentCell); + // I assume there IS enough room in the new block for expected data. It should always be the case since 'bytesneeded' is not supposed to be larger than 8 + // (i.e. sizeof(double)) + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to export an array to disk. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : filename = the destination file's name. +// Output : - +// Return : true if success +// Exception: - +// Remark : - +bool CustomArray::ExportToDisk(const char* filename) +{ + FILE* fp = fopen(filename, "wb"); + if(!fp) return false; + ExportToDisk(fp); + fclose(fp); + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to export an array to disk. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : fp = the file pointer. +// Output : - +// Return : true if success +// Exception: - +// Remark : - +bool CustomArray::ExportToDisk(FILE* fp) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CustomCell* p = mInitCell; + + while(p->NextCustomCell) + { + // Save current cell + if(!SaveCell(p, fp)) return false; + // Go to next cell + p = p->NextCustomCell; + } + // Save last cell + if(!SaveCell(p, fp)) return false; + + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to write a single cell to disk. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : p = current cell. +// fp = file pointer. +// Output : - +// Return : true if success +// Exception: - +// Remark : - +bool CustomArray::SaveCell(CustomCell* p, FILE* fp) +{ + unsigned long BytesToWrite = p->Item.Size; + if(!BytesToWrite) return true; + if(fwrite(p->Item.Addy, 1, BytesToWrite, fp)!=BytesToWrite) return false; + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to get current #bytes stored. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : - +// Output : - +// Return : unsigned long = #bytes stored +// Exception: - +// Remark : - +unsigned long CustomArray::GetOffset() +{ + unsigned long Offset = 0; + CustomCell* p = mInitCell; + + while(p->NextCustomCell) + { + // Add offset from current cell + Offset+=p->Item.Size; + // Go to next cell + p = p->NextCustomCell; + } + // Add offset from last cell + Offset+=p->Item.Size; + + return(Offset); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to padd offset on a 8 bytes boundary. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : - +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Padd() +{ + // Fill possible remaining bits with 0 + EndBits(); + + unsigned long Offset = GetOffset(); + unsigned long NbPadd = Offset - (Offset & 7); + for(unsigned long i=0;iNextCustomCell) + { + // Link current cell + Addy = (char*)p->Item.Addy; + for(i=0;iItem.Size;i++) Store(*Addy++); + + // Go to next cell + p = p->NextCustomCell; + } + // Link last cell + Addy = (char*)p->Item.Addy; + for(i=0;iItem.Size;i++) Store(*Addy++); +*/ + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to collapse a CustomArray into a single continuous buffer. This invalidates all pushed addies. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : userbuffer = destination buffer (provided or not) +// Output : - +// Return : void* = destination buffer +// Exception: - +// Remark : if you provide your destination buffer original bytes are copied into it, then it's safe using them. +// if you don't, returned address is valid until the array's destructor is called. Beware of memory corruption... +void* CustomArray::Collapse(void* userbuffer) +{ + // Fill possible remaining bits with 0 + EndBits(); + + char* Addy; + CustomCell* p = mInitCell; + + if(!userbuffer) + { + RELEASEARRAY(mCollapsed); // Free possibly already collapsed array + unsigned long CurrentSize = GetOffset(); + mCollapsed = CurrentSize ? new u8[CurrentSize] : 0; + Addy = (char*)mCollapsed; + } + else + { + Addy = (char*)userbuffer; + } + + char* AddyCopy = Addy; + if(Addy) + { + while(p->NextCustomCell) + { + // Collapse current cell + memcpy(Addy, p->Item.Addy, p->Item.Size); + Addy+=p->Item.Size; + + // Go to next cell + p = p->NextCustomCell; + } + // Collapse last cell + memcpy(Addy, p->Item.Addy, p->Item.Size); + Addy+=p->Item.Size; + mNbPushedAddies=0; + } + return AddyCopy; +} + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// STORE METHODS +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a BOOL. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : Bo = BOOL to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : Warning! BOOL actually is an int. Converted to long. +CustomArray& CustomArray::Store(BOOL Bo) +{ + // Fill possible remaining bits with 0 + EndBits(); + + long b = (long)Bo; + + CheckArray(sizeof(long)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + long* Current = (long*)CurrentAddy; + *Current=b; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(long); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a bool. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : Bo = bool to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : Converted to char. +CustomArray& CustomArray::Store(bool Bo) +{ + // Fill possible remaining bits with 0 + EndBits(); + + char b = Bo ? 1 : 0; + + CheckArray(sizeof(char)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + char* Current = (char*)CurrentAddy; + *Current=b; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(char); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a char. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : b = char to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(char b) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CheckArray(sizeof(char)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + char* Current = (char*)CurrentAddy; + *Current=b; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(char); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store an unsigned char. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : b = unsigned char to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(unsigned char b) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CheckArray(sizeof(unsigned char)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + unsigned char* Current = (unsigned char*)CurrentAddy; + *Current=b; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(unsigned char); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a short. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : w = short to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(short w) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CheckArray(sizeof(short)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + short* Current = (short*)CurrentAddy; + *Current=w; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(short); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store an unsigned short. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : w = unsigned short to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(unsigned short w) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CheckArray(sizeof(unsigned short)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + unsigned short* Current = (unsigned short*)CurrentAddy; + *Current=w; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(unsigned short); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a long. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = long to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(long d) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CheckArray(sizeof(long)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + long* Current = (long*)CurrentAddy; + *Current=d; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(long); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store an unsigned long. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = unsigned long to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(unsigned long d) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CheckArray(sizeof(unsigned long)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + unsigned long* Current = (unsigned long*)CurrentAddy; + *Current=d; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(unsigned long); + return *this; +} +/* +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store an int. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = int to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(int d) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CheckArray(sizeof(int)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + int* Current = (int*)CurrentAddy; + *Current=d; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(int); + return *this; +} +*/ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store an unsigned int. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = unsigned int to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(unsigned int d) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CheckArray(sizeof(unsigned int)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + unsigned int* Current = (unsigned int*)CurrentAddy; + *Current=d; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(unsigned int); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a float. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : f = float to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(float f) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CheckArray(sizeof(float)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + float* Current = (float*)CurrentAddy; + *Current=f; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(float); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a double. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : f = double to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(double f) +{ + // Fill possible remaining bits with 0 + EndBits(); + + CheckArray(sizeof(double)); + + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + double* Current = (double*)CurrentAddy; + *Current=f; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(double); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a string. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : String = the string to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::Store(const char *String) +{ + // Fill possible remaining bits with 0 + EndBits(); + + for(unsigned long i=0;iItem.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + char* Current = (char*)CurrentAddy; + *Current=Code; + mCurrentCell->Item.Size+=sizeof(char); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a BOOL in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : Bo = the BOOL to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(BOOL Bo) +{ + char Text[256]; + sprintf(Text, "%d", (long)Bo); + StoreASCII((const char*)Text); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a bool in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : Bo = the bool to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(bool Bo) +{ + if(Bo) StoreASCII((const char*)"true"); + else StoreASCII((const char*)"false"); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a char in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : b = the char to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(char b) +{ + char Text[256]; + sprintf(Text, "%d", b); + StoreASCII((const char*)Text); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store an unsigned char in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : b = the unsigned char to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(unsigned char b) +{ + char Text[256]; + sprintf(Text, "%u", b); + StoreASCII((const char*)Text); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a short in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : w = the short to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(short w) +{ + char Text[256]; + sprintf(Text, "%d", w); + StoreASCII((const char*)Text); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store an unsigned short in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : w = the unsigned short to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(unsigned short w) +{ + char Text[256]; + sprintf(Text, "%u", w); + StoreASCII((const char*)Text); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a long in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = the long to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(long d) +{ + char Text[256]; + sprintf(Text, "%d", d); + StoreASCII((const char*)Text); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store an unsigned long in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = the unsigned long to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(unsigned long d) +{ + char Text[256]; + sprintf(Text, "%u", d); + StoreASCII((const char*)Text); + return *this; +} +/* +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store an int in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = the int to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(int d) +{ + char Text[256]; + sprintf(Text, "%d", d); + StoreASCII((const char*)Text); + return *this; +} +*/ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store an unsigned int in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = the unsigned int to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(unsigned int d) +{ + char Text[256]; + sprintf(Text, "%u", d); + StoreASCII((const char*)Text); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a float in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : f = the float to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(float f) +{ + char Text[256]; + sprintf(Text, "%f", f); + StoreASCII((const char*)Text); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a double in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : f = the double to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(double f) +{ + char Text[256]; + sprintf(Text, "%f", f); + StoreASCII((const char*)Text); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a string in ASCII. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : String = the string to store. +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreASCII(const char *String) +{ + // Fill possible remaining bits with 0 + EndBits(); + + for(unsigned long i=0;imNbAllocatedAddies) + { + // Here we must resize. We get twice as much bytes as already allocated in order to minimize total #resizes. + u32 NewSize = mNbAllocatedAddies ? mNbAllocatedAddies * 2 : 1; + + // Create new buffer... + void** Addresses = new void*[NewSize]; + if(!Addresses) return false; + + // ...copy & release old one to new one if old one exists... + if(mNbAllocatedAddies) + { + memcpy(Addresses, mAddresses, mNbAllocatedAddies * sizeof(void*)); + RELEASEARRAY(mAddresses); + } + + // ...and set new members. + mAddresses = Addresses; + mNbAllocatedAddies = NewSize; + } + + // Save last address + mAddresses[mNbPushedAddies++] = mLastAddress; + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store a BOOL where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : Bo = the BOOL to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(BOOL Bo) +{ + if(mNbPushedAddies) + { + BOOL* Addy = (BOOL*)mAddresses[--mNbPushedAddies]; + *Addy=Bo; + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store a bool where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : Bo = the bool to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(bool Bo) +{ + if(mNbPushedAddies) + { + char* Addy = (char*)mAddresses[--mNbPushedAddies]; + *Addy=(char)Bo; + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store a char where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : b = the char to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(char b) +{ + if(mNbPushedAddies) + { + char* Addy = (char*)mAddresses[--mNbPushedAddies]; + *Addy=b; + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store an unsigned char where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : b = the unsigned char to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(unsigned char b) +{ + if(mNbPushedAddies) + { + unsigned char* Addy = (unsigned char*)mAddresses[--mNbPushedAddies]; + *Addy=b; + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store a short where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : w = the short to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(short w) +{ + if(mNbPushedAddies) + { + short* Addy = (short*)mAddresses[--mNbPushedAddies]; + *Addy=w; + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store an unsigned short where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : w = the unsigned short to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(unsigned short w) +{ + if(mNbPushedAddies) + { + unsigned short* Addy = (unsigned short*)mAddresses[--mNbPushedAddies]; + *Addy=w; + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store a long where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = the long to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(long d) +{ + if(mNbPushedAddies) + { + long* Addy = (long*)mAddresses[--mNbPushedAddies]; + *Addy=d; + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store an unsigned long where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = the unsigned long to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(unsigned long d) +{ + if(mNbPushedAddies) + { + unsigned long* Addy = (unsigned long*)mAddresses[--mNbPushedAddies]; + *Addy=d; + } + return *this; +} +/* +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store an int where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = the int to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(int d) +{ + if(mNbPushedAddies) + { + int* Addy = (int*)mAddresses[--mNbPushedAddies]; + *Addy=d; + } + return *this; +} +*/ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store an unsigned int where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : d = the unsigned int to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(unsigned int d) +{ + if(mNbPushedAddies) + { + unsigned int* Addy = (unsigned int*)mAddresses[--mNbPushedAddies]; + *Addy=d; + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store a float where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : f = the float to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(float f) +{ + if(mNbPushedAddies) + { + float* Addy = (float*)mAddresses[--mNbPushedAddies]; + *Addy=f; + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to pop an address and store a double where the poped address tells. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : f = the double to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::PopAddressAndStore(double f) +{ + if(mNbPushedAddies) + { + double* Addy = (double*)mAddresses[--mNbPushedAddies]; + *Addy=f; + } + return *this; +} + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// BIT STORAGE METHODS +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to store a bit. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : bool = the bit to store +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::StoreBit(bool bit) +{ + mBitMask<<=1; + if(bit) mBitMask |= 1; + mBitCount++; + if(mBitCount==8) + { + mBitCount = 0; + Store(mBitMask); + mBitMask = 0; + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to padd bits on a byte. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : - +// Output : - +// Return : self-reference +// Exception: - +// Remark : - +CustomArray& CustomArray::EndBits() +{ + while(mBitCount) StoreBit(false); + return *this; +} + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// READ METHODS +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +char CustomArray::GetByte() +{ + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + char* Current = (char*)CurrentAddy; + char result = *Current; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(char); + return result; +} + +short CustomArray::GetWord() +{ + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + short* Current = (short*)CurrentAddy; + short result = *Current; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(short); + return result; +} + +long CustomArray::GetDword() +{ + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + long* Current = (long*)CurrentAddy; + long result = *Current; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(long); + return result; +} + +float CustomArray::GetFloat() +{ + char* CurrentAddy = (char*)mCurrentCell->Item.Addy; + CurrentAddy+=mCurrentCell->Item.Size; + + float* Current = (float*)CurrentAddy; + float result = *Current; + mLastAddress = (void*)Current; + mCurrentCell->Item.Size+=sizeof(float); + return result; +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// HELP METHODS +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to get a file length. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : name = file name +// Output : - +// Return : u32 = size in bytes, or 0 if file doesn't exist +// Exception: - +// Remark : - +#ifndef SEEK_END +#define SEEK_END 2 +#endif +u32 CustomArray::FileSize(const char* name) +{ + FILE* File = fopen(name, "rb"); + if (!File) return 0; + fseek(File, 0, SEEK_END); + u32 eof_ftell = ftell(File); + fclose(File); + return eof_ftell; +} + diff --git a/DSMeshConvert/cets-pterdiman/CustomArray.h b/DSMeshConvert/cets-pterdiman/CustomArray.h new file mode 100644 index 0000000..2c621a1 --- /dev/null +++ b/DSMeshConvert/cets-pterdiman/CustomArray.h @@ -0,0 +1,291 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Source code for "Creating Efficient Triangle Strips" +// (C) 2000, Pierre Terdiman (p.terdiman@wanadoo.fr) +// +// Version is 2.0. +// +// This is a versatile and customized import/export array class I use for a long time. +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Notes : +// +// CustomArray is a special array class especially designed for import/export goals, even if you can use it in many other ways. +// Here are some basic usages and code examples: +// +// 1) Saving heterogeneous data to disk +// +// Say you want to create a chunk-based file (e.g. a .3DS one). Such files may contain a chunk type (e.g. "FACE", i.e. a string) followed by +// chars or ints (e.g. vertex references) or floats (e.g. vertices). Saving such a file may be painful, and is usually done with an ugly list +// of putc/fputc. It also can be done with a single fwrite, but you must have stored your heterogeneous data beforehand, hence usually dealing +// with multiple pointers (e.g. a char*, an int*, a float*...) Well, that's ugly. With the CustomArray class you can solve this problem in an +// elegant way, with the following code: +// +// CustomArray Array; // constructor does all the painful stuff for you, destructor frees everything as well +// +// // Store heterogeneous data in any order... +// Array.Store((char)1); +// Array.Store(10.0f); +// Array.Store((long)1); +// Array.Store("Test"); +// +// // ...and just save to disk +// Array.ExportToDisk("c:\\datas.bin"); +// +// Saved file is a linear binary file, made of following bytes: +// - 01 +// - 10.0 in float +// - 00 00 00 01 (or 01 00 00 00, depends on your computer's little/big endian way of dealing with data) +// - the string "Test" (not ended by a 0 character) +// +// And that's all. Very easy to use, and you don't have to know how many bytes you'll need. This is very useful when packing a file for example, +// as explained in the second example. +// +// +// 2) Packing a buffer +// +// Say you want to encode a buffer with an arithmetic coder, and your encoder gives you one packed byte at a time. You don't know the final packed size, +// but you don't need it if you use a CustomArray. +// +// CustomArray Array; +// int EncodedByte; +// +// do +// { +// EncodedByte = EncodeSymbol(); // Get next packed byte or EOF (-1) +// if(EncodedByte!=EOF) Array.Store(EncodedByte); // Save packed byte +// }while(EncodedByte!=EOF); +// +// Array.ExportToDisk("c:\\packed.bin"); // Save packed file +// +// +// You even can store bits in your CustomArray, with the StoreBit method. Call the StoreBit method 8 times, and a new byte will be added to the array. +// If you call StoreBit, say 6 times, and then call a standard Store method, 2 extra bits are automatically added to padd the address on a byte boundary. +// +// +// Now let's say you want your saved file to begin with the size of the packed data. (you could take the file's length, but imagine the packed data +// is part of a bigger file) As you don't know the final packed size before actually having packed it, this is painful: you must leave room for the +// final packed size at the start of the file, and fill it at the end of the process. If you save your file with some putc/fputc this is a real pain. +// The CustomArray class has a neat way of dealing with this problem: the PushAddress and PopAddressAndStore methods. Let's modify the example code: +// +// CustomArray Array; +// int EncodedByte; +// long PackedSize = 0; +// +// Array.Store((long)0).PushAddress(); // Leave room for a long, save the address +// +// do +// { +// EncodedByte = EncodeSymbol(); // Get next packed byte or EOF (-1) +// if(EncodedByte!=EOF) Array.Store(EncodedByte); // Save packed byte +// if(EncodedByte!=EOF) PackedSize++; // Update packed size +// }while(EncodedByte!=EOF); +// +// Array.PopAddressAndStore(PackedSize); // Store packed size where the PushAddress has been done. +// +// Array.ExportToDisk("c:\\packed.bin"); // Save packed file +// +// Of course you can push more than one address (as many as you want): +// +// Array.Store((long)0).PushAddress(); // Push address 1 on the stack +// Array.Store((long)0).PushAddress(); // Push address 2 on the stack +// Array.Store((long)0).PushAddress(); // Push address 3 on the stack +// ... +// Array.Store((long)0).PushAddress(); // Push address N on the stack +// +// Array.PopAddressAndStore((long)1); // Pop address N and store value 1 +// ... +// Array.PopAddressAndStore((long)N-2); // Pop address 3 and store value N-2 +// Array.PopAddressAndStore((long)N-1); // Pop address 2 and store value N-1 +// Array.PopAddressAndStore((long)N); // Pop address 1 and store value N +// +// +// 3) Creating a log file +// +// The StoreASCII methods provide a very easy way to create log files (e.g. for debug purpose). Example: +// +// Array.StoreASCII(10.0f); // Store the string "10.0" +// Array.StoreASCII((long)1234); // Store the string "1234" +// Array.StoreASCII(Boolean); // Store the string "true" or "false", depends on the boolean value +// +// Say "Score" is an unsigned long whose value is 500: +// Array.StoreASCII("Your score is ").StoreASCII(Score).StoreASCII(".\n"); // Store the string "Your score is 500." (followed by a carriage return) +// +// ...and so on... +// +// +// 4) Getting the data back +// +// This is easily done with the Collapse method, which creates a linear buffer filled with all stored data. +// +// +// 5) Importing data +// +// You can initialize a CustomArray with your own buffer, or even with a file: +// +// CustomArray Array("c:\\data.bin"); // Read the whole file data.bin, fill the array with it +// +// MyByte = Array.GetByte(); // Get the first byte of the array, move the inner pointer one byte beyond +// MyFloat = Array.GetFloat(); // Get the next 4 bytes of the array, read as a float, move the inner pointer 4 bytes beyond +// ... +// +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// History : 01/15/99: first version for Irion MAX Plug-In +// 02/04/99: ASCII support added +// 02/05/99: GetOffset(), Padd(), LinkTo(CustomArray* array) added +// 03/xx/99: Collapse() added, self-references added +// 03/xx/99: BOOL definition added in header if not defined yet, addies-stack mecanism added +// 04/xx/99: "push" renamed to "store", for a more coherent name since people were expecting a "pop" method to be used............. +// 04/xx/99: BOOL handled as a long. Use bool (in lower case) for a real boolean value. +// 05/xx/99: heap size is now 4Kb, and allocated ram is doubled for each new block. The more you eat, the more ram you're given. +// 09/xx/99: bit-storage methods added (StoreBit, EndBits) for data-compression +// 29/10/99: bug fixed: mLastAddress was not initialized. Was crashing if the first thing done was a PushAddress. Well, a PushAddress should NOT +// be the first thing done anyway! +// 04/11/99: address stack is now resizable. +// 06/01/00: local memory manager and local error codes removed, CustomArray class added to IrionBasics +// +// More notes: - always keep in mind that an CustomArray eats CUSTOMARRAY_BLOCKSIZE bytes when initialized, even if you don't use it later. +// That's why you may use this class for very specific reasons, or even change this #define to match your own needs. +// +// - I know I could've used templates. +// +// - THIS IS NOT THREAD-SAFE. +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Include Guard +#ifndef __CUSTOMARRAY_H__ +#define __CUSTOMARRAY_H__ + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// MACROS + +// Define BOOL if needed +#ifndef BOOL +typedef int BOOL; +#endif +#include "../types.h" +#include +#define CUSTOMARRAY_BLOCKSIZE (4*1024) // 4 Kb => heap size +#define RELEASEARRAY(x) { if ( x ) delete[] (x); } +#define RELEASE(x) { if ( x ) delete (x); } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // CustomArray Class Definition + // + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +class CustomArray +{ + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Structures and enums + struct CustomBlock{ + CustomBlock() { Addy = 0; } + ~CustomBlock() { RELEASEARRAY(Addy); } + void* Addy; // Stored data + unsigned long Size; // Length of stored data + unsigned long Max; // Heap size + }; + + struct CustomCell{ + CustomCell() { NextCustomCell = 0; } + + struct CustomCell* NextCustomCell; + CustomBlock Item; + }; + +private: + CustomCell* mCurrentCell; // Current block cell + CustomCell* mInitCell; // First block cell + + void* mCollapsed; // Possible collapsed buffer + void** mAddresses; // Stack to store addresses + void* mLastAddress; // Last address used in current block cell + unsigned short mNbPushedAddies; // #saved addies + unsigned short mNbAllocatedAddies; // #allocated addies + unsigned char mBitCount; + unsigned char mBitMask; + + // Management methods + CustomArray& CheckArray(unsigned long bytesneeded); + CustomArray& NewBlock(CustomCell* previouscell, unsigned long size=0); + bool SaveCell(CustomCell* p, FILE* fp); + CustomArray& StoreASCIICode(char code); + // Helpers + u32 FileSize(const char* name); +public: + // Constructor / destructor + CustomArray(unsigned long startsize=CUSTOMARRAY_BLOCKSIZE, void* inputbuffer=0); + CustomArray(const char* filename); + ~CustomArray(); + + // Store methods + CustomArray& StoreBit(bool bit); + CustomArray& EndBits(); + + CustomArray& Store(BOOL Bo); + CustomArray& Store(bool Bo); + CustomArray& Store(char b); + CustomArray& Store(unsigned char b); + CustomArray& Store(short w); + CustomArray& Store(unsigned short w); + CustomArray& Store(long d); + CustomArray& Store(unsigned long d); +// CustomArray& Store(int d); + CustomArray& Store(unsigned int d); + CustomArray& Store(float f); + CustomArray& Store(double f); + CustomArray& Store(const char* String); + + CustomArray& StoreASCII(BOOL Bo); + CustomArray& StoreASCII(bool Bo); + CustomArray& StoreASCII(char b); + CustomArray& StoreASCII(unsigned char b); + CustomArray& StoreASCII(short w); + CustomArray& StoreASCII(unsigned short w); + CustomArray& StoreASCII(long d); + CustomArray& StoreASCII(unsigned long d); +// CustomArray& StoreASCII(int d); + CustomArray& StoreASCII(unsigned int d); + CustomArray& StoreASCII(float f); + CustomArray& StoreASCII(double f); + CustomArray& StoreASCII(const char* String); + + // Management methods + bool ExportToDisk(const char* FileName); + bool ExportToDisk(FILE* fp); + + unsigned long GetOffset(); + CustomArray& Padd(); + CustomArray& LinkTo(CustomArray* array); + void* GetAddress() { char* CurrentAddy = (char*)mCurrentCell->Item.Addy; CurrentAddy+=mCurrentCell->Item.Size; return CurrentAddy; } + void* Collapse(void* userbuffer=0); + + // Address methods + bool PushAddress(); + CustomArray& PopAddressAndStore(BOOL Bo); + CustomArray& PopAddressAndStore(bool Bo); + CustomArray& PopAddressAndStore(char b); + CustomArray& PopAddressAndStore(unsigned char b); + CustomArray& PopAddressAndStore(short w); + CustomArray& PopAddressAndStore(unsigned short w); + CustomArray& PopAddressAndStore(long d); + CustomArray& PopAddressAndStore(unsigned long d); +// CustomArray& PopAddressAndStore(int d); + CustomArray& PopAddressAndStore(unsigned int d); + CustomArray& PopAddressAndStore(float f); + CustomArray& PopAddressAndStore(double f); + + // Read methods + char GetByte(); + short GetWord(); + long GetDword(); + float GetFloat(); +}; + +#endif // __CUSTOMARRAY_H__ diff --git a/DSMeshConvert/cets-pterdiman/RevisitedRadix.cpp b/DSMeshConvert/cets-pterdiman/RevisitedRadix.cpp new file mode 100644 index 0000000..c983c37 --- /dev/null +++ b/DSMeshConvert/cets-pterdiman/RevisitedRadix.cpp @@ -0,0 +1,423 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Source code for "Radix Sort Revisited" +// (C) 2000, Pierre Terdiman (p.terdiman@wanadoo.fr) +// +// Works with IEEE floats only. +// Version is 1.1. +// +// This is my new radix routine: +// - it uses indices and doesn't recopy the values anymore, hence wasting less ram +// - it creates all the histograms in one run instead of four +// - it sorts words faster than dwords and bytes faster than words +// - it correctly sorts negative floats by patching the offsets +// - it automatically takes advantage of temporal coherence +// - multiple keys support is a side effect of temporal coherence +// - it may be worth recoding in asm... +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/* +To do: + - add an offset parameter between two input values (avoid some data recopy sometimes) + - unroll ? asm ? + - warning when skipping last pass +*/ + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Precompiled Header +//#include "Stdafx.h" +#include "RevisitedRadix.h" +#include +#define RELEASEARRAY(x) { if ( x ) delete[] (x); } + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// RadixSorter Class Implementation +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Constructor +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +RadixSorter::RadixSorter() +{ + // Initialize + mIndices = 0; + mIndices2 = 0; + mCurrentSize = 0; + + // Allocate input-independent ram + mHistogram = new u32[256*4]; + mOffset = new u32[256]; + + // Initialize indices + ResetIndices(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Destructor +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +RadixSorter::~RadixSorter() +{ + // Release everything + RELEASEARRAY(mOffset); + RELEASEARRAY(mHistogram); + RELEASEARRAY(mIndices2); + RELEASEARRAY(mIndices); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Main sort routine +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : input, a list of integer values to sort +// nb, #values to sort +// signedvalues, true to handle negative values, false if you know your input buffer only contains positive values +// Output : mIndices, a list of indices in sorted order, i.e. in the order you may process your data +// Return : Self-Reference +// Exception: - +// Remark : this one is for integer values +RadixSorter& RadixSorter::Sort(u32* input, u32 nb, bool signedvalues) +{ + // Resize lists if needed + if(nb>mCurrentSize) + { + // Free previously used ram + RELEASEARRAY(mIndices2); + RELEASEARRAY(mIndices); + + // Get some fresh one + mIndices = new u32[nb]; + mIndices2 = new u32[nb]; + mCurrentSize = nb; + + // Initialize indices so that the input buffer is read in sequential order + ResetIndices(); + } + + // Clear counters + memset(mHistogram, 0, 256*4*sizeof(u32)); + + // Create histograms (counters). Counters for all passes are created in one run. + // Pros: read input buffer once instead of four times + // Cons: mHistogram is 4Kb instead of 1Kb + // We must take care of signed/unsigned values for temporal coherence.... I just + // have 2 code paths even if just a single opcode changes. Self-modifying code, someone? + + // Temporal coherence + bool AlreadySorted = true; // Optimism... + u32* Indices = mIndices; + // Prepare to count + u8* p = (u8*)input; + u8* pe = &p[nb*4]; + u32* h0= &mHistogram[0]; // Histogram for first pass (LSB) + u32* h1= &mHistogram[256]; // Histogram for second pass + u32* h2= &mHistogram[512]; // Histogram for third pass + u32* h3= &mHistogram[768]; // Histogram for last pass (MSB) + if(!signedvalues) + { + // Temporal coherence + u32 PrevVal = input[mIndices[0]]; + + while(p!=pe) + { + // Temporal coherence + u32 Val = input[*Indices++]; // Read input buffer in previous sorted order + if(ValmCurrentSize) + { + // Free previously used ram + RELEASEARRAY(mIndices2); + RELEASEARRAY(mIndices); + + // Get some fresh one + mIndices = new u32[nb]; + mIndices2 = new u32[nb]; + mCurrentSize = nb; + + // Initialize indices so that the input buffer is read in sequential order + ResetIndices(); + } + + // Clear counters + memset(mHistogram, 0, 256*4*sizeof(u32)); + + // Create histograms (counters). Counters for all passes are created in one run. + // Pros: read input buffer once instead of four times + // Cons: mHistogram is 4Kb instead of 1Kb + // Floating-point values are always supposed to be signed values, so there's only one code path there. + // Please note the floating point comparison needed for temporal coherence! Although the resulting asm code + // is dreadful, this is surprisingly not such a performance hit - well, I suppose that's a big one on first + // generation Pentiums....We can't make comparison on integer representations because, as Chris said, it just + // wouldn't work with mixed positive/negative values.... + { + // 3 lines for temporal coherence support + float PrevVal = input2[mIndices[0]]; + bool AlreadySorted = true; // Optimism... + u32* Indices = mIndices; + + // Prepare to count + u8* p = (u8*)input; + u8* pe = &p[nb*4]; + u32* h0= &mHistogram[0]; // Histogram for first pass (LSB) + u32* h1= &mHistogram[256]; // Histogram for second pass + u32* h2= &mHistogram[512]; // Histogram for third pass + u32* h3= &mHistogram[768]; // Histogram for last pass (MSB) + while(p!=pe) + { + // Temporal coherence + float Val = input2[*Indices++]; // Read input buffer in previous sorted order + if(Val>24; // Radix byte, same as above. AND is useless here (u32). + // ### cmp to be killed. Not good. Later. + if(Radix<128) mIndices2[mOffset[Radix]++] = mIndices[i]; // Number is positive, same as above + else mIndices2[--mOffset[Radix]] = mIndices[i]; // Number is negative, flip the sorting order + } + } + + // Swap pointers for next pass + u32* Tmp = mIndices; + mIndices = mIndices2; + mIndices2 = Tmp; + } + } + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to reset the indices. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : - +// Output : mIndices is reset +// Return : Self-Reference +// Exception: - +// Remark : - +RadixSorter& RadixSorter::ResetIndices() +{ + for(u32 i=0;i +#include "RevisitedRadix.h" +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Striper Class Implementation +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Constructor +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +Striper::Striper() : mAdj(0), mTags(0), mStripLengths(0), mStripRuns(0), mSingleStrip(0) +{ +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Destructor +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +Striper::~Striper() +{ + FreeUsedRam(); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to free possibly used ram +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : - +// Output : - +// Return : Self-reference +// Exception: - +// Remark : - +Striper& Striper::FreeUsedRam() +{ + RELEASE(mSingleStrip); + RELEASE(mStripRuns); + RELEASE(mStripLengths); + RELEASEARRAY(mTags); + RELEASE(mAdj); + return *this; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to initialize the striper +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : create, the creation structure +// Output : - +// Return : true if success +// Exception: - +// Remark : - +bool Striper::Init(STRIPERCREATE& create) +{ + // Release possibly already used ram + FreeUsedRam(); + + // Create adjacencies + { + mAdj = new Adjacencies; + if(!mAdj) return false; + + ADJACENCIESCREATE ac; + ac.NbFaces = create.NbFaces; + ac.DFaces = create.DFaces; + ac.WFaces = create.WFaces; + bool Status = mAdj->Init(ac); + if(!Status) { RELEASE(mAdj); return false; } + + Status = mAdj->CreateDatabase(); + if(!Status) { RELEASE(mAdj); return false; } + + mAskForWords = create.AskForWords; + mOneSided = create.OneSided; + mSGIAlgorithm = create.SGIAlgorithm; + mConnectAllStrips = create.ConnectAllStrips; + } + + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to create the triangle strips +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : result, the result structure +// Output : - +// Return : true if success +// Exception: - +// Remark : - +bool Striper::Compute(STRIPERRESULT& result) +{ + // You must call Init() first + if(!mAdj) return false; + + // Get some bytes + mStripLengths = new CustomArray; if(!mStripLengths) return false; + mStripRuns = new CustomArray; if(!mStripRuns) return false; + mTags = new bool[mAdj->mNbFaces]; if(!mTags) return false; + u32* Connectivity = new u32[mAdj->mNbFaces]; if(!Connectivity) return false; + + // mTags contains one bool/face. True=>the face has already been included in a strip + memset(mTags, 0, mAdj->mNbFaces*sizeof(bool)); + + // Compute the number of connections for each face. This buffer is further recycled into + // the insertion order, ie contains face indices in the order we should treat them + memset(Connectivity, 0, mAdj->mNbFaces*sizeof(u32)); + if(mSGIAlgorithm) + { + // Compute number of adjacent triangles for each face + for(u32 i=0;imNbFaces;i++) + { + AdjTriangle* Tri = &mAdj->mFaces[i]; + if(!IS_BOUNDARY(Tri->ATri[0])) Connectivity[i]++; + if(!IS_BOUNDARY(Tri->ATri[1])) Connectivity[i]++; + if(!IS_BOUNDARY(Tri->ATri[2])) Connectivity[i]++; + } + + // Sort by number of neighbors + RadixSorter RS; + u32* Sorted = RS.Sort(Connectivity, mAdj->mNbFaces).GetIndices(); + + // The sorted indices become the order of insertion in the strips + memcpy(Connectivity, Sorted, mAdj->mNbFaces*sizeof(u32)); + } + else + { + // Default order + for(u32 i=0;imNbFaces;i++) Connectivity[i] = i; + } + + mNbStrips = 0; // #strips created + u32 TotalNbFaces = 0; // #faces already transformed into strips + u32 Index = 0; // Index of first face + + while(TotalNbFaces!=mAdj->mNbFaces) + { + // Look for the first face [could be optimized] + while(mTags[Connectivity[Index]]) Index++; + u32 FirstFace = Connectivity[Index]; + + // Compute the three possible strips from this face and take the best + TotalNbFaces += ComputeBestStrip(FirstFace); + + // Let's wrap + mNbStrips++; + } + + // Free now useless ram + RELEASEARRAY(Connectivity); + RELEASEARRAY(mTags); + + // Fill result structure and exit + result.NbStrips = mNbStrips; + result.StripLengths = (u32*) mStripLengths ->Collapse(); + result.StripRuns = mStripRuns ->Collapse(); + + if(mConnectAllStrips) ConnectAllStrips(result); + + return true; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to compute the three possible strips starting from a given face +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : face, the first face +// Output : - +// Return : u32, the #faces included in the strip +// Exception: - +// Remark : mStripLengths and mStripRuns are filled with strip data +u32 Striper::ComputeBestStrip(u32 face) +{ + u32* Strip[3]; // Strips computed in the 3 possible directions + u32* Faces[3]; // Faces involved in the 3 previous strips + u32 Length[3]; // Lengths of the 3 previous strips + + u32 FirstLength[3]; // Lengths of the first parts of the strips are saved for culling + + // Starting references + u32 Refs0[3]; + u32 Refs1[3]; + Refs0[0] = mAdj->mFaces[face].VRef[0]; + Refs1[0] = mAdj->mFaces[face].VRef[1]; + + // Bugfix by Eric Malafeew! + Refs0[1] = mAdj->mFaces[face].VRef[2]; + Refs1[1] = mAdj->mFaces[face].VRef[0]; + + Refs0[2] = mAdj->mFaces[face].VRef[1]; + Refs1[2] = mAdj->mFaces[face].VRef[2]; + + // Compute 3 strips + for(u32 j=0;j<3;j++) + { + // Get some bytes for the strip and its faces + Strip[j] = new u32[mAdj->mNbFaces+2+1+2]; // max possible length is NbFaces+2, 1 more if the first index gets replicated + Faces[j] = new u32[mAdj->mNbFaces+2]; + memset(Strip[j], 0xff, (mAdj->mNbFaces+2+1+2)*sizeof(u32)); + memset(Faces[j], 0xff, (mAdj->mNbFaces+2)*sizeof(u32)); + + // Create a local copy of the tags + bool* Tags = new bool[mAdj->mNbFaces]; + memcpy(Tags, mTags, mAdj->mNbFaces*sizeof(bool)); + + // Track first part of the strip + Length[j] = TrackStrip(face, Refs0[j], Refs1[j], &Strip[j][0], &Faces[j][0], Tags); + + // Save first length for culling + FirstLength[j] = Length[j]; +// if(j==1) FirstLength[j]++; // ...because the first face is written in reverse order for j==1 + + // Reverse first part of the strip + for(u32 i=0;i Longest) { Longest = Length[1]; Best = 1; } + if(Length[2] > Longest) { Longest = Length[2]; Best = 2; } + + u32 NbFaces = Longest-2; + + // Update global tags + for(u32 j=0;jStore((u16)Ref); // Saves word reference + else mStripRuns->Store(Ref); // Saves dword reference + } + mStripLengths->Store(Longest); + + // Free local ram + for(u32 j=0;j<3;j++) + { + RELEASEARRAY(Faces[j]); + RELEASEARRAY(Strip[j]); + } + + // Returns #faces involved in the strip + return NbFaces; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to extend a strip in a given direction, starting from a given face +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : face, the starting face +// oldest, middle, the two first indices of the strip == a starting edge == a direction +// Output : strip, a buffer to store the strip +// faces, a buffer to store the faces of the strip +// tags, a buffer to mark the visited faces +// Return : u32, the strip length +// Exception: - +// Remark : - +u32 Striper::TrackStrip(u32 face, u32 oldest, u32 middle, u32* strip, u32* faces, bool* tags) +{ + u32 Length = 2; // Initial length is 2 since we have 2 indices in input + strip[0] = oldest; // First index of the strip + strip[1] = middle; // Second index of the strip + + bool DoTheStrip = true; + while(DoTheStrip) + { + u32 Newest = mAdj->mFaces[face].OppositeVertex(oldest, middle); // Get the third index of a face given two of them + strip[Length++] = Newest; // Extend the strip,... + *faces++ = face; // ...keep track of the face,... + tags[face] = true; // ...and mark it as "done". + + u8 CurEdge = mAdj->mFaces[face].FindEdge(middle, Newest); // Get the edge ID... + + u32 Link = mAdj->mFaces[face].ATri[CurEdge]; // ...and use it to catch the link to adjacent face. + if(IS_BOUNDARY(Link)) DoTheStrip = false; // If the face is no more connected, we're done... + else + { + face = MAKE_ADJ_TRI(Link); // ...else the link gives us the new face index. + if(tags[face]) DoTheStrip=false; // Is the new face already done? + } + oldest = middle; // Shift the indices and wrap + middle = Newest; + } + return Length; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// A method to link all strips in a single one. +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Input : result, the result structure +// Output : the result structure is updated +// Return : true if success +// Exception: - +// Remark : - +bool Striper::ConnectAllStrips(STRIPERRESULT& result) +{ + mSingleStrip = new CustomArray; + if(!mSingleStrip) return false; + + mTotalLength = 0; + u16* wrefs = mAskForWords ? (u16*)result.StripRuns : 0; + u32* drefs = mAskForWords ? 0 : (u32*)result.StripRuns; + + // Loop over strips and link them together + for(u32 k=0;kStore((u16)LastRef).Store((u16)FirstRef); + else mSingleStrip->Store(LastRef).Store(FirstRef); + mTotalLength += 2; + + // Linking two strips may flip their culling. If the user asked for single-sided strips we must fix that + if(mOneSided) + { + // Culling has been inverted only if mTotalLength is odd + if(mTotalLength&1) + { + // We can fix culling by replicating the first vertex once again... + u32 SecondRef = drefs ? drefs[1] : (u32)wrefs[1]; + if(FirstRef!=SecondRef) + { + if(mAskForWords) mSingleStrip->Store((u16)FirstRef); + else mSingleStrip->Store(FirstRef); + mTotalLength++; + } + else + { + // ...but if flipped strip already begin with a replicated vertex, we just can skip it. + result.StripLengths[k]--; + if(wrefs) wrefs++; + if(drefs) drefs++; + } + } + } + } + + // Copy strip + for(u32 j=0;jStore((u16)Ref); + else mSingleStrip->Store(Ref); + } + if(wrefs) wrefs += result.StripLengths[k]; + if(drefs) drefs += result.StripLengths[k]; + mTotalLength += result.StripLengths[k]; + } + + // Update result structure + result.NbStrips = 1; + result.StripRuns = mSingleStrip->Collapse(); + result.StripLengths = &mTotalLength; + + return true; +} diff --git a/DSMeshConvert/cets-pterdiman/Striper.h b/DSMeshConvert/cets-pterdiman/Striper.h new file mode 100644 index 0000000..0e1cc16 --- /dev/null +++ b/DSMeshConvert/cets-pterdiman/Striper.h @@ -0,0 +1,82 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// +// Source code for "Creating Efficient Triangle Strips" +// (C) 2000, Pierre Terdiman (p.terdiman@wanadoo.fr) +// +// Version is 2.0. +// +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +#ifndef __STRIPER_H__ +#define __STRIPER_H__ + +#include "Adjacency.h" +#include "CustomArray.h" +#include "../types.h" + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + // + // Class Striper + // + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + struct STRIPERCREATE{ + STRIPERCREATE() + { + DFaces = 0; + WFaces = 0; + NbFaces = 0; + AskForWords = true; + OneSided = true; + SGIAlgorithm = true; + ConnectAllStrips = false; + } + u32 NbFaces; // #faces in source topo + u32* DFaces; // list of faces (dwords) or 0 + u16* WFaces; // list of faces (words) or 0 + bool AskForWords; // true => results are in words (else dwords) + bool OneSided; // true => create one-sided strips + bool SGIAlgorithm; // true => use the SGI algorithm, pick least connected faces first + bool ConnectAllStrips; // true => create a single strip with void faces + }; + + struct STRIPERRESULT{ + u32 NbStrips; // #strips created + u32* StripLengths; // Lengths of the strips (NbStrips values) + void* StripRuns; // The strips in words or dwords, depends on AskForWords + bool AskForWords; // true => results are in words (else dwords) + }; + + class Striper + { + private: + Striper& FreeUsedRam(); + u32 ComputeBestStrip(u32 face); + u32 TrackStrip(u32 face, u32 oldest, u32 middle, u32* strip, u32* faces, bool* tags); + bool ConnectAllStrips(STRIPERRESULT& result); + + Adjacencies* mAdj; // Adjacency structures + bool* mTags; // Face markers + + u32 mNbStrips; // The number of strips created for the mesh + CustomArray* mStripLengths; // Array to store strip lengths + CustomArray* mStripRuns; // Array to store strip indices + + u32 mTotalLength; // The length of the single strip + CustomArray* mSingleStrip; // Array to store the single strip + + // Flags + bool mAskForWords; + bool mOneSided; + bool mSGIAlgorithm; + bool mConnectAllStrips; + + public: + Striper(); + ~Striper(); + + bool Init(STRIPERCREATE& create); + bool Compute(STRIPERRESULT& result); + }; + +#endif // __STRIPER_H__ diff --git a/DSMeshConvert/cets-pterdiman/Strips.cpp b/DSMeshConvert/cets-pterdiman/Strips.cpp new file mode 100644 index 0000000..5cdd53a --- /dev/null +++ b/DSMeshConvert/cets-pterdiman/Strips.cpp @@ -0,0 +1,46 @@ +//#include "Stdafx.h" +// +//int main(int argc, char* argv[]) +//{ +// // Dumb test +// +// u32 Topology[] = { +// 0,1,2, +// 1,2,3, +// 2,3,4, +// 3,4,5, +// 4,5,6, +// 5,6,7, +// 6,7,8, +// 7,8,9 +// }; +// +// STRIPERCREATE sc; +// sc.DFaces = Topology; +// sc.NbFaces = 8; +// sc.AskForWords = true; +// sc.ConnectAllStrips = false; +// sc.OneSided = false; +// sc.SGIAlgorithm = true; +// +// Striper Strip; +// Strip.Init(sc); +// +// STRIPERRESULT sr; +// Strip.Compute(sr); +// +// fprintf(stdout, "Number of strips: %d\n", sr.NbStrips); +// u16* Refs = (u16*)sr.StripRuns; +// for(u32 i=0;i +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +//#define NVTRISTRIP // buggy?!! +//#define CETS_PTERDIMAN // http://www.codercorner.com/Strips.htm // memory corruption... +#define ACTC // http://plunk.org/~grantham/public/actc/ +#include "NvTriStrip.h" +#include "cets-pterdiman/Striper.h" +#include "ac/tc.h" + +#include "stripping.h" + +#include "types.h" + +struct Box +{ + aiVector3D min, max; +}; + +Box ComputeBoundingBox(aiVector3D* vertices, u32 nbVertices) +{ + Box aabb = { aiVector3D(100000000.0f), aiVector3D(-100000000.0f) }; + + for ( u32 i = nbVertices ; i > 0 ; i-- ) + { + if ( vertices->x < aabb.min.x ) aabb.min.x = vertices->x; + if ( vertices->y < aabb.min.y ) aabb.min.y = vertices->y; + if ( vertices->z < aabb.min.z ) aabb.min.z = vertices->z; + if ( vertices->x > aabb.max.x ) aabb.max.x = vertices->x; + if ( vertices->y > aabb.max.y ) aabb.max.y = vertices->y; + if ( vertices->z > aabb.max.z ) aabb.max.z = vertices->z; + vertices++; + } + + return aabb; +} + +aiMatrix4x4 operator+(aiMatrix4x4& a, aiMatrix4x4& b) +{ + return aiMatrix4x4( + a.a1 + b.a1, a.a2 + b.a2, a.a3 + b.a3, a.a4 + b.a4, + a.b1 + b.b1, a.b2 + b.b2, a.b3 + b.b3, a.b4 + b.b4, + a.c1 + b.c1, a.c2 + b.c2, a.c3 + b.c3, a.c4 + b.c4, + a.d1 + b.d1, a.d2 + b.d2, a.d3 + b.d3, a.d4 + b.d4); +} + +template +t map(t x, t a, t b, t c, t d) +{ + t s = b - a; + t t = (b * c - a * d) / s; + s = (d - c) / s; + return x * s + t; +} + +void PushValue(std::vector& list, u32& cmdOffset, u32& cmdIndex, u32 cmd, u32 value) +{ + list[cmdOffset] |= cmd << (cmdIndex * 8); // color + cmdIndex = (cmdIndex + 1) % 4; + list.push_back(value); + if ( cmdIndex == 0 ) + { + list.push_back(0); + cmdOffset = list.size() - 1; + } +} + +int Convert(const char* input, const char* output) +{ +#ifdef NVTRISTRIP + // Configure NVTriStrip + SetStitchStrips(false); + SetCacheSize(64); // ds has no cache, give me longest strips possible ffs ! +#endif + + // Configure Assimp + Assimp::Importer importer; + importer.SetPropertyInteger(AI_CONFIG_PP_SBP_REMOVE, + aiPrimitiveType_POINT + | aiPrimitiveType_LINE); + importer.SetPropertyInteger(AI_CONFIG_PP_RVC_FLAGS, + aiComponent_TANGENTS_AND_BITANGENTS + //| aiComponent_COLORS + | aiComponent_COLORSn(1) + | aiComponent_COLORSn(2) + | aiComponent_COLORSn(3) + | aiComponent_TEXCOORDSn(1) + | aiComponent_TEXCOORDSn(2) + | aiComponent_TEXCOORDSn(3) + | aiComponent_BONEWEIGHTS + | aiComponent_ANIMATIONS + | aiComponent_TEXTURES + | aiComponent_LIGHTS + | aiComponent_CAMERAS + | aiComponent_MATERIALS); + + // Import file + const aiScene* scene = importer.ReadFile(input, + aiProcess_FixInfacingNormals + | aiProcess_GenUVCoords + | aiProcess_TransformUVCoords + | aiProcess_JoinIdenticalVertices + | aiProcess_Triangulate + | aiProcess_PreTransformVertices + | aiProcess_FindDegenerates + | aiProcess_SortByPType + | aiProcess_FindInstances + | aiProcess_OptimizeMeshes + | aiProcess_ImproveCacheLocality + | aiProcess_RemoveComponent); + + if ( scene == 0 ) + { + fprintf(stderr, "Could not import %s\n", input); + return 1; + } + + // TODO: collapse all meshes into one, with warning output + if ( scene->mNumMeshes > 1 ) + { + fprintf(stderr, "%s has multiple meshes, not exporting\n", input); + return 2; + } + + aiMesh* mesh = scene->mMeshes[0]; + + if ( mesh->mFaces->mNumIndices > 65535 ) + { + fprintf(stderr, "Model is too complex, not exporting\n"); + return 3; + } + + //std::vector indices; + //for ( u32 i = 0 ; i < mesh->mNumFaces ; i++ ) + //{ + // ai_assert(mesh->mFaces[i].mNumIndices == 3); + // indices.push_back(mesh->mFaces[i].mIndices[0]); + // indices.push_back(mesh->mFaces[i].mIndices[1]); + // indices.push_back(mesh->mFaces[i].mIndices[2]); + //} + + //BuildDualGraph(indices); + + // Generate triangle strips +#ifdef NVTRISTRIP + u32 nbIndices = mesh->mNumFaces * 3; + u16* indices = new u16[nbIndices]; + u16* pIndices = indices; + for ( u32 i = 0 ; i < nbIndices / 3 ; i++ ) + { + ai_assert(mesh->mFaces[i].mNumIndices == 3); + *pIndices++ = mesh->mFaces[i].mIndices[0]; + *pIndices++ = mesh->mFaces[i].mIndices[1]; + *pIndices++ = mesh->mFaces[i].mIndices[2]; + } + u16 nbStrips = 0; + PrimitiveGroup* strips = 0; + if ( ! GenerateStrips(indices, nbIndices, &strips, &nbStrips) ) + { + fprintf(stderr, "Couldn't generate triangle strips, aborting\n"); + delete[] indices; + return 4; + } +#endif +#ifdef CETS_PTERDIMAN + u32 nbIndices = mesh->mNumFaces * 3; + u32* indices = new u32[nbIndices]; + u32* pIndices = indices; + for ( u32 i = 0 ; i < nbIndices / 3 ; i++ ) + { + *pIndices++ = mesh->mFaces[i].mIndices[0]; + *pIndices++ = mesh->mFaces[i].mIndices[1]; + *pIndices++ = mesh->mFaces[i].mIndices[2]; + } + STRIPERCREATE sc; + sc.DFaces = indices; + sc.NbFaces = mesh->mNumFaces; + sc.AskForWords = true; + sc.ConnectAllStrips = false; + sc.OneSided = false; + sc.SGIAlgorithm = false; + + Striper Strip; + Strip.Init(sc); + + STRIPERRESULT sr; + Strip.Compute(sr); + u32 nbStrips = sr.NbStrips; +#endif +#ifdef ACTC + ACTCData *tc; + tc = actcNew(); + actcParami(tc, ACTC_OUT_MIN_FAN_VERTS, INT_MAX); + actcBeginInput(tc); + for ( u32 i = 0 ; i < mesh->mNumFaces ; i++ ) + actcAddTriangle(tc, + mesh->mFaces[i].mIndices[0], + mesh->mFaces[i].mIndices[1], + mesh->mFaces[i].mIndices[2]); + actcEndInput(tc); + actcBeginOutput(tc); + u32 prim; + u32 v1, v2, v3; + u32 nbStrips = 0; + std::vector stripLengths; + std::vector stripIndices; + while ( (prim = actcStartNextPrim(tc, &v1, &v2)) != ACTC_DATABASE_EMPTY ) + { + nbStrips++; + stripIndices.push_back(v1); + stripIndices.push_back(v2); + u32 len = 2; + while ( actcGetNextVert(tc, &v3) != ACTC_PRIM_COMPLETE ) + { + len++; + stripIndices.push_back(v3); + } + stripLengths.push_back(len); + } + actcEndOutput(tc); +#endif + printf("%d strips generated for %d triangles\n", nbStrips, mesh->mNumFaces); + + // TODO: AABB => OBB, for higher precision + Box box = ComputeBoundingBox(mesh->mVertices, mesh->mNumVertices); + aiVector3D minDS(-7.99f); + aiVector3D maxDS(7.99f); + aiVector3D scale = box.max - box.min; + aiVector3D translate = aiVector3D( + box.max.x * minDS.x - box.min.x * maxDS.x, + box.max.y * minDS.y - box.min.y * maxDS.y, + box.max.z * minDS.z - box.min.z * maxDS.z); + translate = translate / scale; + scale = (maxDS - minDS) / scale; + + // Generate display list + std::vector list; + + aiMatrix4x4 transform; + aiMatrix4x4::Scaling(1.0f / scale, transform); + aiMatrix4x4 tmp; + aiMatrix4x4::Translation(-translate, tmp); + tmp.a1 = 0; tmp.b2 = 0; tmp.c3 = 0; + transform = transform + tmp; + list.push_back(0x19); // mult matrix 4x3 command + float* mtx = transform[0]; + for ( u32 i = 0 ; i < 4 ; i++ ) + { + for ( u32 j = 0 ; j < 3 ; j++ ) + { + list.push_back(s32(mtx[i + j * 4] * float(1 << 12))); + } + } + + u32 cmdindex = 1; + u32 command = 0; + + u16* idx = 0; +#ifdef CETS_PTERDIMAN + idx = (u16*)sr.StripRuns; +#endif +#ifdef ACTC + idx = &stripIndices[0]; +#endif + for ( u32 i = 0 ; i < nbStrips ; i++ ) + { +#ifdef NVTRISTRIP + idx = strips[i].indices; + u32 idxLen = strips[i].numIndices; + if ( strips[i].type == PT_STRIP ) + { + PushValue(list, command, cmdindex, 0x40, 2); // begin triangle strip + printf("begin strip\n"); + } + else if ( strips[i].type == PT_LIST ) + { + PushValue(list, command, cmdindex, 0x40, 0); // begin triangle list + //printf("begin list\n"); + } + else // if ( strips[i]->type == PT_FAN ) + { + fprintf(stderr, "Export failed, fan list generated\n"); + return 42; + } +#endif +#ifdef CETS_PTERDIMAN + PushValue(list, command, cmdindex, 0x40, 2); // begin triangle strip + //printf("begin strip\n"); + u32 idxLen = sr.StripLengths[i]; +#endif +#ifdef ACTC + u32 idxLen = stripLengths[i]; + PushValue(list, command, cmdindex, 0x40, 2); // begin triangle strip + //printf("begin strip\n"); +#endif + + for ( u32 j = idxLen ; j > 0 ; j--, idx++ ) + { + if ( mesh->HasTextureCoords(0) ) + { + aiVector3D t = mesh->mTextureCoords[0][*idx]; + //printf("texcoord %f %f\n", t.x, t.y); + t *= 1024.0f * float(1 << 4);//float(1 << 15); + PushValue(list, command, cmdindex, 0x22, (s32(t.x) & 0xFFFF) | ((s32(t.y) & 0xFFFF) << 16)); + } + + if ( mesh->HasNormals() ) + { + // remove this ? + if ( mesh->HasVertexColors(0) ) + { + u32 ar = 0; u32 ag = 0; u32 ab = 0; // ambiant color, TODO: add command line parameter to set it + s32 r = (s32)(mesh->mColors[*idx][0].r * 31); if ( r < 0 ) r = 0; if ( r > 31 ) r = 31; + s32 g = (s32)(mesh->mColors[*idx][0].g * 31); if ( g < 0 ) g = 0; if ( g > 31 ) g = 31; + s32 b = (s32)(mesh->mColors[*idx][0].b * 31); if ( b < 0 ) b = 0; if ( b > 31 ) b = 31; + PushValue(list, command, cmdindex, 0x30, r | (g << 5) | (b << 10) | (ar << 16) | (ag << 21) | (ab << 26)); // material diffuse + ambiant + } + + aiVector3D n = mesh->mNormals[*idx]; + n.Normalize(); + //printf("normal %f %f %f\n", n.x, n.y, n.z); + n *= float(1 << 9); + PushValue(list, command, cmdindex, 0x21, (s32(n.x) & 0x3FF | ((s32(n.y) & 0x3FF) << 10) | ((s32(n.z) & 0x3FF) << 20))); + } + else if ( mesh->HasVertexColors(0) ) + { + s32 r = (s32)(mesh->mColors[*idx][0].r * 31); if ( r < 0 ) r = 0; if ( r > 31 ) r = 31; + s32 g = (s32)(mesh->mColors[*idx][0].g * 31); if ( g < 0 ) g = 0; if ( g > 31 ) g = 31; + s32 b = (s32)(mesh->mColors[*idx][0].b * 31); if ( b < 0 ) b = 0; if ( b > 31 ) b = 31; + PushValue(list, command, cmdindex, 0x20, r | (g << 5) | (b << 10) | (1 << 15)); // color + } + + aiVector3D p = mesh->mVertices[*idx]; + //printf("vtx10 %f %f %f\n", p.x, p.y, p.z); + p.x *= scale.x; p.y *= scale.y; p.z *= scale.z; + p += translate; + p *= float(1 << 6); + s32 px = (s32)p.x; + s32 py = (s32)p.y; + s32 pz = (s32)p.z; + PushValue(list, command, cmdindex, 0x24, ((px) & 0x3FF) | (((py) & 0x3FF) << 10) | (((pz) & 0x3FF) << 20)); + } + } + + // Output file + FILE* f = fopen(output, "wb"); + fwrite(&list[0], sizeof(list[0]), list.size(), f); + fclose(f); + +#ifdef NVTRISTRIP + delete[] strips; + delete[] indices; +#endif +#ifdef CETS_PTERDIMAN + delete[] indices; +#endif + + return 0; +} + +int main(int argc, char** argv) +{ + if ( argc < 3 ) + { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 42; + } + + return Convert(argv[1], argv[2]); +} \ No newline at end of file diff --git a/DSMeshConvert/stripping.cpp b/DSMeshConvert/stripping.cpp new file mode 100644 index 0000000..9406ad7 --- /dev/null +++ b/DSMeshConvert/stripping.cpp @@ -0,0 +1,216 @@ +#include "stripping.h" +#include +#include +#define AI_WONT_RETURN +#include + +u32 GetNodeFromSet(std::set (&unconnected)[4], std::set (&connected)[2], u32& settype, u32& setid) +{ + u32 node; + + if ( unconnected[0].size() > 0 ) + { + node = *unconnected[0].begin(); + unconnected[0].erase(node); + settype = 0; + setid = 0; + } + else if ( unconnected[1].size() > 0 ) + { + node = *unconnected[1].begin(); + unconnected[1].erase(node); + settype = 0; + setid = 1; + } + else if ( connected[0].size() > 0 ) + { + node = *connected[1].begin(); + connected[1].erase(node); + settype = 1; + setid = 0; + } + else if ( unconnected[2].size() > 0 ) + { + node = *unconnected[2].begin(); + unconnected[2].erase(node); + settype = 0; + setid = 2; + } + else if ( connected[1].size() > 0 ) + { + node = *connected[2].begin(); + connected[0].erase(node); + settype = 1; + setid = 1; + } + else + { + node = *unconnected[3].begin(); + unconnected[3].erase(node); + settype = 0; + setid = 3; + } + + return node; +} + +void Find(u32 node, std::set (&unconnected)[4], std::set (&connected)[2], u32& settype, u32& setid) +{ + for ( u32 i = 0 ; i < 4 ; i++ ) + { + std::set::iterator it = unconnected[i].find(node); + if ( it != unconnected[i].end() ) + { + settype = 0; + setid = i; + return; + } + } + + for ( u32 i = 0 ; i < 2 ; i++ ) + { + std::set::iterator it = connected[i].find(node); + if ( it != connected[i].end() ) + { + settype = 1; + setid = i; + return; + } + } +} + +void MoveNodeToSet(u32 node, u32 nodeSetID, u32 nodeSetType, std::set (&connected)[2], std::set &fullyConnected) +{ + if ( nodeSetType == 0 && nodeSetID > 0 ) + { + if ( nodeSetID == 1 ) + { + connected[0].insert(node); + } + else + { + connected[nodeSetID - 2].insert(node); + } + } + else + { + fullyConnected.insert(node); + } +} + +// Multi-Path Algorithm for Triangle Strips +// Petr Vanecek, Ivana Kolingerova +// From the draft of September 16, 2004 +std::vector BuildTriangleStrips(std::vector indices) +{ + u32 nbTriangles = indices.size() / 3; + + // build edge map + std::map, std::vector > connections; + u32 triangle = 0; + for ( u32 i = 0 ; i < indices.size() ; i += 3, triangle++ ) + { + for ( u32 j = 0 ; j < 3 ; j++ ) + { + static u32 a[] = { 0, 0, 1 }; + static u32 b[] = { 1, 2, 2 }; + std::pair edge(indices[i + a[j]], indices[i + b[j]]); + if ( edge.first > edge.second ) + { + std::swap(edge.first, edge.second); + } + + std::map, std::vector >::iterator it = connections.find(edge); + if ( it == connections.end() ) + { + std::pair, std::vector > entry; + entry.first = edge; + entry.second.push_back(triangle); + connections.insert(entry); + } + else + { + it->second.push_back(triangle); + } + } + } + + // build dual graph + std::vector > graph(nbTriangles); + for ( u32 i = 0, triangle = 0 ; i < indices.size() ; i += 3, triangle++ ) + { + for ( u32 j = 0 ; j < 3 ; j++ ) + { + static u32 a[] = { 0, 0, 1 }; + static u32 b[] = { 1, 2, 2 }; + std::pair edge(indices[i + a[j]], indices[i + b[j]]); + if ( edge.first > edge.second ) + { + std::swap(edge.first, edge.second); + } + + std::map, std::vector >::iterator it = connections.find(edge); + if ( it != connections.end() ) + { + graph[triangle].insert(it->second.begin(), it->second.end()); + } + } + graph[triangle].erase(triangle); + } + + // build sets + std::set unconnected[4]; + for ( u32 i = 0 ; i < nbTriangles ; i++ ) + { + ai_assert(graph[i].size() < 4); + unconnected[graph[i].size()].insert(i); + } + + std::set connected[2]; + std::set fullyConnected; + + while ( fullyConnected.size() < nbTriangles ) + { + u32 nodeSetID, nodeSetType; + u32 node = GetNodeFromSet(unconnected, connected, nodeSetType, nodeSetID); + u32 node2 = *graph[node].begin(); + u32 node2SetID, node2SetType; + Find(node2, unconnected, connected, node2SetType, node2SetID); + if ( node2SetType == 0 ) + { + unconnected[node2SetID].erase(node2); + } + else + { + connected[node2SetID].erase(node2); + } + + // Create strip + std::vector strip; + strip.push_back(node); + strip.push_back(node2); + + // Remove edge from graph + graph[node].erase(node2); + graph[node2].erase(node); + + //strip = ConcatenateStrips(strip); + + MoveNodeToSet(node, nodeSetID, nodeSetType, connected, fullyConnected); + MoveNodeToSet(node2, node2SetID, node2SetType, connected, fullyConnected); + + //UpdateNeighbors(node); + //UpdateNeighbors(node2); + + //RemoveLoop(strip); + + //UpdateNeighbors(*strip.begin()); + if ( strip.begin() != strip.end() ) + { + //UpdateNeighbors(*(strip.end() - 1)); + } + } + + std::vector strips; + return strips; +} \ No newline at end of file diff --git a/DSMeshConvert/stripping.h b/DSMeshConvert/stripping.h new file mode 100644 index 0000000..9a6d510 --- /dev/null +++ b/DSMeshConvert/stripping.h @@ -0,0 +1,9 @@ +#ifndef _STRIPPING_H_ +#define _STRIPPING_H_ + +#include +#include "types.h" + +std::vector BuildTriangleStrips(std::vector indices); + +#endif // _STRIPPING_H_ \ No newline at end of file diff --git a/DSTexCompress/src/types.h b/DSMeshConvert/types.h similarity index 100% rename from DSTexCompress/src/types.h rename to DSMeshConvert/types.h diff --git a/DSMeshLoad/DSMeshLoad.vcxproj b/DSMeshLoad/DSMeshLoad.vcxproj new file mode 100644 index 0000000..75b5942 --- /dev/null +++ b/DSMeshLoad/DSMeshLoad.vcxproj @@ -0,0 +1,86 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {F97FBD13-23BC-42C4-A1DC-FA263214ED05} + DSMeshLoad + + + + Application + MultiByte + true + + + Application + MultiByte + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + true + EnableFastChecks + MultiThreadedDebugDLL + Level3 + EditAndContinue + + + true + MachineX86 + + + + + MaxSpeed + true + MultiThreadedDLL + true + Level3 + ProgramDatabase + + + true + true + true + MachineX86 + + + + + + + + + \ No newline at end of file diff --git a/DSMeshLoad/main.cpp b/DSMeshLoad/main.cpp new file mode 100644 index 0000000..cc80171 --- /dev/null +++ b/DSMeshLoad/main.cpp @@ -0,0 +1,121 @@ +#include +#include +#define AI_WONT_RETURN +#include "../DSMeshConvert/assimp--1.1.700-sdk/include/aiVector3D.h" +#include "../DSMeshConvert/assimp--1.1.700-sdk/include/aiMatrix4x4.h" +#include "../DSMeshConvert/assimp--1.1.700-sdk/include/aiMatrix4x4.inl" + +typedef unsigned int u32; +typedef signed int s32; + +int main(int argc, char** argv) +{ + if ( argc != 2 ) + { + fprintf(stderr, "Usage: %s \n", argv[0]); + return 42; + } + + FILE* f = fopen(argv[1], "rb"); + if ( ! f ) + { + fprintf(stderr, "Could not open %s\n", argv[1]); + return 1; + } + + fseek(f, 0, SEEK_END); + u32 len = ftell(f) / 4; + fseek(f, 0, SEEK_SET); + + u32* list = new u32[len]; + u32* start = list; + u32* end = list + len; + + fread(list, 4, len, f); + + aiMatrix4x4 mtx; + float* pMtx = (float*)(&mtx); + + u32 index = 0; + u32 command = *list++; + while ( list < end ) + { + u32 c = (command >> index) & 0xFF; + switch ( c ) + { + case 0x19: // mul mtx 4x3 + { + printf("mul4x3 "); + for ( u32 i = 0 ; i < 4 ; i++ ) + { + for ( u32 j = 0 ; j < 3 ; j++ ) + { + s32 v = *list++; + float value = v / float(1 << 12); + pMtx[i*4+j] = value; + printf("%f ", value); + } + printf("%f ", 0); + } + printf("\n"); + break; + } + case 0x21: // normal + { + s32 n = *list; + s32 nx = n & 0x3FF; if ( nx > 0x200 ) nx -= 0x200; + s32 ny = (n >> 10) & 0x3FF; if ( ny >= 0x200 ) ny -= 0x400; + s32 nz = (n >> 20) & 0x3FF; if ( nz >= 0x200 ) nz -= 0x400; + printf("normal %f %f %f\n", + nx / float(1 << 9), + ny / float(1 << 9), + nz / float(1 << 9)); + break; + } + case 0x22: // tex coord + { + s32 t = *list++; + s32 tx = t & 0xFFFF; + s32 ty = (t >> 16) & 0xFFFF; + printf("texcoord %f %f\n", tx / float(1 << 15), ty / float(1 << 15)); + break; + } + case 0x24: // vtx 10 + { + s32 v = *list++; + s32 vx = v & 0x3FF; if ( vx > 0x200 ) vx -= 0x200; + s32 vy = (v >> 10) & 0x3FF; if ( vy >= 0x200 ) vy -= 0x400; + s32 vz = (v >> 20) & 0x3FF; if ( vz >= 0x200 ) vz -= 0x400; + //printf("vtx10 %f %f %f\n", + // vx / float(1 << 6), + // vy / float(1 << 6), + // vz / float(1 << 6)); + aiVector3D vec(vx / float(1 << 6), vy / float(1 << 6), vz / float(1 << 6)); + vec *= mtx; + printf("vtx10 %f %f %f\n", vec.x, vec.y, vec.z); + printf(""); + break; + } + case 0x40: // begin + { + printf("begin %s\n", *list++ ? "strip" : "list"); + break; + } + default: + { + printf("Unknown command %x\n", c); + } + } + + index += 8; + if ( index == 32 ) + { + index = 0; + command = *list++; + } + } + + delete[] start; + + return 0; +} \ No newline at end of file diff --git a/DSTexCompress.sln b/DSTexCompress.sln deleted file mode 100644 index 57d419d..0000000 --- a/DSTexCompress.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DSTexCompress", "DSTexCompress\DSTexCompress.vcproj", "{126B132C-BACE-403D-A643-CF31C47672C8}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {126B132C-BACE-403D-A643-CF31C47672C8}.Debug|Win32.ActiveCfg = Debug|Win32 - {126B132C-BACE-403D-A643-CF31C47672C8}.Debug|Win32.Build.0 = Debug|Win32 - {126B132C-BACE-403D-A643-CF31C47672C8}.Release|Win32.ActiveCfg = Release|Win32 - {126B132C-BACE-403D-A643-CF31C47672C8}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/DSTexCompress.suo b/DSTexCompress.suo deleted file mode 100644 index fda3377..0000000 Binary files a/DSTexCompress.suo and /dev/null differ diff --git a/DSTexCompress/FreeImage.dll b/DSTexCompress/FreeImage.dll deleted file mode 100644 index abe1365..0000000 Binary files a/DSTexCompress/FreeImage.dll and /dev/null differ diff --git a/DSTexCompress/FreeImage/Dist/FreeImage.dll b/DSTexCompress/FreeImage/Dist/FreeImage.dll deleted file mode 100644 index abe1365..0000000 Binary files a/DSTexCompress/FreeImage/Dist/FreeImage.dll and /dev/null differ diff --git a/DSTexCompress/FreeImage/Dist/FreeImage.h b/DSTexCompress/FreeImage/Dist/FreeImage.h deleted file mode 100644 index 5d60655..0000000 --- a/DSTexCompress/FreeImage/Dist/FreeImage.h +++ /dev/null @@ -1,1090 +0,0 @@ -// ========================================================== -// FreeImage 3 -// -// Design and implementation by -// - Floris van den Berg (flvdberg@wxs.nl) -// - Herv Drolon (drolon@infonie.fr) -// -// Contributors: -// - see changes log named 'Whatsnew.txt', see header of each .h and .cpp file -// -// 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 FREEIMAGE_H -#define FREEIMAGE_H - -// Version information ------------------------------------------------------ - -#define FREEIMAGE_MAJOR_VERSION 3 -#define FREEIMAGE_MINOR_VERSION 14 -#define FREEIMAGE_RELEASE_SERIAL 1 - -// Compiler options --------------------------------------------------------- - -#include // needed for UNICODE functions - -#if defined(FREEIMAGE_LIB) - #define DLL_API - #define DLL_CALLCONV -#else - #if defined(_WIN32) || defined(__WIN32__) - #define DLL_CALLCONV __stdcall - // The following ifdef block is the standard way of creating macros which make exporting - // from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS - // symbol defined on the command line. this symbol should not be defined on any project - // that uses this DLL. This way any other project whose source files include this file see - // DLL_API functions as being imported from a DLL, wheras this DLL sees symbols - // defined with this macro as being exported. - #ifdef FREEIMAGE_EXPORTS - #define DLL_API __declspec(dllexport) - #else - #define DLL_API __declspec(dllimport) - #endif // FREEIMAGE_EXPORTS - #else - // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility) - #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - #ifndef GCC_HASCLASSVISIBILITY - #define GCC_HASCLASSVISIBILITY - #endif - #endif // __GNUC__ - #define DLL_CALLCONV - #if defined(GCC_HASCLASSVISIBILITY) - #define DLL_API __attribute__ ((visibility("default"))) - #else - #define DLL_API - #endif - #endif // WIN32 / !WIN32 -#endif // FREEIMAGE_LIB - -// Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined -// If your big endian system isn't being detected, add an OS specific check -#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \ - (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \ - defined(__BIG_ENDIAN__) -#define FREEIMAGE_BIGENDIAN -#endif // BYTE_ORDER - -// This really only affects 24 and 32 bit formats, the rest are always RGB order. -#define FREEIMAGE_COLORORDER_BGR 0 -#define FREEIMAGE_COLORORDER_RGB 1 -#if defined(FREEIMAGE_BIGENDIAN) -#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB -#else -#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR -#endif - -// Ensure 4-byte enums if we're using Borland C++ compilers -#if defined(__BORLANDC__) -#pragma option push -b -#endif - -// For C compatibility -------------------------------------------------------- - -#ifdef __cplusplus -#define FI_DEFAULT(x) = x -#define FI_ENUM(x) enum x -#define FI_STRUCT(x) struct x -#else -#define FI_DEFAULT(x) -#define FI_ENUM(x) typedef int x; enum x -#define FI_STRUCT(x) typedef struct x x; struct x -#endif - -// Bitmap types ------------------------------------------------------------- - -FI_STRUCT (FIBITMAP) { void *data; }; -FI_STRUCT (FIMULTIBITMAP) { void *data; }; - -// Types used in the library (directly copied from Windows) ----------------- - -#if defined(__MINGW32__) && defined(_WINDOWS_H) -#define _WINDOWS_ // prevent a bug in MinGW32 -#endif // __MINGW32__ - -#ifndef _WINDOWS_ -#define _WINDOWS_ - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif -#ifndef NULL -#define NULL 0 -#endif - -#ifndef SEEK_SET -#define SEEK_SET 0 -#define SEEK_CUR 1 -#define SEEK_END 2 -#endif - -#ifndef _MSC_VER -// define portable types for 32-bit / 64-bit OS -#include -typedef int32_t BOOL; -typedef uint8_t BYTE; -typedef uint16_t WORD; -typedef uint32_t DWORD; -typedef int32_t LONG; -#else -// MS is not C99 ISO compliant -typedef long BOOL; -typedef unsigned char BYTE; -typedef unsigned short WORD; -typedef unsigned long DWORD; -typedef long LONG; -#endif // _MSC_VER - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(push, 1) -#else -#pragma pack(1) -#endif // WIN32 - -typedef struct tagRGBQUAD { -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR - BYTE rgbBlue; - BYTE rgbGreen; - BYTE rgbRed; -#else - BYTE rgbRed; - BYTE rgbGreen; - BYTE rgbBlue; -#endif // FREEIMAGE_COLORORDER - BYTE rgbReserved; -} RGBQUAD; - -typedef struct tagRGBTRIPLE { -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR - BYTE rgbtBlue; - BYTE rgbtGreen; - BYTE rgbtRed; -#else - BYTE rgbtRed; - BYTE rgbtGreen; - BYTE rgbtBlue; -#endif // FREEIMAGE_COLORORDER -} RGBTRIPLE; - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(pop) -#else -#pragma pack() -#endif // WIN32 - -typedef struct tagBITMAPINFOHEADER{ - DWORD biSize; - LONG biWidth; - LONG biHeight; - WORD biPlanes; - WORD biBitCount; - DWORD biCompression; - DWORD biSizeImage; - LONG biXPelsPerMeter; - LONG biYPelsPerMeter; - DWORD biClrUsed; - DWORD biClrImportant; -} BITMAPINFOHEADER, *PBITMAPINFOHEADER; - -typedef struct tagBITMAPINFO { - BITMAPINFOHEADER bmiHeader; - RGBQUAD bmiColors[1]; -} BITMAPINFO, *PBITMAPINFO; - -#endif // _WINDOWS_ - -// Types used in the library (specific to FreeImage) ------------------------ - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(push, 1) -#else -#pragma pack(1) -#endif // WIN32 - -/** 48-bit RGB -*/ -typedef struct tagFIRGB16 { - WORD red; - WORD green; - WORD blue; -} FIRGB16; - -/** 64-bit RGBA -*/ -typedef struct tagFIRGBA16 { - WORD red; - WORD green; - WORD blue; - WORD alpha; -} FIRGBA16; - -/** 96-bit RGB Float -*/ -typedef struct tagFIRGBF { - float red; - float green; - float blue; -} FIRGBF; - -/** 128-bit RGBA Float -*/ -typedef struct tagFIRGBAF { - float red; - float green; - float blue; - float alpha; -} FIRGBAF; - -/** Data structure for COMPLEX type (complex number) -*/ -typedef struct tagFICOMPLEX { - /// real part - double r; - /// imaginary part - double i; -} FICOMPLEX; - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(pop) -#else -#pragma pack() -#endif // WIN32 - -// Indexes for byte arrays, masks and shifts for treating pixels as words --- -// These coincide with the order of RGBQUAD and RGBTRIPLE ------------------- - -#ifndef FREEIMAGE_BIGENDIAN -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR -// Little Endian (x86 / MS Windows, Linux) : BGR(A) order -#define FI_RGBA_RED 2 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 0 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0x00FF0000 -#define FI_RGBA_GREEN_MASK 0x0000FF00 -#define FI_RGBA_BLUE_MASK 0x000000FF -#define FI_RGBA_ALPHA_MASK 0xFF000000 -#define FI_RGBA_RED_SHIFT 16 -#define FI_RGBA_GREEN_SHIFT 8 -#define FI_RGBA_BLUE_SHIFT 0 -#define FI_RGBA_ALPHA_SHIFT 24 -#else -// Little Endian (x86 / MaxOSX) : RGB(A) order -#define FI_RGBA_RED 0 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 2 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0x000000FF -#define FI_RGBA_GREEN_MASK 0x0000FF00 -#define FI_RGBA_BLUE_MASK 0x00FF0000 -#define FI_RGBA_ALPHA_MASK 0xFF000000 -#define FI_RGBA_RED_SHIFT 0 -#define FI_RGBA_GREEN_SHIFT 8 -#define FI_RGBA_BLUE_SHIFT 16 -#define FI_RGBA_ALPHA_SHIFT 24 -#endif // FREEIMAGE_COLORORDER -#else -#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR -// Big Endian (PPC / none) : BGR(A) order -#define FI_RGBA_RED 2 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 0 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0x0000FF00 -#define FI_RGBA_GREEN_MASK 0x00FF0000 -#define FI_RGBA_BLUE_MASK 0xFF000000 -#define FI_RGBA_ALPHA_MASK 0x000000FF -#define FI_RGBA_RED_SHIFT 8 -#define FI_RGBA_GREEN_SHIFT 16 -#define FI_RGBA_BLUE_SHIFT 24 -#define FI_RGBA_ALPHA_SHIFT 0 -#else -// Big Endian (PPC / Linux, MaxOSX) : RGB(A) order -#define FI_RGBA_RED 0 -#define FI_RGBA_GREEN 1 -#define FI_RGBA_BLUE 2 -#define FI_RGBA_ALPHA 3 -#define FI_RGBA_RED_MASK 0xFF000000 -#define FI_RGBA_GREEN_MASK 0x00FF0000 -#define FI_RGBA_BLUE_MASK 0x0000FF00 -#define FI_RGBA_ALPHA_MASK 0x000000FF -#define FI_RGBA_RED_SHIFT 24 -#define FI_RGBA_GREEN_SHIFT 16 -#define FI_RGBA_BLUE_SHIFT 8 -#define FI_RGBA_ALPHA_SHIFT 0 -#endif // FREEIMAGE_COLORORDER -#endif // FREEIMAGE_BIGENDIAN - -#define FI_RGBA_RGB_MASK (FI_RGBA_RED_MASK|FI_RGBA_GREEN_MASK|FI_RGBA_BLUE_MASK) - -// The 16bit macros only include masks and shifts, since each color element is not byte aligned - -#define FI16_555_RED_MASK 0x7C00 -#define FI16_555_GREEN_MASK 0x03E0 -#define FI16_555_BLUE_MASK 0x001F -#define FI16_555_RED_SHIFT 10 -#define FI16_555_GREEN_SHIFT 5 -#define FI16_555_BLUE_SHIFT 0 -#define FI16_565_RED_MASK 0xF800 -#define FI16_565_GREEN_MASK 0x07E0 -#define FI16_565_BLUE_MASK 0x001F -#define FI16_565_RED_SHIFT 11 -#define FI16_565_GREEN_SHIFT 5 -#define FI16_565_BLUE_SHIFT 0 - -// ICC profile support ------------------------------------------------------ - -#define FIICC_DEFAULT 0x00 -#define FIICC_COLOR_IS_CMYK 0x01 - -FI_STRUCT (FIICCPROFILE) { - WORD flags; // info flag - DWORD size; // profile's size measured in bytes - void *data; // points to a block of contiguous memory containing the profile -}; - -// Important enums ---------------------------------------------------------- - -/** I/O image format identifiers. -*/ -FI_ENUM(FREE_IMAGE_FORMAT) { - FIF_UNKNOWN = -1, - FIF_BMP = 0, - FIF_ICO = 1, - FIF_JPEG = 2, - FIF_JNG = 3, - FIF_KOALA = 4, - FIF_LBM = 5, - FIF_IFF = FIF_LBM, - FIF_MNG = 6, - FIF_PBM = 7, - FIF_PBMRAW = 8, - FIF_PCD = 9, - FIF_PCX = 10, - FIF_PGM = 11, - FIF_PGMRAW = 12, - FIF_PNG = 13, - FIF_PPM = 14, - FIF_PPMRAW = 15, - FIF_RAS = 16, - FIF_TARGA = 17, - FIF_TIFF = 18, - FIF_WBMP = 19, - FIF_PSD = 20, - FIF_CUT = 21, - FIF_XBM = 22, - FIF_XPM = 23, - FIF_DDS = 24, - FIF_GIF = 25, - FIF_HDR = 26, - FIF_FAXG3 = 27, - FIF_SGI = 28, - FIF_EXR = 29, - FIF_J2K = 30, - FIF_JP2 = 31, - FIF_PFM = 32, - FIF_PICT = 33, - FIF_RAW = 34 -}; - -/** Image type used in FreeImage. -*/ -FI_ENUM(FREE_IMAGE_TYPE) { - FIT_UNKNOWN = 0, // unknown type - FIT_BITMAP = 1, // standard image : 1-, 4-, 8-, 16-, 24-, 32-bit - FIT_UINT16 = 2, // array of unsigned short : unsigned 16-bit - FIT_INT16 = 3, // array of short : signed 16-bit - FIT_UINT32 = 4, // array of unsigned long : unsigned 32-bit - FIT_INT32 = 5, // array of long : signed 32-bit - FIT_FLOAT = 6, // array of float : 32-bit IEEE floating point - FIT_DOUBLE = 7, // array of double : 64-bit IEEE floating point - FIT_COMPLEX = 8, // array of FICOMPLEX : 2 x 64-bit IEEE floating point - FIT_RGB16 = 9, // 48-bit RGB image : 3 x 16-bit - FIT_RGBA16 = 10, // 64-bit RGBA image : 4 x 16-bit - FIT_RGBF = 11, // 96-bit RGB float image : 3 x 32-bit IEEE floating point - FIT_RGBAF = 12 // 128-bit RGBA float image : 4 x 32-bit IEEE floating point -}; - -/** Image color type used in FreeImage. -*/ -FI_ENUM(FREE_IMAGE_COLOR_TYPE) { - FIC_MINISWHITE = 0, // min value is white - FIC_MINISBLACK = 1, // min value is black - FIC_RGB = 2, // RGB color model - FIC_PALETTE = 3, // color map indexed - FIC_RGBALPHA = 4, // RGB color model with alpha channel - FIC_CMYK = 5 // CMYK color model -}; - -/** Color quantization algorithms. -Constants used in FreeImage_ColorQuantize. -*/ -FI_ENUM(FREE_IMAGE_QUANTIZE) { - FIQ_WUQUANT = 0, // Xiaolin Wu color quantization algorithm - FIQ_NNQUANT = 1 // NeuQuant neural-net quantization algorithm by Anthony Dekker -}; - -/** Dithering algorithms. -Constants used in FreeImage_Dither. -*/ -FI_ENUM(FREE_IMAGE_DITHER) { - FID_FS = 0, // Floyd & Steinberg error diffusion - FID_BAYER4x4 = 1, // Bayer ordered dispersed dot dithering (order 2 dithering matrix) - FID_BAYER8x8 = 2, // Bayer ordered dispersed dot dithering (order 3 dithering matrix) - FID_CLUSTER6x6 = 3, // Ordered clustered dot dithering (order 3 - 6x6 matrix) - FID_CLUSTER8x8 = 4, // Ordered clustered dot dithering (order 4 - 8x8 matrix) - FID_CLUSTER16x16= 5, // Ordered clustered dot dithering (order 8 - 16x16 matrix) - FID_BAYER16x16 = 6 // Bayer ordered dispersed dot dithering (order 4 dithering matrix) -}; - -/** Lossless JPEG transformations -Constants used in FreeImage_JPEGTransform -*/ -FI_ENUM(FREE_IMAGE_JPEG_OPERATION) { - FIJPEG_OP_NONE = 0, // no transformation - FIJPEG_OP_FLIP_H = 1, // horizontal flip - FIJPEG_OP_FLIP_V = 2, // vertical flip - FIJPEG_OP_TRANSPOSE = 3, // transpose across UL-to-LR axis - FIJPEG_OP_TRANSVERSE = 4, // transpose across UR-to-LL axis - FIJPEG_OP_ROTATE_90 = 5, // 90-degree clockwise rotation - FIJPEG_OP_ROTATE_180 = 6, // 180-degree rotation - FIJPEG_OP_ROTATE_270 = 7 // 270-degree clockwise (or 90 ccw) -}; - -/** Tone mapping operators. -Constants used in FreeImage_ToneMapping. -*/ -FI_ENUM(FREE_IMAGE_TMO) { - FITMO_DRAGO03 = 0, // Adaptive logarithmic mapping (F. Drago, 2003) - FITMO_REINHARD05 = 1, // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - FITMO_FATTAL02 = 2 // Gradient domain high dynamic range compression (R. Fattal, 2002) -}; - -/** Upsampling / downsampling filters. -Constants used in FreeImage_Rescale. -*/ -FI_ENUM(FREE_IMAGE_FILTER) { - FILTER_BOX = 0, // Box, pulse, Fourier window, 1st order (constant) b-spline - FILTER_BICUBIC = 1, // Mitchell & Netravali's two-param cubic filter - FILTER_BILINEAR = 2, // Bilinear filter - FILTER_BSPLINE = 3, // 4th order (cubic) b-spline - FILTER_CATMULLROM = 4, // Catmull-Rom spline, Overhauser spline - FILTER_LANCZOS3 = 5 // Lanczos3 filter -}; - -/** Color channels. -Constants used in color manipulation routines. -*/ -FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) { - FICC_RGB = 0, // Use red, green and blue channels - FICC_RED = 1, // Use red channel - FICC_GREEN = 2, // Use green channel - FICC_BLUE = 3, // Use blue channel - FICC_ALPHA = 4, // Use alpha channel - FICC_BLACK = 5, // Use black channel - FICC_REAL = 6, // Complex images: use real part - FICC_IMAG = 7, // Complex images: use imaginary part - FICC_MAG = 8, // Complex images: use magnitude - FICC_PHASE = 9 // Complex images: use phase -}; - -// Metadata support --------------------------------------------------------- - -/** - Tag data type information (based on TIFF specifications) - - Note: RATIONALs are the ratio of two 32-bit integer values. -*/ -FI_ENUM(FREE_IMAGE_MDTYPE) { - FIDT_NOTYPE = 0, // placeholder - FIDT_BYTE = 1, // 8-bit unsigned integer - FIDT_ASCII = 2, // 8-bit bytes w/ last byte null - FIDT_SHORT = 3, // 16-bit unsigned integer - FIDT_LONG = 4, // 32-bit unsigned integer - FIDT_RATIONAL = 5, // 64-bit unsigned fraction - FIDT_SBYTE = 6, // 8-bit signed integer - FIDT_UNDEFINED = 7, // 8-bit untyped data - FIDT_SSHORT = 8, // 16-bit signed integer - FIDT_SLONG = 9, // 32-bit signed integer - FIDT_SRATIONAL = 10, // 64-bit signed fraction - FIDT_FLOAT = 11, // 32-bit IEEE floating point - FIDT_DOUBLE = 12, // 64-bit IEEE floating point - FIDT_IFD = 13, // 32-bit unsigned integer (offset) - FIDT_PALETTE = 14 // 32-bit RGBQUAD -}; - -/** - Metadata models supported by FreeImage -*/ -FI_ENUM(FREE_IMAGE_MDMODEL) { - FIMD_NODATA = -1, - FIMD_COMMENTS = 0, // single comment or keywords - FIMD_EXIF_MAIN = 1, // Exif-TIFF metadata - FIMD_EXIF_EXIF = 2, // Exif-specific metadata - FIMD_EXIF_GPS = 3, // Exif GPS metadata - FIMD_EXIF_MAKERNOTE = 4, // Exif maker note metadata - FIMD_EXIF_INTEROP = 5, // Exif interoperability metadata - FIMD_IPTC = 6, // IPTC/NAA metadata - FIMD_XMP = 7, // Abobe XMP metadata - FIMD_GEOTIFF = 8, // GeoTIFF metadata - FIMD_ANIMATION = 9, // Animation metadata - FIMD_CUSTOM = 10, // Used to attach other metadata types to a dib - FIMD_EXIF_RAW = 11 // Exif metadata as a raw buffer -}; - -/** - Handle to a metadata model -*/ -FI_STRUCT (FIMETADATA) { void *data; }; - -/** - Handle to a FreeImage tag -*/ -FI_STRUCT (FITAG) { void *data; }; - -// File IO routines --------------------------------------------------------- - -#ifndef FREEIMAGE_IO -#define FREEIMAGE_IO - -typedef void* fi_handle; -typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle); -typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle); -typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin); -typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle); - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(push, 1) -#else -#pragma pack(1) -#endif // WIN32 - -FI_STRUCT(FreeImageIO) { - 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 -}; - -#if (defined(_WIN32) || defined(__WIN32__)) -#pragma pack(pop) -#else -#pragma pack() -#endif // WIN32 - -/** -Handle to a memory I/O stream -*/ -FI_STRUCT (FIMEMORY) { void *data; }; - -#endif // FREEIMAGE_IO - -// Plugin routines ---------------------------------------------------------- - -#ifndef PLUGINS -#define PLUGINS - -typedef const char *(DLL_CALLCONV *FI_FormatProc)(void); -typedef const char *(DLL_CALLCONV *FI_DescriptionProc)(void); -typedef const char *(DLL_CALLCONV *FI_ExtensionListProc)(void); -typedef const char *(DLL_CALLCONV *FI_RegExprProc)(void); -typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read); -typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data); -typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data); -typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data); -typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data); -typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data); -typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle); -typedef const char *(DLL_CALLCONV *FI_MimeProc)(void); -typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp); -typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type); -typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(void); -typedef BOOL (DLL_CALLCONV *FI_SupportsNoPixelsProc)(void); - -FI_STRUCT (Plugin) { - FI_FormatProc format_proc; - FI_DescriptionProc description_proc; - FI_ExtensionListProc extension_proc; - FI_RegExprProc regexpr_proc; - FI_OpenProc open_proc; - FI_CloseProc close_proc; - FI_PageCountProc pagecount_proc; - FI_PageCapabilityProc pagecapability_proc; - FI_LoadProc load_proc; - FI_SaveProc save_proc; - FI_ValidateProc validate_proc; - FI_MimeProc mime_proc; - FI_SupportsExportBPPProc supports_export_bpp_proc; - FI_SupportsExportTypeProc supports_export_type_proc; - FI_SupportsICCProfilesProc supports_icc_profiles_proc; - FI_SupportsNoPixelsProc supports_no_pixels_proc; -}; - -typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id); - -#endif // PLUGINS - - -// Load / Save flag constants ----------------------------------------------- - -#define FIF_LOAD_NOPIXELS 0x8000 // loading: load the image header only (not supported by all plugins) - -#define BMP_DEFAULT 0 -#define BMP_SAVE_RLE 1 -#define CUT_DEFAULT 0 -#define DDS_DEFAULT 0 -#define EXR_DEFAULT 0 // save data as half with piz-based wavelet compression -#define EXR_FLOAT 0x0001 // save data as float instead of as half (not recommended) -#define EXR_NONE 0x0002 // save with no compression -#define EXR_ZIP 0x0004 // save with zlib compression, in blocks of 16 scan lines -#define EXR_PIZ 0x0008 // save with piz-based wavelet compression -#define EXR_PXR24 0x0010 // save with lossy 24-bit float compression -#define EXR_B44 0x0020 // save with lossy 44% float compression - goes to 22% when combined with EXR_LC -#define EXR_LC 0x0040 // save images with one luminance and two chroma channels, rather than as RGB (lossy compression) -#define FAXG3_DEFAULT 0 -#define GIF_DEFAULT 0 -#define GIF_LOAD256 1 // Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color -#define GIF_PLAYBACK 2 // 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading -#define HDR_DEFAULT 0 -#define ICO_DEFAULT 0 -#define ICO_MAKEALPHA 1 // convert to 32bpp and create an alpha channel from the AND-mask when loading -#define IFF_DEFAULT 0 -#define J2K_DEFAULT 0 // save with a 16:1 rate -#define JP2_DEFAULT 0 // save with a 16:1 rate -#define JPEG_DEFAULT 0 // loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420) -#define JPEG_FAST 0x0001 // load the file as fast as possible, sacrificing some quality -#define JPEG_ACCURATE 0x0002 // load the file with the best quality, sacrificing some speed -#define JPEG_CMYK 0x0004 // load separated CMYK "as is" (use | to combine with other load flags) -#define JPEG_EXIFROTATE 0x0008 // load and rotate according to Exif 'Orientation' tag if available -#define JPEG_QUALITYSUPERB 0x80 // save with superb quality (100:1) -#define JPEG_QUALITYGOOD 0x0100 // save with good quality (75:1) -#define JPEG_QUALITYNORMAL 0x0200 // save with normal quality (50:1) -#define JPEG_QUALITYAVERAGE 0x0400 // save with average quality (25:1) -#define JPEG_QUALITYBAD 0x0800 // save with bad quality (10:1) -#define JPEG_PROGRESSIVE 0x2000 // save as a progressive-JPEG (use | to combine with other save flags) -#define JPEG_SUBSAMPLING_411 0x1000 // save with high 4x1 chroma subsampling (4:1:1) -#define JPEG_SUBSAMPLING_420 0x4000 // save with medium 2x2 medium chroma subsampling (4:2:0) - default value -#define JPEG_SUBSAMPLING_422 0x8000 // save with low 2x1 chroma subsampling (4:2:2) -#define JPEG_SUBSAMPLING_444 0x10000 // save with no chroma subsampling (4:4:4) -#define JPEG_OPTIMIZE 0x20000 // on saving, compute optimal Huffman coding tables (can reduce a few percent of file size) -#define KOALA_DEFAULT 0 -#define LBM_DEFAULT 0 -#define MNG_DEFAULT 0 -#define PCD_DEFAULT 0 -#define PCD_BASE 1 // load the bitmap sized 768 x 512 -#define PCD_BASEDIV4 2 // load the bitmap sized 384 x 256 -#define PCD_BASEDIV16 3 // load the bitmap sized 192 x 128 -#define PCX_DEFAULT 0 -#define PFM_DEFAULT 0 -#define PICT_DEFAULT 0 -#define PNG_DEFAULT 0 -#define PNG_IGNOREGAMMA 1 // loading: avoid gamma correction -#define PNG_Z_BEST_SPEED 0x0001 // save using ZLib level 1 compression flag (default value is 6) -#define PNG_Z_DEFAULT_COMPRESSION 0x0006 // save using ZLib level 6 compression flag (default recommended value) -#define PNG_Z_BEST_COMPRESSION 0x0009 // save using ZLib level 9 compression flag (default value is 6) -#define PNG_Z_NO_COMPRESSION 0x0100 // save without ZLib compression -#define PNG_INTERLACED 0x0200 // save using Adam7 interlacing (use | to combine with other save flags) -#define PNM_DEFAULT 0 -#define PNM_SAVE_RAW 0 // If set the writer saves in RAW format (i.e. P4, P5 or P6) -#define PNM_SAVE_ASCII 1 // If set the writer saves in ASCII format (i.e. P1, P2 or P3) -#define PSD_DEFAULT 0 -#define PSD_CMYK 1 // reads tags for separated CMYK (default is conversion to RGB) -#define PSD_LAB 2 // reads tags for CIELab (default is conversion to RGB) -#define RAS_DEFAULT 0 -#define RAW_DEFAULT 0 // load the file as linear RGB 48-bit -#define RAW_PREVIEW 1 // try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit -#define RAW_DISPLAY 2 // load the file as RGB 24-bit -#define SGI_DEFAULT 0 -#define TARGA_DEFAULT 0 -#define TARGA_LOAD_RGB888 1 // If set the loader converts RGB555 and ARGB8888 -> RGB888. -#define TARGA_SAVE_RLE 2 // If set, the writer saves with RLE compression -#define TIFF_DEFAULT 0 -#define TIFF_CMYK 0x0001 // reads/stores tags for separated CMYK (use | to combine with compression flags) -#define TIFF_PACKBITS 0x0100 // save using PACKBITS compression -#define TIFF_DEFLATE 0x0200 // save using DEFLATE compression (a.k.a. ZLIB compression) -#define TIFF_ADOBE_DEFLATE 0x0400 // save using ADOBE DEFLATE compression -#define TIFF_NONE 0x0800 // save without any compression -#define TIFF_CCITTFAX3 0x1000 // save using CCITT Group 3 fax encoding -#define TIFF_CCITTFAX4 0x2000 // save using CCITT Group 4 fax encoding -#define TIFF_LZW 0x4000 // save using LZW compression -#define TIFF_JPEG 0x8000 // save using JPEG compression -#define TIFF_LOGLUV 0x10000 // save using LogLuv compression -#define WBMP_DEFAULT 0 -#define XBM_DEFAULT 0 -#define XPM_DEFAULT 0 - -// Background filling options --------------------------------------------------------- -// Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas - -#define FI_COLOR_IS_RGB_COLOR 0x00 // RGBQUAD color is a RGB color (contains no valid alpha channel) -#define FI_COLOR_IS_RGBA_COLOR 0x01 // RGBQUAD color is a RGBA color (contains a valid alpha channel) -#define FI_COLOR_FIND_EQUAL_COLOR 0x02 // For palettized images: lookup equal RGB color from palette -#define FI_COLOR_ALPHA_IS_INDEX 0x04 // The color's rgbReserved member (alpha) contains the palette index to be used -#define FI_COLOR_PALETTE_SEARCH_MASK (FI_COLOR_FIND_EQUAL_COLOR | FI_COLOR_ALPHA_IS_INDEX) // No color lookup is performed - - -#ifdef __cplusplus -extern "C" { -#endif - -// Init / Error routines ---------------------------------------------------- - -DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE)); -DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void); - -// Version routines --------------------------------------------------------- - -DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void); -DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void); - -// Message output functions ------------------------------------------------- - -typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg); -typedef void (DLL_CALLCONV *FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT fif, const char *msg); - -DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf); -DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf); -DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...); - -// Allocate / Clone / Unload routines --------------------------------------- - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp FI_DEFAULT(8), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); -DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib); - -// Header loading routines -DLL_API BOOL DLL_CALLCONV FreeImage_HasPixels(FIBITMAP *dib); - -// Load / Save routines ----------------------------------------------------- - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); - -// Memory I/O stream routines ----------------------------------------------- - -DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0)); -DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0)); -DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream); -DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin); -DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes); -DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream); -DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream); - -DLL_API FIMULTIBITMAP *DLL_CALLCONV FreeImage_LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveMultiBitmapToMemory(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, FIMEMORY *stream, int flags); - -// Plugin Interface --------------------------------------------------------- - -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterLocalPlugin(FI_InitProc proc_address, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterExternalPlugin(const char *path, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0)); -DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void); -DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable); -DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime); -DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif); -DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif); -DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsNoPixels(FREE_IMAGE_FORMAT fif); - -// Multipaging interface ---------------------------------------------------- - -DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL create_new, BOOL read_only, BOOL keep_cache_in_memory FI_DEFAULT(FALSE), int flags FI_DEFAULT(0)); -DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_SaveMultiBitmapToHandle(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); -DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0)); -DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap); -DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data); -DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data); -DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page); -DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page); -DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *data, BOOL changed); -DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source); -DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count); - -// Filetype request routines ------------------------------------------------ - -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0)); -DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0)); - -// Image type request routine ----------------------------------------------- - -DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib); - -// FreeImage helper routines ------------------------------------------------ - -DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void); -DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue); -DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue); - -// Pixel access routines ---------------------------------------------------- - -DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib); -DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline); - -DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); -DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); -DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); -DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); - -// DIB info routines -------------------------------------------------------- - -DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib); -DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib); - -DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res); -DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res); - -DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib); -DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib); -DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib); - -DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib); -DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib); - -DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib); -DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled); -DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count); -DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib); -DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index); -DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib); - -DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor); -DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor); - - -// ICC profile routines ----------------------------------------------------- - -DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib); -DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size); -DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib); - -// Line conversion routines ------------------------------------------------- - -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels); -DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels); - -// Smart conversion routines ------------------------------------------------ - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo4Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToGreyscale(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize FI_DEFAULT(FIQ_WUQUANT), int PaletteSize FI_DEFAULT(256), int ReserveSize FI_DEFAULT(0), RGBQUAD *ReservePalette FI_DEFAULT(NULL)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); -DLL_API void DLL_CALLCONV FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE)); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToFloat(FIBITMAP *dib); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear FI_DEFAULT(TRUE)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear FI_DEFAULT(TRUE)); - -// tone mapping operators -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param FI_DEFAULT(0), double second_param FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05Ex(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0), double adaptation FI_DEFAULT(1), double color_correction FI_DEFAULT(0)); - -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color_saturation FI_DEFAULT(0.5), double attenuation FI_DEFAULT(0.85)); - -// ZLib interface ----------------------------------------------------------- - -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); -DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size); - -// -------------------------------------------------------------------------- -// Metadata routines -------------------------------------------------------- -// -------------------------------------------------------------------------- - -// tag creation / destruction -DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag(void); -DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag); -DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag); - -// tag getters and setters -DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag); -DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag); -DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag); -DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag); -DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag); -DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag); -DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag); - -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagDescription(FITAG *tag, const char *description); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagID(FITAG *tag, WORD id); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagType(FITAG *tag, FREE_IMAGE_MDTYPE type); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagCount(FITAG *tag, DWORD count); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagLength(FITAG *tag, DWORD length); -DLL_API BOOL DLL_CALLCONV FreeImage_SetTagValue(FITAG *tag, const void *value); - -// iterator -DLL_API FIMETADATA *DLL_CALLCONV FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag); -DLL_API BOOL DLL_CALLCONV FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag); -DLL_API void DLL_CALLCONV FreeImage_FindCloseMetadata(FIMETADATA *mdhandle); - -// metadata setter and getter -DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag); -DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag); - -// helpers -DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src); - -// tag to C string conversion -DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL)); - -// -------------------------------------------------------------------------- -// Image manipulation toolkit ----------------------------------------------- -// -------------------------------------------------------------------------- - -// rotation and flipping -/// @deprecated see FreeImage_Rotate -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor FI_DEFAULT(NULL)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); -DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE)); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE)); - -// upsampling / downsampling -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert FI_DEFAULT(TRUE)); - -// color manipulation routines (point operations) -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage); -DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib); -DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK)); -DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert); -DLL_API BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert FI_DEFAULT(FALSE)); -DLL_API unsigned DLL_CALLCONV FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolors, unsigned count, BOOL ignore_alpha, BOOL swap); -DLL_API unsigned DLL_CALLCONV FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ignore_alpha); -DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstindices, unsigned count, BOOL swap); -DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b); - -// channel processing routines -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel); -DLL_API BOOL DLL_CALLCONV FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel); - -// copy / paste / composite routines -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom); -DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL)); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom); -DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCropU(const wchar_t *src_file, const wchar_t *dst_file, int left, int top, int right, int bottom); -DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib); - -// background filling routines -DLL_API BOOL DLL_CALLCONV FreeImage_FillBackground(FIBITMAP *dib, const void *color, int options FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_EnlargeCanvas(FIBITMAP *src, int left, int top, int right, int bottom, const void *color, int options FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateEx(int width, int height, int bpp, const RGBQUAD *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, const void *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0)); - -// miscellaneous algorithms -DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle FI_DEFAULT(3)); - -// restore the borland-specific enum size option -#if defined(__BORLANDC__) -#pragma option pop -#endif - -#ifdef __cplusplus -} -#endif - -#endif // FREEIMAGE_H diff --git a/DSTexCompress/FreeImage/Dist/FreeImage.lib b/DSTexCompress/FreeImage/Dist/FreeImage.lib deleted file mode 100644 index 4f96bc6..0000000 Binary files a/DSTexCompress/FreeImage/Dist/FreeImage.lib and /dev/null differ diff --git a/DSTexCompress/FreeImage/Dist/FreeImagePlus.dll b/DSTexCompress/FreeImage/Dist/FreeImagePlus.dll deleted file mode 100644 index c8efc59..0000000 Binary files a/DSTexCompress/FreeImage/Dist/FreeImagePlus.dll and /dev/null differ diff --git a/DSTexCompress/FreeImage/Dist/FreeImagePlus.h b/DSTexCompress/FreeImage/Dist/FreeImagePlus.h deleted file mode 100644 index 7c1a157..0000000 --- a/DSTexCompress/FreeImage/Dist/FreeImagePlus.h +++ /dev/null @@ -1,1639 +0,0 @@ -// ========================================================== -// FreeImagePlus 3 -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef FREEIMAGEPLUS_H -#define FREEIMAGEPLUS_H - -#ifdef _WIN32 -#include -#endif // _WIN32 -#include "FreeImage.h" - - -// Compiler options --------------------------------------------------------- - -#if defined(FREEIMAGE_LIB) - #define FIP_API - #define FIP_CALLCONV -#else - #if defined(_WIN32) || defined(__WIN32__) - #define WIN32_LEAN_AND_MEAN - #define FIP_CALLCONV __stdcall - // The following ifdef block is the standard way of creating macros which make exporting - // from a DLL simpler. All files within this DLL are compiled with the FIP_EXPORTS - // symbol defined on the command line. this symbol should not be defined on any project - // that uses this DLL. This way any other project whose source files include this file see - // FIP_API functions as being imported from a DLL, wheras this DLL sees symbols - // defined with this macro as being exported. - #ifdef FIP_EXPORTS - #define FIP_API __declspec(dllexport) - #else - #define FIP_API __declspec(dllimport) - #endif // FIP_EXPORTS - #else - // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility) - #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - #ifndef GCC_HASCLASSVISIBILITY - #define GCC_HASCLASSVISIBILITY - #endif - #endif - #define FIP_CALLCONV - #if defined(GCC_HASCLASSVISIBILITY) - #define FIP_API __attribute__ ((visibility("default"))) - #else - #define FIP_API - #endif - #endif // WIN32 / !WIN32 -#endif // FREEIMAGE_LIB - -/////////////////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------- - -/** Abstract base class for all objects used by the library. - @version FreeImage 3 - @author Herv Drolon -*/ - -class FIP_API fipObject -{ -public: - /// Destructor - virtual ~fipObject(){}; - - /**@name Information functions */ - //@{ - /// Returns TRUE if the object is allocated, FALSE otherwise - virtual BOOL isValid() const = 0; - //@} -}; - -// ---------------------------------------------------------- - -class fipMemoryIO; -class fipMultiPage; -class fipTag; - -/** A class used to manage all photo related images and all image types used by the library. - - fipImage encapsulates the FIBITMAP format. It relies on the FreeImage library, especially for - loading / saving images and for bit depth conversion. - @version FreeImage 3 - @author Herv Drolon -*/ - -class FIP_API fipImage : public fipObject -{ -protected: - /// DIB data - FIBITMAP *_dib; - /// Original (or last saved) fif format if available, FIF_UNKNOWN otherwise - FREE_IMAGE_FORMAT _fif; - /// TRUE whenever the display need to be refreshed - mutable BOOL _bHasChanged; - -public: - friend class fipMultiPage; - -public: - - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_AllocateT - */ - fipImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - /// Destructor - virtual ~fipImage(); - /** - Image allocator - @see FreeImage_AllocateT - */ - BOOL setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask = 0, unsigned green_mask = 0, unsigned blue_mask = 0); - /// Destroy image data - virtual void clear(); - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage(const fipImage& src); - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage& operator=(const fipImage& src); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FIBITMAP*() - */ - fipImage& operator=(FIBITMAP *dib); - - - /** - @brief Copy a sub part of the current image and returns it as a fipImage object. - - This method works with any bitmap type. - @param dst Output subimage - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Copy - */ - BOOL copySubImage(fipImage& dst, int left, int top, int right, int bottom) const; - - /** - @brief Alpha blend or combine a sub part image with the current image. - - The bit depth of dst bitmap must be greater than or equal to the bit depth of src. - Upper promotion of src is done internally. Supported bit depth equals to 4, 8, 16, 24 or 32. - @param src Source subimage - @param left Specifies the left position of the sub image. - @param top Specifies the top position of the sub image. - @param alpha Alpha blend factor. The source and destination images are alpha blended if - alpha = 0..255. If alpha > 255, then the source image is combined to the destination image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Paste - */ - BOOL pasteSubImage(fipImage& src, int left, int top, int alpha = 256); - - /** - @brief Crop a sub part of the current image and update it accordingly. - - This method works with any bitmap type. - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - */ - BOOL crop(int left, int top, int right, int bottom); - - //@} - - /** @name File type identification - */ - //@{ - /** - @brief Identifies an image from disk, given its file name - @param lpszPathName Path and file name of the image to identify. - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIF(const char* lpszPathName); - - /** - UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS) - @see FreeImage_GetFileTypeU, FreeImage_GetFIFFromFilenameU, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFU(const wchar_t* lpszPathName); - - /** - @brief Identifies an image using the specified FreeImageIO struct and fi_handle. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromHandle, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle); - - /** - @brief Identifies an image using the specified memory stream. - @param hmem FreeImage memory stream - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromMemory, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem); - - //@} - - - /** @name Loading & Saving - * Loading and saving is handled by the FreeImage library. - */ - //@{ - /** - @brief Loads an image from disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to load. - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Load, FreeImage documentation - */ - BOOL load(const char* lpszPathName, int flag = 0); - - /** - UNICODE version of load (this function only works under WIN32 and does nothing on other OS) - @see load - */ - BOOL loadU(const wchar_t* lpszPathName, int flag = 0); - - /** - @brief Loads an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromHandle, FreeImage documentation - */ - BOOL loadFromHandle(FreeImageIO *io, fi_handle handle, int flag = 0); - - /** - @brief Loads an image using the specified memory stream and an optional flag. - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromMemory, FreeImage documentation - */ - BOOL loadFromMemory(fipMemoryIO& memIO, int flag = 0); - - /** - @brief Saves an image to disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to save. - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Save, FreeImage documentation - */ - BOOL save(const char* lpszPathName, int flag = 0) const; - - /** - UNICODE version of save (this function only works under WIN32 and does nothing on other OS) - @see save - */ - BOOL saveU(const wchar_t* lpszPathName, int flag = 0) const; - - /** - @brief Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag = 0) const; - - /** - @brief Saves an image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0) const; - - //@} - - /** @name Information functions - * Accessors to the DIB BITMAPINFO structure. - */ - //@{ - - /** - Returns the data type of the image - @see FreeImage_GetImageType - */ - FREE_IMAGE_TYPE getImageType() const; - - /** - Returns the image width in pixels - @see FreeImage_GetWidth - */ - unsigned getWidth() const; - - /** - Returns the image height in pixels - @see FreeImage_GetHeight - */ - unsigned getHeight() const; - - /** - Returns the width of the bitmap in bytes rounded to the nearest DWORD. - @see FreeImage_GetPitch - */ - unsigned getScanWidth() const; - - /** - Returns a pointer to the FIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions.
- Sample use :
-

-	fipImage src, dst;
-	src.load("test.png");
-	dst = FreeImage_ConvertTo8Bits(src);
-	FreeImage_Save(FIF_TIFF, dst, "test.tif", 0);
-	
- @see operator=(FIBITMAP *dib) - */ - operator FIBITMAP*() { - return _dib; - } - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - - /** - Returns a pointer to the bitmap's BITMAPINFO header. - @see FreeImage_GetInfo - */ - BITMAPINFO* getInfo() const; - - /** - Returns a pointer to the bitmap's BITMAPINFOHEADER. - @see FreeImage_GetInfoHeader - */ - BITMAPINFOHEADER* getInfoHeader() const; - - /** - Returns the size of the bitmap in bytes. - The size of the bitmap is the BITMAPINFOHEADER + the size of the palette + the size of the bitmap data. - @see FreeImage_GetDIBSize - */ - LONG getImageSize() const; - - /** - Returns the bitdepth of the bitmap.
- When the image type is FIT_BITMAP, valid bitdepth can be 1, 4, 8, 16, 24 or 32. - @see FreeImage_GetBPP, getImageType - */ - unsigned getBitsPerPixel() const; - - /** - Returns the width of the bitmap in bytes.
- This is not the size of the scanline. - @see FreeImage_GetLine, getScanWidth - */ - unsigned getLine() const; - - /** - Returns the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetDotsPerMeterX - */ - double getHorizontalResolution() const; - - /** - Returns the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetDotsPerMeterY - */ - double getVerticalResolution() const; - - /** - set the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setHorizontalResolution(double value); - - /** - set the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setVerticalResolution(double value); - - //@} - - /**@name Palette operations */ - //@{ - /** - Returns a pointer to the bitmap's palette. If the bitmap doesn't have a palette, getPalette returns NULL. - @see FreeImage_GetPalette - */ - RGBQUAD* getPalette() const; - - /** - Returns the palette size in bytes. - @see FreeImage_GetColorsUsed - */ - unsigned getPaletteSize() const; - - /** - Retrieves the number of colours used in the bitmap. If the bitmap is non-palletised, 0 is returned. - @see FreeImage_GetColorsUsed - */ - unsigned getColorsUsed() const; - - /** - Investigates the colour type of the bitmap. - @see FreeImage_GetColorType, FREE_IMAGE_COLOR_TYPE - */ - FREE_IMAGE_COLOR_TYPE getColorType() const; - - /** - Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise - @see FreeImage_GetBPP, FreeImage_GetColorType - */ - BOOL isGrayscale() const; - //@} - - /**@name Pixel access */ - //@{ - - /** @brief Returns a pointer to the bitmap bits. - - It is up to you to interpret these bytes correctly, - according to the results of FreeImage_GetBPP and - GetRedMask, FreeImage_GetGreenMask and FreeImage_GetBlueMask.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetBits - */ - BYTE* accessPixels() const; - - /** @brief Returns a pointer to the start of the given scanline in the bitmaps data-bits. - This pointer can be cast according to the result returned by getImageType.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetScanLine, FreeImage documentation - */ - BYTE* getScanLine(unsigned scanline) const; - - /** - Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index (returned value) - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_GetPixelIndex - */ - BOOL getPixelIndex(unsigned x, unsigned y, BYTE *value) const; - - /** - Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color (returned value) - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_GetPixelColor - */ - BOOL getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const; - - /** - Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_SetPixelIndex - */ - BOOL setPixelIndex(unsigned x, unsigned y, BYTE *value); - - /** - Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_SetPixelColor - */ - BOOL setPixelColor(unsigned x, unsigned y, RGBQUAD *value); - - //@} - - /** @name Conversion routines - * Bitmaps are always loaded in their default bit depth. If you want the bitmap to be stored in another bit depth, the class provides several conversion functions. - */ - //@{ - /** - Converts an image to a type supported by FreeImage. - @param image_type New image type - @param scale_linear TRUE if image pixels must be scaled linearly when converting to a standard bitmap - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertToType, FreeImage_ConvertToStandardType - */ - BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear = TRUE); - - /** - Converts the bitmap to 1 bit using a threshold T. - @param T Threshold value in [0..255] - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_Threshold - */ - BOOL threshold(BYTE T); - - /** - Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm. - @param algorithm Dithering algorithm to use. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_Dither, FREE_IMAGE_DITHER - */ - BOOL dither(FREE_IMAGE_DITHER algorithm); - - /** - Converts the bitmap to 4 bits. Unless the bitmap is a 1-bit palettized bitmap, colour values are converted to greyscale. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo4Bits - */ - BOOL convertTo4Bits(); - - /** - Converts the bitmap to 8 bits. If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo8Bits - */ - BOOL convertTo8Bits(); - - /** - Converts the bitmap to 8 bits.
- For palletized bitmaps, the color map is converted to a greyscale ramp. - @see FreeImage_ConvertToGreyscale - @return Returns TRUE if successfull, FALSE otherwise. - */ - BOOL convertToGrayscale(); - - /** - Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
- The quantize parameter specifies which colour reduction algorithm should be used. - @param algorithm Color quantization algorithm to use. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ColorQuantize, FREE_IMAGE_QUANTIZE - */ - BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 5 bits green, 5 bits blue and 1 unused bit. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo16Bits555 - */ - BOOL convertTo16Bits555(); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits blue. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo16Bits565 - */ - BOOL convertTo16Bits565(); - - /** - Converts the bitmap to 24 bits. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo24Bits - */ - BOOL convertTo24Bits(); - - /** - Converts the bitmap to 32 bits. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo32Bits - */ - BOOL convertTo32Bits(); - - /** - Converts the bitmap to a 96-bit RGBF image. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertToRGBF - */ - BOOL convertToRGBF(); - - /** - Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter (algorithm dependant) - @param second_param Second tone mapping algorithm parameter (algorithm dependant) - @param third_param Third tone mapping algorithm parameter (algorithm dependant) - @param fourth_param Fourth tone mapping algorithm parameter (algorithm dependant) - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ToneMapping, FreeImage_TmoReinhard05Ex - */ - BOOL toneMapping(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - //@} - - /** @name Transparency support: background colour and alpha channel */ - //@{ - - /** - Returns TRUE if the image is transparent, returns FALSE otherwise - @see FreeImage_IsTransparent - */ - BOOL isTransparent() const; - - /** - 8-bit transparency : get the number of transparent colors. - @return Returns the number of transparent colors in a palletised bitmap. - @see FreeImage_GetTransparencyCount - */ - unsigned getTransparencyCount() const; - - /** - 8-bit transparency : get the bitmaps transparency table. - @return Returns a pointer to the bitmaps transparency table. - @see FreeImage_GetTransparencyTable - */ - BYTE* getTransparencyTable() const; - - /** - 8-bit transparency : set the bitmaps transparency table. - @see FreeImage_SetTransparencyTable - */ - void setTransparencyTable(BYTE *table, int count); - - /** - Returns TRUE when the image has a file background color, FALSE otherwise. - @see FreeImage_HasBackgroundColor - */ - BOOL hasFileBkColor() const; - - /** - @brief Retrieves the file background color of an image. - - For 8-bit images, the color index - in the palette is returned in the rgbReserved member of the bkcolor parameter. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetBackgroundColor - */ - BOOL getFileBkColor(RGBQUAD *bkcolor) const; - - /** - @brief Set the file background color of an image. - - When saving an image to PNG, this background color is transparently saved to the PNG file. - When the bkcolor parameter is NULL, the background color is removed from the image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetBackgroundColor - */ - BOOL setFileBkColor(RGBQUAD *bkcolor); - //@} - - /**@name Channel processing support */ - //@{ - /** @brief Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] image. - @param image Output image to be extracted - @param channel Color channel to extract - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const; - - /** - @brief Insert a 8-bit dib into a 24- or 32-bit image. - @param image Input 8-bit image to insert - @param channel Color channel to replace - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Split a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels. - @param RedChannel Output red channel. - @param GreenChannel Output green channel. - @param BlueChannel Output blue channel. - @return Returns FALSE if the dib isn't a valid image, if it's not a 24-bit image or if - one of the output channel can't be allocated. Returns TRUE otherwise. - @see FreeImage_GetChannel - */ - BOOL splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel); - - /** @brief Builds a 24-bit RGB image given its red, green and blue channel. - @param red Input red channel. - @param green Input green channel. - @param blue Input blue channel. - @return Returns FALSE if the dib can't be allocated, if the input channels are not 8-bit images. Returns TRUE otherwise. - @see FreeImage_SetChannel - */ - BOOL combineChannels(fipImage& red, fipImage& green, fipImage& blue); - //@} - - /**@name Rotation and flipping */ - //@{ - /** - Image translation and rotation using B-Splines. - @param angle Image rotation angle, in degree - @param x_shift Image horizontal shift - @param y_shift Image vertical shift - @param x_origin Origin of the x-axis - @param y_origin Origin of the y-axis - @param use_mask Whether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE - @return Returns the translated & rotated dib if successful, returns NULL otherwise - @see FreeImage_RotateEx - */ - BOOL rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); - - /** - Image rotation by means of three shears. - @param angle Image rotation angle, in degree - @param bkcolor Background color (image type dependent), default to black background - @return Returns rotated dib if successful, returns NULL otherwise - @see FreeImage_Rotate - */ - BOOL rotate(double angle, const void *bkcolor = NULL); - - /** - Flip the image horizontally along the vertical axis - @see FreeImage_FlipHorizontal - */ - BOOL flipHorizontal(); - - /** - Flip the image vertically along the horizontal axis - @see FreeImage_FlipVertical - */ - BOOL flipVertical(); - //@} - - /**@name Color manipulation routines */ - //@{ - /** - Inverts each pixel data. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Invert - */ - BOOL invert(); - - /** @brief Perfoms an histogram transformation on a 8, 24 or 32-bit image - according to the values of a lookup table (LUT). - - The transformation is done as follows.
- Image 8-bit : if the image has a color palette, the LUT is applied to this palette, - otherwise, it is applied to the grey values.
- Image 24-bit & 32-bit : if channel == IPL_CC_RGB, the same LUT is applied to each color - plane (R,G, and B). Otherwise, the LUT is applied to the specified channel only. - @param LUT Lookup table. The size of 'LUT' is assumed to be 256. - @param channel The color channel to be processed (only used with 24 & 32-bit DIB). - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustCurve, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Performs gamma correction on a 8, 24 or 32-bit image. - @param gamma Gamma value to use. A value of 1.0 leaves the image alone, - less than one darkens it, and greater than one lightens it. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustGamma, adjustCurve - */ - BOOL adjustGamma(double gamma); - - /** @brief Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will make the image darker - and greater than 0 will make the image brighter. - @return Returns TRUE if the operation was succesful, FALSE otherwise - @see FreeImage_AdjustBrightness, adjustCurve - */ - BOOL adjustBrightness(double percentage); - - /** @brief Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_AdjustContrast, adjustCurve - */ - BOOL adjustContrast(double percentage); - - /** - Adjusts an image's brightness, contrast and gamma within a single operation. - If more than one of these image display properties need to be adjusted, - using this function should be preferred over calling each adjustment function separately. - That's particularly true for huge images or if performance is an issue. - @see adjustBrightness - @see adjustContrast - @see adjustGamma - @see FreeImage_AdjustColors - */ - BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma); - - /** @brief Computes image histogram - - For 24-bit and 32-bit images, histogram can be computed from red, green, blue and - black channels. For 8-bit images, histogram is computed from the black channel. Other - bit depth is not supported. - @param histo pointer to an histogram array. Size of this array is assumed to be 256. - @param channel Color channel to use - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetHistogram - */ - BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel = FICC_BLACK) const; - //@} - - /**@name Upsampling / downsampling */ - //@{ - - /** @brief Rescale the image to a new width / height. - - @param new_width New image width - @param new_height New image height - @param filter The filter parameter specifies which resampling filter should be used. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_Rescale, FREE_IMAGE_FILTER - */ - BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter); - - /** @brief Creates a thumbnail image keeping aspect ratio - - @param max_size Maximum width or height in pixel units - @param convert When set to TRUE, converts the image to a standard type - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_MakeThumbnail - */ - BOOL makeThumbnail(unsigned max_size, BOOL convert = TRUE); - //@} - - /**@name Image status */ - //@{ - /** - Set the image status as 'modified'.
- When using the fipWinImage class, the image status is used to refresh the display. - It is changed to FALSE whenever the display has just been refreshed. - @param bStatus TRUE if the image should be marked as modified, FALSE otherwise - @see isModified - */ - void setModified(BOOL bStatus = TRUE) { - _bHasChanged = bStatus; - } - - /** - Get the image status - @return Returns TRUE if the image is marked as modified, FALSE otherwise - @see setModified - */ - BOOL isModified() { - return _bHasChanged; - } - //@} - - /**@name Metadata */ - //@{ - /** - Returns the number of tags contained in the model metadata model - attached to the dib - @param model Metadata model to look for - */ - unsigned getMetadataCount(FREE_IMAGE_MDMODEL model) const; - /** - Retrieve a metadata attached to the dib - @param model Metadata model to look for - @param key Metadata field name - @param tag Returned tag - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetMetadata - */ - BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const; - /** - Attach a new FreeImage tag to the dib.
- Sample use :
-
-	fipImage image;
-	// ...
-	fipTag tag;
-	tag.setKeyValue("Caption/Abstract", "my caption");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	tag.setKeyValue("Keywords", "FreeImage;Library;Images;Compression");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	
- - @param model Metadata model used to store the tag - @param key Tag field name - @param tag Tag to be attached - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_SetMetadata - */ - BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag); - //@} - - - protected: - /**@name Internal use */ - //@{ - BOOL replace(FIBITMAP *new_dib); - //@} - -}; - -// ---------------------------------------------------------- - -/** A class designed for MS Windows (TM) platforms. - - fipWinImage provides methods used to : -
    -
  • Display a DIB on the screen -
  • Copy / Paste a DIB to/from Windows devices (HANDLE, HBITMAP, Clipboard) -
  • Capture a window (HWND) and convert it to an image -
- @version FreeImage 3 - @author Herv Drolon -*/ -#ifdef _WIN32 - -class FIP_API fipWinImage : public fipImage -{ -public: - /**@name Creation & Destruction */ - //@{ - /// Constructor - fipWinImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - - /// Destructor - virtual ~fipWinImage(); - - /// Destroy image data - virtual void clear(); - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - //@} - - /**@name Copying */ - //@{ - - /** - Copy constructor. - Delete internal _display_dib data and copy the base class image data. - Tone mapping parameters are left unchanged. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipImage& src); - - /** - Copy constructor - Delete internal _display_dib data and copy tone mapping parameters. - Copy also the base class image data. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipWinImage& src); - - /** Clone function used for clipboard copy.
- Convert the FIBITMAP image to a DIB, - and transfer the DIB in a global bitmap handle.
- For non standard bitmaps, the BITMAPINFOHEADER->biCompression field is set to 0xFF + FreeImage_GetImageType(_dib), - in order to recognize the bitmap as non standard. - */ - HANDLE copyToHandle() const; - - /** Copy constructor used for clipboard paste.
- Converts a global object to a FIBITMAP. The clipboard format must be CF_DIB.
- When the BITMAPINFOHEADER->biCompression field is set to 0xFF + [one of the predefined FREE_IMAGE_TYPE], - the bitmap is recognized as non standard and correctly copied. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromHandle(HANDLE hMem); - - /** Copy constructor.
- Converts a HBITMAP object to a FIBITMAP. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromBitmap(HBITMAP hbmp); - //@} - - /**@name Clipboard operations */ - //@{ - /** - Clipboard copy. - @param hWndNewOwner Handle to the window to be associated with the open clipboard. - In MFC, you can use AfxGetApp()->m_pMainWnd->GetSafeHwnd(). - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyToClipboard(HWND hWndNewOwner) const; - - /** - Retrieves data from the clipboard. The clipboard format must be CF_DIB. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL pasteFromClipboard(); - //@} - - /**@name Screen capture */ - //@{ - /** Capture a window and convert it to an image - @param hWndApplicationWindow Handle to the application main window - @param hWndSelectedWindow Handle to the window to be captured - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow); - //@} - - - /**@name Painting operations */ - //@{ - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function composite - the foreground image against a checkerboard background image. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @see FreeImage_Composite - */ - void draw(HDC hDC, RECT& rcDest) const { - drawEx(hDC, rcDest, FALSE, NULL, NULL); - } - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function can composite - the foreground image against a checkerboard background image, against a single background color or - against a user background image.
- When the image is a High Dynamic Range image (48-bit or RGB float), this function will apply a - tone mapping operator before drawing the image.
- The original image (located in the fipImage class) will not be affected by any of the operations - that could be done in order to display it. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @param useFileBkg When set to TRUE, the function uses the file color background if there is one - @param appBkColor When a color is given, the function uses it as the background color - @param bg When a FIBITMAP is given, the function uses it as the background image - @see FreeImage_Composite - @see setToneMappingOperator - */ - void drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg = FALSE, RGBQUAD *appBkColor = NULL, FIBITMAP *bg = NULL) const; - - /** - Select a tone mapping algorithm used for drawing and set the image as modified - so that the display will be refreshed. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - /** - Get the tone mapping algorithm used for drawing, with its parameters. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const; - - //@} - -protected: - /// DIB used for display (this allow to display non-standard bitmaps) - mutable FIBITMAP *_display_dib; - /// remember to delete _display_dib - mutable BOOL _bDeleteMe; - /// tone mapping operator - FREE_IMAGE_TMO _tmo; - /// first tone mapping algorithm parameter - double _tmo_param_1; - /// second tone mapping algorithm parameter - double _tmo_param_2; - /// third tone mapping algorithm parameter - double _tmo_param_3; - /// fourth tone mapping algorithm parameter - double _tmo_param_4; -}; - -#endif // _WIN32 - -// ---------------------------------------------------------- - -/** Memory handle - - fipMemoryIO is a class that allows you to load / save images from / to a memory stream. - @version FreeImage 3 - @author Herv Drolon -*/ -class FIP_API fipMemoryIO : public fipObject -{ -protected: - /// Pointer to a memory stream - FIMEMORY *_hmem; - -public : - /** Constructor. - Wrap a memory buffer containing image data.
- The memory buffer is read only and has to be freed by the user - when no longer in use.
- When default arguments are used, open a memory file as read/write. - @param data Pointer to the memory buffer - @param size_in_bytes Buffer size in bytes - @see FreeImage_OpenMemory - */ - fipMemoryIO(BYTE *data = NULL, DWORD size_in_bytes = 0); - - /** Destructor. - Free any allocated memory - @see FreeImage_CloseMemory - */ - virtual ~fipMemoryIO(); - - /** Destructor. - Free any allocated memory and invalidate the stream - @see FreeImage_CloseMemory - */ - void close(); - - /** Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise - */ - BOOL isValid() const; - - /** Returns the buffer image format - @see FreeImage_GetFileTypeFromMemory - */ - FREE_IMAGE_FORMAT getFileType() const; - - /** - Returns a pointer to the FIMEMORY data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMEMORY*() { - return _hmem; - } - - /**@name Memory IO routines */ - //@{ - /** - Loads a dib from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the image to be loaded. - @return Returns the loaded dib if successful, returns NULL otherwise - @see FreeImage_LoadFromMemory - */ - FIBITMAP* load(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Loads a multi-page bitmap from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the multi-page to be loaded. - @return Returns the loaded multi-page if successful, returns NULL otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - FIMULTIBITMAP* loadMultiPage(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Saves a dib to a memory stream - @param fif Format identifier (FreeImage format) - @param dib Image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveToMemory - */ - BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags = 0); - /** - Saves a multi-page bitmap to a memory stream - @param fif Format identifier (FreeImage format) - @param bitmap Multi-page image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveMultiBitmapToMemory - */ - BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags = 0); - /** - Reads data from a memory stream - @param buffer Storage location for data - @param size Item size in bytes - @param count Maximum number of items to be read - @return Returns the number of full items actually read, which may be less than count if an error occurs - @see FreeImage_ReadMemory - */ - unsigned read(void *buffer, unsigned size, unsigned count) const; - /** - Writes data to a memory stream - @param buffer Pointer to data to be written - @param size Item size in bytes - @param count Maximum number of items to be written - @return Returns the number of full items actually written, which may be less than count if an error occurs - @see FreeImage_WriteMemory - */ - unsigned write(const void *buffer, unsigned size, unsigned count); - /** - Gets the current position of a memory pointer - @see FreeImage_TellMemory - */ - long tell() const; - /** - Moves the memory pointer to a specified location - @see FreeImage_SeekMemory - */ - BOOL seek(long offset, int origin); - /** - Provides a direct buffer access to a memory stream - @param data Pointer to the memory buffer (returned value) - @param size_in_bytes Buffer size in bytes (returned value) - @see FreeImage_AcquireMemory - */ - BOOL acquire(BYTE **data, DWORD *size_in_bytes); - //@} - -private: - /// Disable copy - fipMemoryIO(const fipMemoryIO& src); - /// Disable copy - fipMemoryIO& operator=(const fipMemoryIO& src); - -}; - -// ---------------------------------------------------------- - -/** Multi-page file stream - - fipMultiPage encapsulates the multi-page API. It supports reading/writing - multi-page TIFF, ICO and GIF files. -*/ -class FIP_API fipMultiPage : public fipObject -{ -protected: - /// Pointer to a multi-page file stream - FIMULTIBITMAP *_mpage; - /// TRUE when using a memory cache, FALSE otherwise - BOOL _bMemoryCache; - -public: - /** - Constructor - @param keep_cache_in_memory When it is TRUE, all gathered bitmap data in the page manipulation process is kept in memory, otherwise it is lazily flushed to a temporary file on the hard disk in 64 Kb blocks. - */ - fipMultiPage(BOOL keep_cache_in_memory = FALSE); - - /** - Destructor - Close the file stream if not already done. - */ - virtual ~fipMultiPage(); - - /// Returns TRUE if the multi-page stream is opened - BOOL isValid() const; - - /** - Returns a pointer to the FIMULTIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMULTIBITMAP*() { - return _mpage; - } - - /** - Open a multi-page file stream - @param lpszPathName Name of the multi-page bitmap file - @param create_new When TRUE, it means that a new bitmap will be created rather than an existing one being opened - @param read_only When TRUE the bitmap is opened read-only - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_OpenMultiBitmap - */ - BOOL open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags = 0); - - /** - Open a multi-page memory stream as read/write. - @param memIO Memory stream. The memory stream MUST BE a wrapped user buffer. - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - BOOL open(fipMemoryIO& memIO, int flags = 0); - - /** - Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_OpenMultiBitmapFromHandle - */ - BOOL open(FreeImageIO *io, fi_handle handle, int flags = 0); - - /** - Close a file stream - @param flags Save flags. The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CloseMultiBitmap - */ - BOOL close(int flags = 0); - - /** - Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the multi-page image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags = 0) const; - - /** - Saves a multi-page image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags = 0) const; - - /** - Returns the number of pages currently available in the multi-paged bitmap - @see FreeImage_GetPageCount - */ - int getPageCount() const; - - /** - Appends a new page to the end of the bitmap - @param image Image to append - @see FreeImage_AppendPage - */ - void appendPage(fipImage& image); - - /** - Inserts a new page before the given position in the bitmap - @param page Page number. Page has to be a number smaller than the current number of pages available in the bitmap. - @param image Image to insert - @see FreeImage_InsertPage - */ - void insertPage(int page, fipImage& image); - - /** - Deletes the page on the given position - @param page Page number - @see FreeImage_DeletePage - */ - void deletePage(int page); - - /** - Moves the source page to the position of the target page. - @param target Target page position - @param source Source page position - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_MovePage - */ - BOOL movePage(int target, int source); - - /** - Locks a page in memory for editing. You must call unlockPage to free the page
- Usage :
-
-	fipMultiPage mpage;
-	// ...
-	fipImage image;		// You must declare this before
-	image = mpage.lockPage(2);
-	if(image.isValid()) {
-	  // ...
-	  mpage.unlockPage(image, TRUE);
-	}
-	
- @param page Page number - @return Returns the page if successful, returns NULL otherwise - @see FreeImage_LockPage - */ - FIBITMAP* lockPage(int page); - - /** - Unlocks a previously locked page and gives it back to the multi-page engine - @param image Page to unlock - @param changed When TRUE, the page is marked changed and the new page data is applied in the multi-page bitmap. - @see FreeImage_UnlockPage - */ - void unlockPage(fipImage& image, BOOL changed); - - /** - Returns an array of page-numbers that are currently locked in memory. - When the pages parameter is NULL, the size of the array is returned in the count variable. - You can then allocate the array of the desired size and call - getLockedPageNumbers again to populate the array. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_GetLockedPageNumbers - */ - BOOL getLockedPageNumbers(int *pages, int *count) const; -}; - -// ---------------------------------------------------------- - -/** -FreeImage Tag - -FreeImage uses this structure to store metadata information. -*/ -class FIP_API fipTag : public fipObject -{ -protected: - /// Pointer to a FreeImage tag - FITAG *_tag; - -public: - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_CreateTag - */ - fipTag(); - /** - Destructor - @see FreeImage_DeleteTag - */ - virtual ~fipTag(); - /** - Construct a FIDT_ASCII tag (ASCII string).
- This method is useful to store comments or IPTC tags. - @param name Field name - @param value Field value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CreateTag - */ - BOOL setKeyValue(const char *key, const char *value); - - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag(const fipTag& tag); - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag& operator=(const fipTag& tag); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FITAG*() - */ - fipTag& operator=(FITAG *tag); - //@} - - /** - Returns a pointer to the FITAG data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - @see operator=(FITAG *tag) - */ - operator FITAG*() { - return _tag; - } - - /// Returns TRUE if the tag is allocated, FALSE otherwise - BOOL isValid() const; - - /**@name Tag accessors */ - //@{ - /** - Returns the tag field name (unique inside a metadata model). - @see FreeImage_GetTagKey - */ - const char *getKey() const; - /** - Returns the tag description if available, returns NULL otherwise - @see FreeImage_GetTagDescription - */ - const char *getDescription() const; - /** - Returns the tag ID if available, returns 0 otherwise - @see FreeImage_GetTagID - */ - WORD getID() const; - /** - Returns the tag data type - @see FreeImage_GetTagType - */ - FREE_IMAGE_MDTYPE getType() const; - /** - Returns the number of components in the tag (in tag type units) - @see FreeImage_GetTagCount - */ - DWORD getCount() const; - /** - Returns the length of the tag value in bytes - @see FreeImage_GetTagLength - */ - DWORD getLength() const; - /** - Returns the tag value - @see FreeImage_GetTagValue - */ - const void *getValue() const; - /** - Set the tag field name - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagKey - */ - BOOL setKey(const char *key); - /** - Set the (usually optional) tag description - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagDescription - */ - BOOL setDescription(const char *description); - /** - Set the (usually optional) tad ID - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagID - */ - BOOL setID(WORD id); - /** - Set the tag data type - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagType - */ - BOOL setType(FREE_IMAGE_MDTYPE type); - /** - Set the number of data in the tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagCount - */ - BOOL setCount(DWORD count); - /** - Set the length of the tag value, in bytes - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagLength - */ - BOOL setLength(DWORD length); - /** - Set the tag value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagValue - */ - BOOL setValue(const void *value); - - //@} - - /** - Converts a FreeImage tag structure to a string that represents the interpreted tag value - @param model Metadata model specification (metadata model from which the tag was extracted) - @param Make Camera model (not used yet) - */ - const char* toString(FREE_IMAGE_MDMODEL model, char *Make = NULL) const; - -}; - -/** -Metadata iterator - -Usage :
-
-fipImage image;
-// ...
-fipTag tag;
-fipMetadataFind finder;
-if( finder.findFirstMetadata(FIMD_EXIF_MAIN, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-// the class can be called again with another metadata model
-if( finder.findFirstMetadata(FIMD_EXIF_EXIF, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-
-*/ -class FIP_API fipMetadataFind : public fipObject -{ -protected: - /// Pointer to a search handle - FIMETADATA *_mdhandle; - -public: - /// Returns TRUE if the search handle is allocated, FALSE otherwise - BOOL isValid() const; - - /// Constructor - fipMetadataFind(); - /** - Destructor - @see FreeImage_FindCloseMetadata - */ - virtual ~fipMetadataFind(); - /** - Provides information about the first instance of a tag that matches - the metadata model specified in the model argument. - @param model Metadata model - @param image Input image - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_FindFirstMetadata - */ - BOOL findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag); - /** - Find the next tag, if any, that matches the metadata model argument - in a previous call to findFirstMetadata - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise, indicating that no more matching tags could be found - @see FreeImage_FindNextMetadata - */ - BOOL findNextMetadata(fipTag& tag); - -}; - -#endif // FREEIMAGEPLUS_H diff --git a/DSTexCompress/FreeImage/Dist/FreeImagePlus.lib b/DSTexCompress/FreeImage/Dist/FreeImagePlus.lib deleted file mode 100644 index aaf532b..0000000 Binary files a/DSTexCompress/FreeImage/Dist/FreeImagePlus.lib and /dev/null differ diff --git a/DSTexCompress/FreeImage/Dist/delete.me b/DSTexCompress/FreeImage/Dist/delete.me deleted file mode 100644 index e69de29..0000000 diff --git a/DSTexCompress/FreeImage/Examples/Generic/BatchLoad.cpp b/DSTexCompress/FreeImage/Examples/Generic/BatchLoad.cpp deleted file mode 100644 index 1612050..0000000 --- a/DSTexCompress/FreeImage/Examples/Generic/BatchLoad.cpp +++ /dev/null @@ -1,214 +0,0 @@ -// ========================================================== -// Batch loader -// -// Design and implementation by -// - Floris van den Berg -// - Herv Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// -// This example shows how to easily batch load a directory -// full of images. Because not all formats can be identified -// by their header (some images don't have a header or one -// at the end of the file) we make use of the -// FreeImage_GetFIFFromFilename function. This function -// receives a file name, for example 'myfile.bmp', and returns -// a FREE_IMAGE_TYPE enum which identifies that bitmap. -// -// Functions used in this sample : -// FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage_FIFSupportsReading, -// FreeImage_Load, FreeImage_GetBPP, FreeImage_FIFSupportsWriting, FreeImage_GetFormatFromFIF -// FreeImage_FIFSupportsExportBPP, FreeImage_Save, FreeImage_Unload, -// FreeImage_SetOutputMessage, FreeImage_GetVersion, FreeImage_GetCopyrightMessage -// -// ========================================================== - -#include -#include -#include -#include -#include - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** Generic image loader - @param lpszPathName Pointer to the full file name - @param flag Optional load flag constant - @return Returns the loaded dib if successful, returns NULL otherwise -*/ -FIBITMAP* GenericLoader(const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and deduce its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileType(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - } - // check that the plugin has reading capabilities ... - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // ok, let's load the file - FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, flag); - // unless a bad file format, we are done ! - return dib; - } - return NULL; -} - -/** Generic image writer - @param dib Pointer to the dib to be saved - @param lpszPathName Pointer to the full file name - @param flag Optional save flag constant - @return Returns true if successful, returns false otherwise -*/ -bool GenericWriter(FIBITMAP* dib, const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - BOOL bSuccess = FALSE; - - if(dib) { - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - if(fif != FIF_UNKNOWN ) { - // check that the plugin has sufficient writing and export capabilities ... - WORD bpp = FreeImage_GetBPP(dib); - if(FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)) { - // ok, we can save the file - bSuccess = FreeImage_Save(fif, dib, lpszPathName, flag); - // unless an abnormal bug, we are done ! - } - } - } - return (bSuccess == TRUE) ? true : false; -} - -// ---------------------------------------------------------- - -/** - FreeImage error handler - @param fif Format / Plugin responsible for the error - @param message Error message -*/ -void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) { - printf("\n*** "); - if(fif != FIF_UNKNOWN) { - printf("%s Format\n", FreeImage_GetFormatFromFIF(fif)); - } - printf(message); - printf(" ***\n"); -} - -// ---------------------------------------------------------- - -#ifndef MAX_PATH -#define MAX_PATH 260 -#endif - -int -main(int argc, char *argv[]) { - - const char *input_dir = "d:\\images\\"; - FIBITMAP *dib = NULL; - int id = 1; - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize your own FreeImage error handler - - FreeImage_SetOutputMessage(FreeImageErrorHandler); - - // print version & copyright infos - - printf(FreeImage_GetVersion()); - printf("\n"); - printf(FreeImage_GetCopyrightMessage()); - printf("\n"); - - // open the log file - - FILE *log_file = fopen("log_file.txt", "w"); - - // batch convert all supported bitmaps - - _finddata_t finddata; - long handle; - char image_path[MAX_PATH]; - - // scan all files - strcpy(image_path, input_dir); - strcat(image_path, "*.*"); - - if ((handle = _findfirst(image_path, &finddata)) != -1) { - do { - // make a path to a directory - - char *directory = new char[MAX_PATH]; - strcpy(directory, input_dir); - strcat(directory, finddata.name); - - // make a unique filename - - char *unique = new char[128]; - itoa(id, unique, 10); - strcat(unique, ".png"); - - // open and load the file using the default load option - dib = GenericLoader(directory, 0); - - if (dib != NULL) { - // save the file as PNG - bool bSuccess = GenericWriter(dib, unique, PNG_DEFAULT); - - // free the dib - FreeImage_Unload(dib); - - if(bSuccess) { - fwrite(unique, strlen(unique), 1, log_file); - } else { - strcpy(unique, "FAILED"); - fwrite(unique, strlen(unique), 1, log_file); - } - fwrite(" >> ", 4, 1, log_file); - fwrite(directory, strlen(directory), 1, log_file); - fwrite("\n", 1, 1, log_file); - - id++; - } - - delete [] unique; - delete [] directory; - - } while (_findnext(handle, &finddata) == 0); - - _findclose(handle); - } - - fclose(log_file); - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; -} diff --git a/DSTexCompress/FreeImage/Examples/Generic/CloneMultiPage.cpp b/DSTexCompress/FreeImage/Examples/Generic/CloneMultiPage.cpp deleted file mode 100644 index 2124998..0000000 --- a/DSTexCompress/FreeImage/Examples/Generic/CloneMultiPage.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// ========================================================== -// Multipage functions demonstration -// -// Design and implementation by -// - Herv Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// This sample shows how to clone a multipage TIFF -// -// Functions used in this sample : -// FreeImage_OpenMultiBitmap, FreeImage_GetPageCount, FreeImage_LockPage, -// FreeImage_AppendPage, FreeImage_UnlockPage, FreeImage_CloseMultiBitmap; -// FreeImage_SetOutputMessage -// -// ========================================================== - -#include -#include -#include - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** - FreeImage error handler -*/ -void MyMessageFunc(FREE_IMAGE_FORMAT fif, const char *message) { - cout << "\n*** " << message << " ***\n"; - cout.flush(); -} - -// ---------------------------------------------------------- - -bool CloneMultiPage(FREE_IMAGE_FORMAT fif, char *input, char *output, int output_flag) { - - BOOL bMemoryCache = TRUE; - - // Open src file (read-only, use memory cache) - FIMULTIBITMAP *src = FreeImage_OpenMultiBitmap(fif, input, FALSE, TRUE, bMemoryCache); - - if(src) { - // Open dst file (creation, use memory cache) - FIMULTIBITMAP *dst = FreeImage_OpenMultiBitmap(fif, output, TRUE, FALSE, bMemoryCache); - - // Get src page count - int count = FreeImage_GetPageCount(src); - - // Clone src to dst - for(int page = 0; page < count; page++) { - // Load the bitmap at position 'page' - FIBITMAP *dib = FreeImage_LockPage(src, page); - if(dib) { - // add a new bitmap to dst - FreeImage_AppendPage(dst, dib); - // Unload the bitmap (do not apply any change to src) - FreeImage_UnlockPage(src, dib, FALSE); - } - } - - // Close src - FreeImage_CloseMultiBitmap(src, 0); - // Save and close dst - FreeImage_CloseMultiBitmap(dst, output_flag); - - return true; - } - - return false; -} - - -int -main(int argc, char *argv[]) { - - char *input_filename = "images\\input.tif"; - char *output_filename = "images\\clone.tif"; - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize our own FreeImage error handler - - FreeImage_SetOutputMessage(MyMessageFunc); - - // Copy 'input.tif' to 'clone.tif' - - CloneMultiPage(FIF_TIFF, input_filename, output_filename, 0); - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; -} diff --git a/DSTexCompress/FreeImage/Examples/Generic/CreateAlpha.cpp b/DSTexCompress/FreeImage/Examples/Generic/CreateAlpha.cpp deleted file mode 100644 index 77bb2a2..0000000 --- a/DSTexCompress/FreeImage/Examples/Generic/CreateAlpha.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// ========================================================== -// Alpha channel manipulation example -// -// Design and implementation by -// - Herv Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// This example shows how to create a transparent image from any input image -// using the greyscale version of the input image as the alpha channel mask. -// The alpha channel is set using the FreeImage_SetChannel function. -// -// -// ========================================================== - -#include -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** Generic image loader - @param lpszPathName Pointer to the full file name - @param flag Optional load flag constant - @return Returns the loaded dib if successful, returns NULL otherwise -*/ -FIBITMAP* GenericLoader(const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and deduce its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileType(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - } - // check that the plugin has reading capabilities ... - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // ok, let's load the file - FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, flag); - // unless a bad file format, we are done ! - return dib; - } - return NULL; -} - -/** Generic image writer - @param dib Pointer to the dib to be saved - @param lpszPathName Pointer to the full file name - @param flag Optional save flag constant - @return Returns true if successful, returns false otherwise -*/ -bool GenericWriter(FIBITMAP* dib, const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - BOOL bSuccess = FALSE; - - if(dib) { - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - if(fif != FIF_UNKNOWN ) { - // check that the plugin has sufficient writing and export capabilities ... - WORD bpp = FreeImage_GetBPP(dib); - if(FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)) { - // ok, we can save the file - bSuccess = FreeImage_Save(fif, dib, lpszPathName, flag); - // unless an abnormal bug, we are done ! - } - } - } - return (bSuccess == TRUE) ? true : false; -} - -// ---------------------------------------------------------- - -/** - FreeImage error handler - @param fif Format / Plugin responsible for the error - @param message Error message -*/ -void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) { - printf("\n*** "); - if(fif != FIF_UNKNOWN) { - printf("%s Format\n", FreeImage_GetFormatFromFIF(fif)); - } - printf(message); - printf(" ***\n"); -} - -// ---------------------------------------------------------- - - -/** - Creates a 32-bit transparent image using the black channel of the source image - @param src Source image - @return Returns a 32-bit transparent image -*/ -FIBITMAP* CreateAlphaFromLightness(FIBITMAP *src) { - // create a 32-bit image from the source - FIBITMAP *dst = FreeImage_ConvertTo32Bits(src); - - // create a 8-bit mask - FreeImage_Invert(src); - FIBITMAP *mask = FreeImage_ConvertTo8Bits(src); - FreeImage_Invert(src); - - // insert the mask as an alpha channel - FreeImage_SetChannel(dst, mask, FICC_ALPHA); - - // free the mask and return - FreeImage_Unload(mask); - - return dst; -} - -int -main(int argc, char *argv[]) { - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize your own FreeImage error handler - - FreeImage_SetOutputMessage(FreeImageErrorHandler); - - // print version & copyright infos - - printf("FreeImage version : %s", FreeImage_GetVersion()); - printf("\n"); - printf(FreeImage_GetCopyrightMessage()); - printf("\n"); - - - if(argc != 3) { - printf("Usage : CreateAlpha \n"); - return 0; - } - - // Load the source image - FIBITMAP *src = GenericLoader(argv[1], 0); - if(src) { - // Create a transparent image from the lightness image of src - FIBITMAP *dst = CreateAlphaFromLightness(src); - - if(dst) { - // Save the destination image - bool bSuccess = GenericWriter(dst, argv[2], 0); - if(!bSuccess) { - printf("\nUnable to save %s file", argv[2]); - printf("\nThis format does not support 32-bit images"); - } - - // Free dst - FreeImage_Unload(dst); - } - - // Free src - FreeImage_Unload(src); - } - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; -} diff --git a/DSTexCompress/FreeImage/Examples/Generic/FIFImportExport.cpp b/DSTexCompress/FreeImage/Examples/Generic/FIFImportExport.cpp deleted file mode 100644 index ec791b2..0000000 --- a/DSTexCompress/FreeImage/Examples/Generic/FIFImportExport.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// ========================================================== -// Plugin functions demonstration -// -// Design and implementation by -// - Herv Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// This example shows how to use Plugin functions to explore FreeImage capabilities. -// Whenever an external plugin is added to the library, it is automatically loaded -// with FreeImage and can be asked for its capabilities via the plugin functions. -// -// Functions used in this sample : -// FreeImage_FIFSupportsExportBPP, FreeImage_FIFSupportsICCProfiles, FreeImage_FIFSupportsReading, -// FreeImage_FIFSupportsWriting, FreeImage_GetFIFCount, FreeImage_GetFIFDescription, -// FreeImage_GetFIFExtensionList, FreeImage_GetFormatFromFIF, -// FreeImage_GetVersion, FreeImage_GetCopyrightMessage, FreeImage_SetOutputMessage -// -// ========================================================== - -#include -#include -#include -#include - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** - FreeImage error handler -*/ -void MyMessageFunc(FREE_IMAGE_FORMAT fif, const char *message) { - cout << "\n*** " << message << " ***\n"; -} - -// ---------------------------------------------------------- - -/** - Print plugins import capabilities -*/ -void PrintImportFormats(iostream& ios) { - int count = FreeImage_GetFIFCount(); - if(count) - ios << "FORMAT;DESCRIPTION;EXTENSIONS;ICC PROFILES\n"; - for(int i = 0; i < count; i++) { - FREE_IMAGE_FORMAT fif = (FREE_IMAGE_FORMAT)i; - - if(FreeImage_FIFSupportsReading(fif)) { - const char * format = FreeImage_GetFormatFromFIF(fif); - const char * description = FreeImage_GetFIFDescription(fif); - const char * ext = FreeImage_GetFIFExtensionList(fif); - const char * icc = "*"; - if(FreeImage_FIFSupportsICCProfiles(fif)) { - ios << format << ";" << description << ";" << ext << ";" << icc << "\n"; - } else { - ios << format << ";" << description << ";" << ext << "; \n"; - } - } - } -} - -/** - Print plugins export capabilities -*/ -void PrintExportFormats(iostream& ios) { - int count = FreeImage_GetFIFCount(); - if(count) - ios << "FORMAT;DESCRIPTION;EXTENSIONS;BITDEPTH;ICC PROFILES\n"; - for(int i = 0; i < count; i++) { - FREE_IMAGE_FORMAT fif = (FREE_IMAGE_FORMAT)i; - - if(FreeImage_FIFSupportsWriting(fif)) { - const char * format = FreeImage_GetFormatFromFIF(fif); - const char * description = FreeImage_GetFIFDescription(fif); - const char * ext = FreeImage_GetFIFExtensionList(fif); - const char * icc = "*"; - - ios << format << ";" << description << ";" << ext << ";"; - if(FreeImage_FIFSupportsExportBPP(fif, 1)) - ios << "1 "; - if(FreeImage_FIFSupportsExportBPP(fif, 4)) - ios << "4 "; - if(FreeImage_FIFSupportsExportBPP(fif, 8)) - ios << "8 "; - if(FreeImage_FIFSupportsExportBPP(fif, 16)) - ios << "16 "; - if(FreeImage_FIFSupportsExportBPP(fif, 24)) - ios << "24 "; - if(FreeImage_FIFSupportsExportBPP(fif, 32)) - ios << "32 "; - if(FreeImage_FIFSupportsICCProfiles(fif)) { - ios << ";" << icc; - } else { - ios << "; "; - } - ios << "\n"; - } - } -} - -int -main(int argc, char *argv[]) { - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize FreeImage error handler - - FreeImage_SetOutputMessage(MyMessageFunc); - - // print version & copyright infos - - cout << "FreeImage " << FreeImage_GetVersion() << "\n"; - cout << FreeImage_GetCopyrightMessage() << "\n\n"; - - // Print input formats (including external plugins) known by the library - fstream importFile("fif_import.csv", ios::out); - PrintImportFormats(importFile); - importFile.close(); - - // Print output formats (including plugins) known by the library - // for each export format, supported bitdepths are given - fstream exportFile("fif_export.csv", ios::out); - PrintExportFormats(exportFile); - exportFile.close(); - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; - -} diff --git a/DSTexCompress/FreeImage/Examples/Generic/FIIO_Mem.cpp b/DSTexCompress/FreeImage/Examples/Generic/FIIO_Mem.cpp deleted file mode 100644 index 703acb1..0000000 --- a/DSTexCompress/FreeImage/Examples/Generic/FIIO_Mem.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/*--------------------------------------------------------------------------*\ -|| fiio_mem.cpp by Ryan Rubley || -|| || -|| (v1.02) 4-28-2004 || -|| FreeImageIO to memory || -|| || -\*--------------------------------------------------------------------------*/ - -#include -#include -#include "fiio_mem.h" - -#ifdef __cplusplus -extern "C" { -#endif - -FIBITMAP * -FreeImage_LoadFromMem(FREE_IMAGE_FORMAT fif, fiio_mem_handle *handle, int flags) { - FreeImageIO io; - SetMemIO(&io); - - if (handle && handle->data) { - handle->curpos = 0; - return FreeImage_LoadFromHandle(fif, &io, (fi_handle)handle, flags); - } - - return NULL; -} - -BOOL -FreeImage_SaveToMem(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, fiio_mem_handle *handle, int flags) { - FreeImageIO io; - SetMemIO(&io); - - if (handle) { - handle->filelen = 0; - handle->curpos = 0; - return FreeImage_SaveToHandle(fif, dib, &io, (fi_handle)handle, flags); - } - - return FALSE; -} - -// ---------------------------------------------------------- - -void -SetMemIO(FreeImageIO *io) { - io->read_proc = fiio_mem_ReadProc; - io->seek_proc = fiio_mem_SeekProc; - io->tell_proc = fiio_mem_TellProc; - io->write_proc = fiio_mem_WriteProc; -} - -// ---------------------------------------------------------- - -#define FIIOMEM(member) (((fiio_mem_handle *)handle)->member) - -unsigned -fiio_mem_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - unsigned x; - for( x=0; x= FIIOMEM(datalen) ) { - //if we are at or above 1G, we cant double without going negative - if( FIIOMEM(datalen) & 0x40000000 ) { - //max 2G - if( FIIOMEM(datalen) == 0x7FFFFFFF ) { - return 0; - } - newdatalen = 0x7FFFFFFF; - } else if( FIIOMEM(datalen) == 0 ) { - //default to 4K if nothing yet - newdatalen = 4096; - } else { - //double size - newdatalen = FIIOMEM(datalen) << 1; - } - newdata = realloc( FIIOMEM(data), newdatalen ); - if( !newdata ) { - return 0; - } - FIIOMEM(data) = newdata; - FIIOMEM(datalen) = newdatalen; - } - memcpy( (char *)FIIOMEM(data) + FIIOMEM(curpos), buffer, size*count ); - FIIOMEM(curpos) += size*count; - if( FIIOMEM(curpos) > FIIOMEM(filelen) ) { - FIIOMEM(filelen) = FIIOMEM(curpos); - } - return count; -} - -int -fiio_mem_SeekProc(fi_handle handle, long offset, int origin) { - switch(origin) { //0 to filelen-1 are 'inside' the file - default: - case SEEK_SET: //can fseek() to 0-7FFFFFFF always - if( offset >= 0 ) { - FIIOMEM(curpos) = offset; - return 0; - } - break; - - case SEEK_CUR: - if( FIIOMEM(curpos)+offset >= 0 ) { - FIIOMEM(curpos) += offset; - return 0; - } - break; - - case SEEK_END: - if( FIIOMEM(filelen)+offset >= 0 ) { - FIIOMEM(curpos) = FIIOMEM(filelen)+offset; - return 0; - } - break; - } - - return -1; -} - -long -fiio_mem_TellProc(fi_handle handle) { - return FIIOMEM(curpos); -} - -#ifdef __cplusplus -} -#endif diff --git a/DSTexCompress/FreeImage/Examples/Generic/FIIO_Mem.h b/DSTexCompress/FreeImage/Examples/Generic/FIIO_Mem.h deleted file mode 100644 index e686b1c..0000000 --- a/DSTexCompress/FreeImage/Examples/Generic/FIIO_Mem.h +++ /dev/null @@ -1,74 +0,0 @@ -/*--------------------------------------------------------------------------*\ -|| fiio_mem.h by Ryan Rubley || -|| || -|| (v1.02) 4-28-2004 || -|| FreeImageIO to memory || -|| || -\*--------------------------------------------------------------------------*/ - -#ifndef _FIIO_MEM_H_ -#define _FIIO_MEM_H_ - -#include "freeimage.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct fiio_mem_handle_s { - long filelen,datalen,curpos; - void *data; -} fiio_mem_handle; - -/* it is up to the user to create a fiio_mem_handle and init datalen and data - * filelen will be pre-set to 0 by SaveToMem - * curpos will be pre-set to 0 by SaveToMem and LoadFromMem - * IMPORTANT: data should be set to NULL and datalen to 0, - * unless the user wants to manually malloc a larger buffer - */ -FIBITMAP *FreeImage_LoadFromMem(FREE_IMAGE_FORMAT fif, fiio_mem_handle *handle, int flags); -BOOL FreeImage_SaveToMem(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, fiio_mem_handle *handle, int flags); - -void SetMemIO(FreeImageIO *io); -unsigned fiio_mem_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle); -unsigned fiio_mem_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle); -int fiio_mem_SeekProc(fi_handle handle, long offset, int origin); -long fiio_mem_TellProc(fi_handle handle); - -/*** Example Usage *** - -//variables -FIBITMAP *bitmap, *bitmap2; -fiio_mem_handle fmh; - -//important initialization -fmh.data = NULL; -fmh.datalen = 0; - -//load a regular file -bitmap = FreeImage_Load(FIF_PNG, "sample.png"); - -//save the file to memory -FreeImage_SaveToMem(FIF_PNG, bitmap, &fmh, 0); - -//at this point, fmh.data contains the entire PNG data in memory -//fmh.datalen is the amount of space malloc'd for the image in memory, -//but only fmh.filelen amount of that space is actually used. - -//its easy load an image from memory as well -bitmap2 = FreeImage_LoadFromMem(FIF_PNG, &fmh, 0); -//you could also have image data in memory via some other method, and just set -//fmh.data to point to it, and set both fmh.datalen and fmh.filelen to the -//size of that data, then FreeImage_LoadFromMem could load the image from that -//memory - -//make sure to free the data since SaveToMem will cause it to be malloc'd -free(fmh.data); - -*/ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/DSTexCompress/FreeImage/Examples/Generic/LoadFromHandle.cpp b/DSTexCompress/FreeImage/Examples/Generic/LoadFromHandle.cpp deleted file mode 100644 index 45afb46..0000000 --- a/DSTexCompress/FreeImage/Examples/Generic/LoadFromHandle.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// ========================================================== -// Load From Handle Example -// -// Design and implementation by -// - Herv Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// This example shows how to load a bitmap from a -// user allocated FILE pointer. -// -// Functions used in this sample : -// FreeImage_GetFormatFromFIF, FreeImage_GetFileTypeFromHandle, FreeImage_LoadFromHandle, -// FreeImage_GetFIFFromFilename, FreeImage_Save, FreeImage_Unload -// FreeImage_GetVersion, FreeImage_GetCopyrightMessage, FreeImage_SetOutputMessage -// -// ========================================================== - -#include -#include -#include - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** - FreeImage error handler - @param fif Format / Plugin responsible for the error - @param message Error message -*/ -void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) { - printf("\n*** "); - if(fif != FIF_UNKNOWN) { - printf("%s Format\n", FreeImage_GetFormatFromFIF(fif)); - } - printf(message); - printf(" ***\n"); -} - -// ---------------------------------------------------------- - -unsigned DLL_CALLCONV -myReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - return fread(buffer, size, count, (FILE *)handle); -} - -unsigned DLL_CALLCONV -myWriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - return fwrite(buffer, size, count, (FILE *)handle); -} - -int DLL_CALLCONV -mySeekProc(fi_handle handle, long offset, int origin) { - return fseek((FILE *)handle, offset, origin); -} - -long DLL_CALLCONV -myTellProc(fi_handle handle) { - return ftell((FILE *)handle); -} - -// ---------------------------------------------------------- - -int -main(int argc, char *argv[]) { - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize your own FreeImage error handler - - FreeImage_SetOutputMessage(FreeImageErrorHandler); - - // print version & copyright infos - - printf(FreeImage_GetVersion()); - printf("\n"); - printf(FreeImage_GetCopyrightMessage()); - printf("\n"); - - - if(argc != 2) { - printf("Usage : LoadFromHandle \n"); - return 0; - } - - // initialize your own IO functions - - FreeImageIO io; - - io.read_proc = myReadProc; - io.write_proc = myWriteProc; - io.seek_proc = mySeekProc; - io.tell_proc = myTellProc; - - FILE *file = fopen(argv[1], "rb"); - - if (file != NULL) { - // find the buffer format - FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromHandle(&io, (fi_handle)file, 0); - - if(fif != FIF_UNKNOWN) { - // load from the file handle - FIBITMAP *dib = FreeImage_LoadFromHandle(fif, &io, (fi_handle)file, 0); - - // save the bitmap as a PNG ... - const char *output_filename = "test.png"; - - // first, check the output format from the file name or file extension - FREE_IMAGE_FORMAT out_fif = FreeImage_GetFIFFromFilename(output_filename); - - if(out_fif != FIF_UNKNOWN) { - // then save the file - FreeImage_Save(out_fif, dib, output_filename, 0); - } - - // free the loaded FIBITMAP - FreeImage_Unload(dib); - } - fclose(file); - } - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; -} diff --git a/DSTexCompress/FreeImage/Examples/Generic/LoadFromMemory-classified.cpp b/DSTexCompress/FreeImage/Examples/Generic/LoadFromMemory-classified.cpp deleted file mode 100644 index 5466f48..0000000 --- a/DSTexCompress/FreeImage/Examples/Generic/LoadFromMemory-classified.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// ========================================================== -// Classified FreeImageIO handler -// -// Design and implementation by -// - schickb (schickb@hotmail.com) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -class MemIO : public FreeImageIO { -public : - MemIO( BYTE *data ) : _start(data), _cp(data) { - read_proc = _ReadProc; - write_proc = _WriteProc; - tell_proc = _TellProc; - seek_proc = _SeekProc; - } - - void Reset() { - _cp = _start; - } - - static unsigned _ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle); - static unsigned _WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle); - static int _SeekProc(fi_handle handle, long offset, int origin); - static long _TellProc(fi_handle handle); - -private: - BYTE * const _start; - BYTE *_cp; -}; - - -unsigned -MemIO::_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - MemIO *memIO = (MemIO*)handle; - - BYTE *tmp = (BYTE *)buffer; - - for (unsigned c = 0; c < count; c++) { - memcpy(tmp, memIO->_cp, size); - - memIO->_cp = memIO->_cp + size; - - tmp += size; - } - - return count; -} - -unsigned -MemIO::_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - ASSERT( false ); - return size; -} - -int -MemIO::_SeekProc(fi_handle handle, long offset, int origin) { - ASSERT(origin != SEEK_END); - - MemIO *memIO = (MemIO*)handle; - - if (origin == SEEK_SET) - memIO->_cp = memIO->_start + offset; - else - memIO->_cp = memIO->_cp + offset; - - return 0; -} - -long -MemIO::_TellProc(fi_handle handle) { - MemIO *memIO = (MemIO*)handle; - - return memIO->_cp - memIO->_start; -} - -// ---------------------------------------------------------- -// PSEUDOCODE... HELPS TO UNDERSTAND HOW THE MEMIO CLASS WORKS -// ---------------------------------------------------------- - -int -main(int argc, char *argv[]) { - BYTE *data = loadimagesomehow(); - - MemIO memIO(data); - - FIBITMAP *fbmp = FreeImage_LoadFromHandle( fif, &memIO, (fi_handle)&memIO ); -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Examples/Generic/LoadFromMemory.cpp b/DSTexCompress/FreeImage/Examples/Generic/LoadFromMemory.cpp deleted file mode 100644 index 026ebff..0000000 --- a/DSTexCompress/FreeImage/Examples/Generic/LoadFromMemory.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// ========================================================== -// Load From Memory Example -// -// Design and implementation by Floris van den Berg -// -// This file is part of FreeImage 3 -// -// Use at own risk! -// ========================================================== -// -// This example shows how to load a bitmap from memory -// rather than from a file. To do this we make use of the -// FreeImage_LoadFromHandle functions where we override -// the i/o functions to simulate FILE* access in memory. -// -// For seeking purposes the fi_handle passed to the i/o -// functions contain the start of the data block where the -// bitmap is stored. -// -// ========================================================== - -#include -#include -#include - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -fi_handle g_load_address; - -// ---------------------------------------------------------- - -inline unsigned _stdcall -_ReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - BYTE *tmp = (BYTE *)buffer; - - for (unsigned c = 0; c < count; c++) { - memcpy(tmp, g_load_address, size); - - g_load_address = (BYTE *)g_load_address + size; - - tmp += size; - } - - return count; -} - -inline unsigned _stdcall -_WriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - // there's not much use for saving the bitmap into memory now, is there? - - return size; -} - -inline int _stdcall -_SeekProc(fi_handle handle, long offset, int origin) { - assert(origin != SEEK_END); - - if (origin == SEEK_SET) { - g_load_address = (BYTE *)handle + offset; - } else { - g_load_address = (BYTE *)g_load_address + offset; - } - - return 0; -} - -inline long _stdcall -_TellProc(fi_handle handle) { - assert((int)handle > (int)g_load_address); - - return ((int)g_load_address - (int)handle); -} - -// ---------------------------------------------------------- - -int -main(int argc, char *argv[]) { - FreeImageIO io; - - io.read_proc = _ReadProc; - io.write_proc = _WriteProc; - io.tell_proc = _TellProc; - io.seek_proc = _SeekProc; - - // allocate some memory for the bitmap - - BYTE *test = new BYTE[159744]; - - if (test != NULL) { - // load the bitmap into memory. ofcourse you can do this any way you want - - FILE *file = fopen("e:\\projects\\images\\money-256.tif", "rb"); - fread(test, 159744, 1, file); - fclose(file); - - // we store the load address of the bitmap for internal reasons - - g_load_address = test; - - // convert the bitmap - - FIBITMAP *dib = FreeImage_LoadFromHandle(FIF_TIFF, &io, (fi_handle)test); - - // don't forget to free the dib ! - FreeImage_Unload(dib); - - delete [] test; - } - - return 0; -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Examples/Generic/ShowMetadata.cpp b/DSTexCompress/FreeImage/Examples/Generic/ShowMetadata.cpp deleted file mode 100644 index 95d8be1..0000000 --- a/DSTexCompress/FreeImage/Examples/Generic/ShowMetadata.cpp +++ /dev/null @@ -1,317 +0,0 @@ -// ========================================================== -// Simple metadata reader -// -// Design and implementation by -// - Herv Drolon -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at own risk! -// ========================================================== - -// -// This example shows how to easily parse all metadata -// contained in a JPEG, TIFF or PNG image. -// Comments, Exif and IPTC/NAA metadata tags are written to a HTML file -// for later reading, and Adobe XMP XML packets are written -// in a file whose extension is '.xmp'. This file can be later -// processed using a XML parser. -// -// Metadata functions showed in this sample : -// FreeImage_GetMetadataCount, FreeImage_FindFirstMetadata, FreeImage_FindNextMetadata, -// FreeImage_FindCloseMetadata, FreeImage_TagToString, FreeImage_GetMetadata -// -// ========================================================== - -#include -#include -#include - -using namespace std; - -#include "FreeImage.h" - -// ---------------------------------------------------------- - -/** Generic image loader - @param lpszPathName Pointer to the full file name - @param flag Optional load flag constant - @return Returns the loaded dib if successful, returns NULL otherwise -*/ -FIBITMAP* GenericLoader(const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and deduce its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileType(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - } - // check that the plugin has reading capabilities ... - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // ok, let's load the file - FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, flag); - // unless a bad file format, we are done ! - return dib; - } - return NULL; -} - -/** Generic image writer - @param dib Pointer to the dib to be saved - @param lpszPathName Pointer to the full file name - @param flag Optional save flag constant - @return Returns true if successful, returns false otherwise -*/ -bool GenericWriter(FIBITMAP* dib, const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - BOOL bSuccess = FALSE; - - if(dib) { - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - if(fif != FIF_UNKNOWN ) { - // check that the plugin has sufficient writing and export capabilities ... - WORD bpp = FreeImage_GetBPP(dib); - if(FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)) { - // ok, we can save the file - bSuccess = FreeImage_Save(fif, dib, lpszPathName, flag); - // unless an abnormal bug, we are done ! - } - } - } - return (bSuccess == TRUE) ? true : false; -} - -// ---------------------------------------------------------- - -/** - FreeImage error handler - @param fif Format / Plugin responsible for the error - @param message Error message -*/ -void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) { - cout << "\n*** "; - if(fif != FIF_UNKNOWN) { - cout << FreeImage_GetFormatFromFIF(fif) << " Format\n"; - } - cout << message; - cout << " ***\n"; -} - -// ---------------------------------------------------------- - -/** -Print a basic HTML header -*/ -void PrintHTMLHeader(iostream& ios) { - ios << "\n\n
\n"; - ios << "\n"; -} - -/** -Print a HTML footer -*/ -void PrintHTMLFooter(iostream& ios) { - ios << "
\n\n\n\n"; -} - -/** -Print a table header -*/ -void PrintTableHeader(iostream& ios, const char *title) { - ios << "\n"; - ios << "\n"; -} - -/** -Print a table section -*/ -void PrintTableSection(iostream& ios, const char *title) { - ios << "\n"; - ios << ""; -} - -/** -Print a table footer -*/ -void PrintTableFooter(iostream& ios) { - ios << "
" << title << "
" << title << "
Tag nameTag valueDescription
\n"; -} - - -/** -Print the metadata tags to a HTML file -*/ -void PrintMetadata(iostream& ios, const char *sectionTitle, FIBITMAP *dib, FREE_IMAGE_MDMODEL model) { - FITAG *tag = NULL; - FIMETADATA *mdhandle = NULL; - - mdhandle = FreeImage_FindFirstMetadata(model, dib, &tag); - - if(mdhandle) { - // Print a table section - PrintTableSection(ios, sectionTitle); - - do { - // convert the tag value to a string - const char *value = FreeImage_TagToString(model, tag); - - // print the tag - // note that most tags do not have a description, - // especially when the metadata specifications are not available - if(FreeImage_GetTagDescription(tag)) { - ios << "" << FreeImage_GetTagKey(tag) << "" << value << "" << FreeImage_GetTagDescription(tag) << "\n"; - } else { - ios << "" << FreeImage_GetTagKey(tag) << "" << value << "" << " " << "\n"; - } - - } while(FreeImage_FindNextMetadata(mdhandle, &tag)); - } - - FreeImage_FindCloseMetadata(mdhandle); -} - -int -main(int argc, char *argv[]) { - unsigned count; - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_Initialise(); -#endif // FREEIMAGE_LIB - - // initialize your own FreeImage error handler - - FreeImage_SetOutputMessage(FreeImageErrorHandler); - - // print version & copyright infos - - cout << "FreeImage " << FreeImage_GetVersion() << "\n"; - cout << FreeImage_GetCopyrightMessage() << "\n\n"; - - if(argc != 2) { - cout << "Usage : ShowMetadata \n"; - return 0; - } - - // Load the bitmap - - FIBITMAP *dib = GenericLoader(argv[1], 0); - if(!dib) - return 0; - - // Create a HTML file - std::string html_file(strtok(argv[1], ".") + std::string(".html")); - - fstream metadataFile(html_file.c_str(), ios::out); - - // Print the header - - PrintHTMLHeader(metadataFile); - PrintTableHeader(metadataFile, argv[1]); - - // Parse and print metadata - - if(count = FreeImage_GetMetadataCount(FIMD_COMMENTS, dib)) { - cout << "\nFIMD_COMMENTS (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "Comments", dib, FIMD_COMMENTS); - } - if(count = FreeImage_GetMetadataCount(FIMD_EXIF_MAIN, dib)) { - cout << "\nFIMD_EXIF_MAIN (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "Exif - main info", dib, FIMD_EXIF_MAIN); - } - if(count = FreeImage_GetMetadataCount(FIMD_EXIF_EXIF, dib)) { - cout << "\nFIMD_EXIF_EXIF (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "Exif - advanced info", dib, FIMD_EXIF_EXIF); - } - if(count = FreeImage_GetMetadataCount(FIMD_EXIF_GPS, dib)) { - cout << "\nFIMD_EXIF_GPS (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "Exif GPS", dib, FIMD_EXIF_GPS); - } - if(count = FreeImage_GetMetadataCount(FIMD_EXIF_INTEROP, dib)) { - cout << "\nFIMD_EXIF_INTEROP (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "Exif interoperability", dib, FIMD_EXIF_INTEROP); - } - if(count = FreeImage_GetMetadataCount(FIMD_EXIF_MAKERNOTE, dib)) { - cout << "\nFIMD_EXIF_MAKERNOTE (" << count << " data)\n-----------------------------------------\n"; - - // Get the camera model - FITAG *tagMake = NULL; - FreeImage_GetMetadata(FIMD_EXIF_MAIN, dib, "Make", &tagMake); - - std::string buffer((char*)FreeImage_GetTagValue(tagMake)); - buffer += " Makernote"; - - PrintMetadata(metadataFile, buffer.c_str(), dib, FIMD_EXIF_MAKERNOTE); - } - if(count = FreeImage_GetMetadataCount(FIMD_IPTC, dib)) { - cout << "\nFIMD_IPTC (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "IPTC/NAA", dib, FIMD_IPTC); - } - if(count = FreeImage_GetMetadataCount(FIMD_GEOTIFF, dib)) { - cout << "\nFIMD_GEOTIFF (" << count << " data)\n-----------------------------------------\n"; - - PrintMetadata(metadataFile, "GEOTIFF", dib, FIMD_GEOTIFF); - } - - // Print the footer - - PrintTableFooter(metadataFile); - PrintHTMLFooter(metadataFile); - - // close the HTML file - - metadataFile.close(); - - // print XMP data - - if(count = FreeImage_GetMetadataCount(FIMD_XMP, dib)) { - cout << "\nFIMD_XMP (" << count << " packet)\n-----------------------------------------\n"; - - std::string xmp_file(strtok(argv[1], ".") + std::string(".xmp")); - metadataFile.open(xmp_file.c_str(), ios::out); - - FITAG *tag = NULL; - FreeImage_GetMetadata(FIMD_XMP, dib, "XMLPacket", &tag); - if(tag) { - metadataFile << (char*)FreeImage_GetTagValue(tag); - } - - metadataFile.close(); - } - - - // Unload the bitmap - - FreeImage_Unload(dib); - - - // call this ONLY when linking with FreeImage as a static library -#ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); -#endif // FREEIMAGE_LIB - - return 0; -} - - - diff --git a/DSTexCompress/FreeImage/Examples/Linux/Makefile b/DSTexCompress/FreeImage/Examples/Linux/Makefile deleted file mode 100644 index 3a9a26f..0000000 --- a/DSTexCompress/FreeImage/Examples/Linux/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -CC = gcc -CPP = g++ -COMPILERFLAGS = -O3 -INCLUDE = -I../../Dist -VGALIBRARIES = -lfreeimage -lvga -VGAINCLUDE = -I/usr/include/asm -GTKLIBRARIES = -lfreeimage `pkg-config --libs gtk+-2.0` -GTKINCLUDE = `pkg-config --cflags gtk+-2.0` -CFLAGS = $(COMPILERFLAGS) $(INCLUDE) - -all: default - -default: linux-svgalib linux-gtk - -linux-svgalib: linux-svgalib.c - $(CC) $(CFLAGS) $< -o $@ $(VGALIBRARIES) $(VGAINCLUDE) - strip $@ - -linux-gtk: linux-gtk.c - $(CC) $(CFLAGS) $< -o $@ $(GTKLIBRARIES) $(GTKINCLUDE) - strip $@ - -clean: - rm -f core linux-svgalib linux-gtk diff --git a/DSTexCompress/FreeImage/Examples/Linux/linux-gtk.c b/DSTexCompress/FreeImage/Examples/Linux/linux-gtk.c deleted file mode 100644 index a8336fb..0000000 --- a/DSTexCompress/FreeImage/Examples/Linux/linux-gtk.c +++ /dev/null @@ -1,100 +0,0 @@ -#include -#include -#include - -void destroy(GtkWidget * widget, gpointer data) { - gtk_main_quit(); -} - -int main(int argc, char *argv[]) -{ - GtkWidget *window, *imagebox; - GdkVisual *visual; - GdkImage *image; - FIBITMAP *dib; - int y; - - // initialize the FreeImage library - FreeImage_Initialise(TRUE); - - dib = FreeImage_Load(FIF_PNG, "freeimage.png", PNG_DEFAULT); - - gtk_init(&argc, &argv); - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - - gtk_signal_connect(GTK_OBJECT(window), "destroy", - GTK_SIGNAL_FUNC(destroy), NULL); - - visual = gdk_visual_get_system(); - - image = gdk_image_new(GDK_IMAGE_NORMAL,visual, - FreeImage_GetWidth(dib),FreeImage_GetHeight(dib)); - - g_print("picture: %d bpp\n" - "system: %d bpp byteorder: %d\n" - " redbits: %d greenbits: %d bluebits: %d\n" - "image: %d bpp %d bytes/pixel\n", - FreeImage_GetBPP(dib), - visual->depth,visual->byte_order, - visual->red_prec,visual->green_prec,visual->blue_prec, - image->depth,image->bpp ); - - if (FreeImage_GetBPP(dib) != (image->bpp << 3)) { - FIBITMAP *ptr; - - switch (image->bpp) { - case 1: - ptr = FreeImage_ConvertTo8Bits(dib); - break; - - case 2: - if (image->depth == 15) { - ptr = FreeImage_ConvertTo16Bits555(dib); - } else { - ptr = FreeImage_ConvertTo16Bits565(dib); - } - - break; - case 3: - ptr = FreeImage_ConvertTo24Bits(dib); - break; - - default: - case 4: - ptr = FreeImage_ConvertTo32Bits(dib); - break; - } - - FreeImage_Unload(dib); - dib = ptr; - } - -//makes it upside down :( -// memcpy(image->mem, FreeImage_GetBits(dib), image->bpl * image->height); - - BYTE *ptr = FreeImage_GetBits(dib); - - for (y = 0; y < image->height; y++) { - memcpy(image->mem + (y * image->bpl), - ptr + ((image->height - y - 1) * image->bpl), - image->bpl); - } - - FreeImage_Unload(dib); - - imagebox = gtk_image_new_from_image(image, NULL); - gtk_container_add(GTK_CONTAINER(window), imagebox); - - gtk_widget_show(imagebox); - gtk_widget_show(window); - - gtk_main(); - - // release the FreeImage library - FreeImage_DeInitialise(); - - return 0; -} - - diff --git a/DSTexCompress/FreeImage/Examples/Linux/linux-svgalib.c b/DSTexCompress/FreeImage/Examples/Linux/linux-svgalib.c deleted file mode 100644 index f0eb68c..0000000 --- a/DSTexCompress/FreeImage/Examples/Linux/linux-svgalib.c +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include "FreeImage.h" - -int main(void) -{ - FIBITMAP *dib,*ptr; - vga_modeinfo *inf; - int length,height,bpp,y; - - // initialize the FreeImage library - FreeImage_Initialise(); - - dib = FreeImage_Load(FIF_PNG, "freeimage.png", PNG_DEFAULT); - - vga_init(); - vga_setmode(vga_getdefaultmode()); - - inf = vga_getmodeinfo(vga_getcurrentmode()); - - switch(inf->colors) { - default: - printf("Must be at least 256 color mode!\n"); - return; - - case 1 << 8: - bpp = 8; - break; - - case 1 << 15: - bpp = 15; - break; - - case 1 << 16: - bpp = 16; - break; - - case 1 << 24: - if( inf->bytesperpixel == 3 ) { - bpp = 24; - } else { - bpp = 32; - } - break; - } - - if(FreeImage_GetBPP(dib) != bpp) { - switch(bpp) { - case 8: - ptr = FreeImage_ConvertTo8Bits(dib); - break; - - case 15: - ptr = FreeImage_ConvertTo16Bits555(dib); - break; - - case 16: - ptr = FreeImage_ConvertTo16Bits565(dib); - break; - - case 24: - ptr = FreeImage_ConvertTo24Bits(dib); - break; - - default: - case 32: - ptr = FreeImage_ConvertTo32Bits(dib); - break; - } - - FreeImage_Unload(dib); - dib = ptr; - } - - length = FreeImage_GetWidth(dib); - if( inf->width < length ) { - length = inf->width; - } - height = FreeImage_GetHeight(dib); - if( inf->height < height ) { - height = inf->height; - } - - for(y = 0; y < height; y++) { - vga_drawscansegment(FreeImage_GetScanLine(dib, y), 0, y, length); - } - - FreeImage_Unload(dib); - - vga_getch(); - vga_setmode(TEXT); - - // release the FreeImage library - FreeImage_DeInitialise(); - - return 0; -} diff --git a/DSTexCompress/FreeImage/Examples/OpenGL/TextureManager/TextureManager.cpp b/DSTexCompress/FreeImage/Examples/OpenGL/TextureManager/TextureManager.cpp deleted file mode 100644 index cbd69a0..0000000 --- a/DSTexCompress/FreeImage/Examples/OpenGL/TextureManager/TextureManager.cpp +++ /dev/null @@ -1,145 +0,0 @@ -//********************************************** -//Singleton Texture Manager class -//Written by Ben English -//benjamin.english@oit.edu -// -//For use with OpenGL and the FreeImage library -//********************************************** - -#include "TextureManager.h" - -TextureManager* TextureManager::m_inst(0); - -TextureManager* TextureManager::Inst() -{ - if(!m_inst) - m_inst = new TextureManager(); - - return m_inst; -} - -TextureManager::TextureManager() -{ - // call this ONLY when linking with FreeImage as a static library - #ifdef FREEIMAGE_LIB - FreeImage_Initialise(); - #endif -} - -//these should never be called -//TextureManager::TextureManager(const TextureManager& tm){} -//TextureManager& TextureManager::operator=(const TextureManager& tm){} - -TextureManager::~TextureManager() -{ - // call this ONLY when linking with FreeImage as a static library - #ifdef FREEIMAGE_LIB - FreeImage_DeInitialise(); - #endif - - UnloadAllTextures(); - m_inst = 0; -} - -bool TextureManager::LoadTexture(const char* filename, const unsigned int texID, GLenum image_format, GLint internal_format, GLint level, GLint border) -{ - //image format - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - //pointer to the image, once loaded - FIBITMAP *dib(0); - //pointer to the image data - BYTE* bits(0); - //image width and height - unsigned int width(0), height(0); - //OpenGL's image ID to map to - GLuint gl_texID; - - //check the file signature and deduce its format - fif = FreeImage_GetFileType(filename, 0); - //if still unknown, try to guess the file format from the file extension - if(fif == FIF_UNKNOWN) - fif = FreeImage_GetFIFFromFilename(filename); - //if still unkown, return failure - if(fif == FIF_UNKNOWN) - return false; - - //check that the plugin has reading capabilities and load the file - if(FreeImage_FIFSupportsReading(fif)) - dib = FreeImage_Load(fif, filename); - //if the image failed to load, return failure - if(!dib) - return false; - - //retrieve the image data - bits = FreeImage_GetBits(dib); - //get the image width and height - width = FreeImage_GetWidth(dib); - height = FreeImage_GetHeight(dib); - //if this somehow one of these failed (they shouldn't), return failure - if((bits == 0) || (width == 0) || (height == 0)) - return false; - - //if this texture ID is in use, unload the current texture - if(m_texID.find(texID) != m_texID.end()) - glDeleteTextures(1, &(m_texID[texID])); - - //generate an OpenGL texture ID for this texture - glGenTextures(1, &gl_texID); - //store the texture ID mapping - m_texID[texID] = gl_texID; - //bind to the new texture ID - glBindTexture(GL_TEXTURE_2D, gl_texID); - //store the texture data for OpenGL use - glTexImage2D(GL_TEXTURE_2D, level, internal_format, width, height, - border, image_format, GL_UNSIGNED_BYTE, bits); - - //Free FreeImage's copy of the data - FreeImage_Unload(dib); - - //return success - return true; -} - -bool TextureManager::UnloadTexture(const unsigned int texID) -{ - bool result(true); - //if this texture ID mapped, unload it's texture, and remove it from the map - if(m_texID.find(texID) != m_texID.end()) - { - glDeleteTextures(1, &(m_texID[texID])); - m_texID.erase(texID); - } - //otherwise, unload failed - else - { - result = false; - } - - return result; -} - -bool TextureManager::BindTexture(const unsigned int texID) -{ - bool result(true); - //if this texture ID mapped, bind it's texture as current - if(m_texID.find(texID) != m_texID.end()) - glBindTexture(GL_TEXTURE_2D, m_texID[texID]); - //otherwise, binding failed - else - result = false; - - return result; -} - -void TextureManager::UnloadAllTextures() -{ - //start at the begginning of the texture map - std::map::iterator i = m_texID.begin(); - - //Unload the textures untill the end of the texture map is found - while(i != m_texID.end()) - UnloadTexture(i->first); - - //clear the texture map - m_texID.clear(); -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Examples/OpenGL/TextureManager/TextureManager.h b/DSTexCompress/FreeImage/Examples/OpenGL/TextureManager/TextureManager.h deleted file mode 100644 index 0afa4b1..0000000 --- a/DSTexCompress/FreeImage/Examples/OpenGL/TextureManager/TextureManager.h +++ /dev/null @@ -1,51 +0,0 @@ -//********************************************** -//Singleton Texture Manager class -//Written by Ben English -//benjamin.english@oit.edu -// -//For use with OpenGL and the FreeImage library -//********************************************** - -#ifndef TextureManager_H -#define TextureManager_H - -#include -#include -#include "FreeImage.h" -#include - -class TextureManager -{ -public: - static TextureManager* Inst(); - virtual ~TextureManager(); - - //load a texture an make it the current texture - //if texID is already in use, it will be unloaded and replaced with this texture - bool LoadTexture(const char* filename, //where to load the file from - const unsigned int texID, //arbitrary id you will reference the texture by - //does not have to be generated with glGenTextures - GLenum image_format = GL_RGB, //format the image is in - GLint internal_format = GL_RGB, //format to store the image in - GLint level = 0, //mipmapping level - GLint border = 0); //border size - - //free the memory for a texture - bool UnloadTexture(const unsigned int texID); - - //set the current texture - bool BindTexture(const unsigned int texID); - - //free all texture memory - void UnloadAllTextures(); - -protected: - TextureManager(); - TextureManager(const TextureManager& tm); - TextureManager& operator=(const TextureManager& tm); - - static TextureManager* m_inst; - std::map m_texID; -}; - -#endif \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Examples/OpenGL/TextureManager/readme.txt b/DSTexCompress/FreeImage/Examples/OpenGL/TextureManager/readme.txt deleted file mode 100644 index 9cbd7f7..0000000 --- a/DSTexCompress/FreeImage/Examples/OpenGL/TextureManager/readme.txt +++ /dev/null @@ -1,31 +0,0 @@ -Hello everyone, this is my 2D texture manager class for OpenGL using the FreeImage Library. - -Requirements: --------------------- -OpenGL -STL map class -FreeImage (included) - - -Usage --------------------- -To load a texture, simply call the LoadTexture function: - -TextureManager::Inst()->LoadTexture("img\\bg.jpg", BACKGROUND_IMAGE_ID); - -This also binds the loaded texture as the current texture, so after calling it you may make any calls to glTexParameter you may need to specify the properties of the texture. - -When you are rendering, just call the TextureManager's BindImage function instead of glBindImage: - -TextureManager::Inst()->BindImage(BACKGROUND_IMAGE_ID); - -and then do your rendering as normal. --------------------- - - -Feel free to distribute this as you like, but mind the FreeImage licence included in license-fi.txt, and please don't take credit for my code. If you modify it, be sure to mention me (Ben English) somewhere. - -Please send any comments or suggestions to me at benjamin.english@oit.edu - - -Thanks to Herve Drolon for the FreeImage library, I've found it to be very useful! \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Examples/Plugin/PluginCradle.cpp b/DSTexCompress/FreeImage/Examples/Plugin/PluginCradle.cpp deleted file mode 100644 index 5dcdbd0..0000000 --- a/DSTexCompress/FreeImage/Examples/Plugin/PluginCradle.cpp +++ /dev/null @@ -1,253 +0,0 @@ -// ========================================================== -// Loader/Saver Plugin Cradle -// -// Design and implementation by -// - Floris van den Berg (flvdberg@wxs.nl) -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include -#include - -#include "FreeImage.h" -#include "Utilities.h" - -// ========================================================== - -BOOL APIENTRY -DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { - switch (ul_reason_for_call) { - case DLL_PROCESS_ATTACH : - case DLL_PROCESS_DETACH : - case DLL_THREAD_ATTACH : - case DLL_THREAD_DETACH : - break; - } - - return TRUE; -} - -// ========================================================== -// Plugin Interface -// ========================================================== - -static int s_format_id; - -// ========================================================== -// Plugin Implementation -// ========================================================== - -/** - Returns the format string for the plugin. Each plugin, - both internal in the DLL and external in a .fip file, must have - a unique format string to be addressable. -*/ - -static const char * DLL_CALLCONV -Format() { - return "CRADLE"; -} - -/** - Returns a description string for the plugin. Though a - description is not necessary per-se, - it is advised to return an unique string in order to tell the - user what type of bitmaps this plugin will read and/or write. -*/ - -static const char * DLL_CALLCONV -Description() { - return "Here comes the description for your image loader/saver"; -} - -/** - Returns a comma separated list of file extensions indicating - what files this plugin can open. no spaces or whatsoever are allowed. - The list, being used by FreeImage_GetFIFFromFilename, is usually - used as a last resort in finding the type of the bitmap we - are dealing with. Best is to check the first few bytes on - the low-level bits level first and compare them with a known - signature . If this fails, FreeImage_GetFIFFromFilename can be - used. -*/ - -static const char * DLL_CALLCONV -Extension() { - return "ext1,ext2"; -} - -/** - RegExpr is only needed for the Qt wrapper - It allows the Qt mechanism for loading bitmaps to identify the bitmap -*/ -static const char * DLL_CALLCONV -RegExpr() { - return NULL; -} - -/** - Returns a MIME content type string for that format (MIME stands - for Multipurpose Internet Mail Extension). -*/ -static const char * DLL_CALLCONV -MimeType() { - return "image/myformat"; -} - -/** - FreeImage's internal way of seeing if a bitmap is of the desired type. - When the type of a bitmap is to be retrieved, FreeImage runs Validate - for each registered plugin until one returns true. If a plugin doesn't - have a validate function, a return value of false is assumed. - - You can always force to use a particular plugin by directly specifying - it on the command line, but this can result in a dead DLL if the plugin - was not made for the bitmap. -*/ -static BOOL DLL_CALLCONV -Validate(FreeImageIO &io, fi_handle handle) { - return FALSE; -} - -/** - SupportsExportDepth is the first in a possible range of new plugin functions - to ask specific information to that plugin. This function returns TRUE if it - can save a bitmap in the required bitdepth. If it can't the bitmap has to be - converted by the user or another plugin has to be chosen. -*/ -static BOOL DLL_CALLCONV -SupportsExportDepth(int depth) { - return FALSE; -} - -/** - Returns TRUE if the plugin belonging to the given FREE_IMAGE_FORMAT can save a - bitmap in the desired data type, returns FALSE otherwise. Currently, TIFF is the only plugin - able to save all non-standard images. The PNG plugin is able to save unsigned 16-bit - images. -*/ -static BOOL DLL_CALLCONV -SupportsExportType(FREE_IMAGE_TYPE type) { - return (type == FIT_BITMAP) ? TRUE : FALSE; -} - -/** - SupportsICCProfiles informs FreeImage that a plugin supports ICC profiles. - This function returns TRUE if the plugin can load and save a profile. - ICC profile information is accessed via freeimage->get_icc_profile_proc(dib) -*/ -static BOOL DLL_CALLCONV -SupportsICCProfiles() { - return FALSE; -} - - -// ---------------------------------------------------------- - -/** - Loads a bitmap into memory. On entry it is assumed that - the bitmap to be loaded is of the correct type. If the bitmap - is of an incorrect type, the plugin might not gracefully fail but - crash or enter an endless loop. It is also assumed that all - the bitmap data is available at one time. If the bitmap is not complete, - for example because it is being downloaded while loaded, the plugin - might also not gracefully fail. - - The Load function has the following parameters: - - The first parameter (FreeImageIO *io) is a structure providing - function pointers in order to make use of FreeImage's IO redirection. Using - FreeImage's file i/o functions instead of standard ones it is garantueed - that all bitmap types, both current and future ones, can be loaded from - memory, file cabinets, the internet and more. The second parameter (fi_handle handle) - is a companion of FreeImageIO and can be best compared with the standard FILE* type, - in a generalized form. - - The third parameter (int page) indicates wether we will be loading a certain page - in the bitmap or if we will load the default one. This parameter is only used if - the plugin supports multi-paged bitmaps, e.g. cabinet bitmaps that contain a series - of images or pages. If the plugin does support multi-paging, the page parameter - can contain either a number higher or equal to 0 to load a certain page, or -1 to - load the default page. If the plugin does not support multi-paging, - the page parameter is always -1. - - The fourth parameter (int flags) manipulates the load function to load a bitmap - in a certain way. Every plugin has a different flag parameter with different meanings. - - The last parameter (void *data) can contain a special data block used when - the file is read multi-paged. Because not every plugin supports multi-paging - not every plugin will use the data parameter and it will be set to NULL.However, - when the plugin does support multi-paging the parameter contains a pointer to a - block of data allocated by the Open function. -*/ - -static FIBITMAP * DLL_CALLCONV -Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) { - return NULL; -} - -static BOOL DLL_CALLCONV -Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) { - return FALSE; -} - -// ========================================================== -// Init -// ========================================================== - -/** - Initialises the plugin. The first parameter (Plugin *plugin) - contains a pointer to a pre-allocated Plugin structure - wherein pointers to the available plugin functions - has to be stored. The second parameter (int format_id) is an identification - number that the plugin may use to show plugin specific warning messages - or other information to the user. The plugin number - is generated by FreeImage and can differ everytime the plugin is - initialised. - - If you want to create your own plugin you have to take some - rules into account. Plugin functions have to be compiled - __stdcall using the multithreaded c runtime libraries. Throwing - exceptions in plugin functions is allowed, as long as those exceptions - are being caught inside the same plugin. It is forbidden for a plugin - function to directly call FreeImage functions or to allocate memory - and pass it to the main DLL. Exception to this rule is the special file data - block that may be allocated the Open function. Allocating a FIBITMAP inside a - plugin can be using the function allocate_proc in the FreeImage structure, - which will allocate the memory using the DLL's c runtime library. -*/ - -void DLL_CALLCONV -Init(Plugin *plugin, int format_id) { - s_format_id = format_id; - - plugin->format_proc = Format; - plugin->description_proc = Description; - plugin->extension_proc = Extension; - plugin->regexpr_proc = RegExpr; - plugin->open_proc = NULL; - plugin->close_proc = NULL; - plugin->pagecount_proc = NULL; - plugin->pagecapability_proc = NULL; - plugin->load_proc = Load; - plugin->save_proc = Save; - plugin->validate_proc = Validate; - plugin->mime_proc = MimeType; - plugin->supports_export_bpp_proc = SupportsExportDepth; - plugin->supports_export_type_proc = SupportsExportType; - plugin->supports_icc_profiles_proc = SupportsICCProfiles; -} diff --git a/DSTexCompress/FreeImage/Examples/Plugin/PluginCradle.h b/DSTexCompress/FreeImage/Examples/Plugin/PluginCradle.h deleted file mode 100644 index b049efb..0000000 --- a/DSTexCompress/FreeImage/Examples/Plugin/PluginCradle.h +++ /dev/null @@ -1,45 +0,0 @@ -// ========================================================== -// JBIG Plugin -// -// Design and implementation by -// - Floris van den Berg (flvdberg@wxs.nl) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef PLUGINCRADLE_H -#define PLUGINCRADLE_H - -#ifdef PLUGINCRADLE_EXPORTS -#define PLUGIN_API __declspec(dllexport) -#else -#define PLUGIN_API __declspec(dllimport) -#endif - -// ---------------------------------------------------------- - -struct Plugin; - -// ---------------------------------------------------------- - -#define DLL_CALLCONV __stdcall - -// ---------------------------------------------------------- - -extern "C" { - PLUGIN_API void DLL_CALLCONV Init(Plugin *plugin, int format_id); -} - -#endif diff --git a/DSTexCompress/FreeImage/README.minGW b/DSTexCompress/FreeImage/README.minGW deleted file mode 100644 index df5351e..0000000 --- a/DSTexCompress/FreeImage/README.minGW +++ /dev/null @@ -1,236 +0,0 @@ -===================================================================== -Using the FreeImage library with the MinGW Compiler Suite -===================================================================== - -This file describes how to use the precompiled FreeImage library -FreeImage.dll with the MinGW port of the GNU Compiler Collection -(GCC), how to build this library from source using MinGW and how -to use this MinGW-built library with Microsoft Visual Studio. - -Contents: - -I. Prerequisites - -1. Using the precompiled FreeImage library with MinGW - -2. Building the FreeImage library with MinGW - -3. Using the MinGW FreeImage library with Microsoft Visual Studio - -4. Useful links - - ---------------------------------------------------------------------- -I. Prerequisites -===================================================================== - -The procedures described in this document have been developed and -tested using the following free tools: - -1. MinGW GCC Version 4.4.0 (Core and C++ including required libs) -2. MinGW GNU Binutils Version 2.19.1 -3. MinGW GNU Make Version 3.81-20080326-3 -4. MinGW Runtime Version 3.15.2 -5. MinGW API for MS-Windows Version 3.13 -6. GnuWin32 Package CoreUtils Version 5.3.0 (only for building) -7. GnuWin32 Package Sed Version 4.2 (only for creating the GCC - import library)* - -* Sed is only needed to create a GCC-native import library from - the MSVC import library FreeImage.lib. However, since MinGW now - supports linking against MSVC lib files, this process seems to - be obsolete. See section 1. - -Basically, no version dependent capabilities are used so, this -should also work with older versions of the tools mentioned above. -Similarly, the GnuWin32 packages (which I just prefer over MSYS) -could likely be replaced by a properly installed MSYS environment. - -Furthermore, the following preconditions should be met: - -1. The folders 'bin' under both the MinGW and the GnuWin32 - installation directory should have been added to the PATH - environment variable. Likely it is best adding these - directories permanently to PATH through the System - Properties dialog on the Control Panel. - -2. The MinGW Make package only provides a 'mingw32-make.exe' - executable. There is no alias 'make.exe'. However, make is - preconfigured to use 'make' as the default $(MAKE) command. - This seems to be a bug in the MinGW GNU Make distribution. - Thus, a copy of 'mingw32-make.exe' named 'make.exe' should - be placed into MinGW's 'bin' directory. - - - ---------------------------------------------------------------------- -1. Using the precompiled FreeImage library with MinGW -===================================================================== - -When using functions from C/C++, that reside in a DLL, the linker -needs a so called import library, which specifies, how to -dynamically link these external functions during runtime. However, -different linkers use different types or formats of these import -libraries. - -Since the precompiled FreeImage library was build with Microsoft -Visual Studio, in the past, some extra work was required to use it -from MinGW. An import library, that was compatible with GNU ld, -must have been created first. - -However, for several MinGW versions, the GNU linker ld also -supports linking against Microsoft Visual C++ import libraries -directly. So, this effectively makes any circulating HOWTO's on -how to create a GCC-compatible import library from a MSVC lib file -more or less obsolete. Additionally, MinGW does not require the -GCC/Linux usual lib prefix for libraries, so linking with MinGW -against the precompiled FreeImage DLL is as easy as with MSVC: - -1.) Open a DOS shell (run application cmd.exe) - -2.) Ensure, that the 'bin' folder of MinGW is added to the PATH - environment variable (see Prerequisites). - -3.) Link directly against the supplied lib file: - - C:\>gcc -oFreeImageTest.exe FreeImageTest.c -lFreeImage - -Nonetheless, for the sake of completeness, the following steps -describe how to create a native GCC import library: - -1.) Open a DOS shell (run application cmd.exe) - -2.) Ensure, that the 'bin' folders of both MinGW and GnuWin32 are - added to the PATH environment variable (see Prerequisites). - -3.) Create a .def file 'libfreeimage.def', that contains all symbols - exported by the FreeImage library: - - C:\>pexports FreeImage.dll | sed "s/^_//" > libfreeimage.def - -4.) Create the GCC compatible import library 'libfreeimage.a': - - C:\>dlltool --add-underscore -d libfreeimage.def -l libfreeimage.a - -5.) Use this library to link against with GCC: - - C:\>gcc -oFreeImageTest.exe FreeImageTest.c -lfreeimage - - - ---------------------------------------------------------------------- -2. Building the FreeImage library with MinGW -===================================================================== - -You *do not* need to have any other third party library (like -libjpeg, libpng, libtiff, libmng and zlib and others) installed on -your system in order to compile and use the library. FreeImage uses -its own versions of these libraries. This way, you can be sure that -FreeImage will always use the latest and properly tested versions -of of these third party libraries. - -In order to build the FreeImage library under Windows with MinGW -(GCC), ensure that all the prerequisites mentioned above are met. -The MinGW makefile aims to build a Windows DLL, that differs as -least as possible from the precompiled library that comes with the -FreeImage distribution. Thus, the build process also includes the -DLL version resource as well as the __stdcall attribute for all the -exported functions, including the MSVC-like function decorations -_FuncName@nn. - -When building the FreeImage DLL, of course, an import library is -generated, too. However, this input library is not in GCC's native -format, but in MSVC lib format, which makes it usable from both -MinGW and Microsoft Visual Studio with no further processing. - -The MinGW makefile can also be used to build a static library. -However, due to the different function export attributes needed -for both the dynamic and the shared library (DLL), this requires -a separate invocation of make, which in turn needs to rebuild every -source file after switching from dynamic to static and vice versa. -So, a 'make clean' is required each time, the library type is -changed. - -The type of library to build is specified by a variable named -FREEIMAGE_LIBRARY_TYPE, which may either be set directly in the -Makefile.mingw near line 18 or may be specified as an environment -variable. This variable may either take SHARED or STATIC to build -a dynamic link library (DLL) or a static library respectively. -Since this value is used to dynamically form the actual make target -internally, only uppercase values are valid. Defaults to SHARED. - -The MinGW makefile also supports the 'install' target. However, -this only copies the FreeImage dynamic link library (DLL) from the -Dist folder into the %SystemRoot%\system32 folder. So, invoking this -target only makes sense, if the DLL has been built before. - -Since there is neither a common system wide 'include' nor a 'lib' -directory available under Windows, the FreeImage header file -FreeImage.h as well as both the static library and the DLL import -library FreeImage.lib just remain in the 'Dist' folder. - -The following procedure creates the FreeImage dynamic link library -(DLL) from the sources, installs it and also creates a static -FreeImage library: - -1.) Open a DOS shell (run application cmd.exe) - -2.) Ensure, that the 'bin' folders of both MinGW and GnuWin32 are - added to the PATH environment variable (see Prerequisites). - -3.) Create the FreeImage dynamic link library (DLL): - - C:\>make - -4.) Install the FreeImage dynamic link library (DLL): - - C:\>make install - -5.) Clean all files produced by the recent build process: - - C:\>make clean - -6.) Create a static FreeImage library: - - C:\>set FREEIMAGE_LIBRARY_TYPE=STATIC - C:\>make - -You should be able to link progams with the -lFreeImage option -after the shared library is compiled and installed. You can also -link statically against FreeImage.a from MinGW. - - - ---------------------------------------------------------------------- -3. Using the MinGW FreeImage library with Microsoft Visual Studio -===================================================================== - -Since the MinGW makefile creates an import library in MSVC's lib -format, the produced shared library (DLL) can be used from both -MinGW and Microsoft Visual Studio with no further adaption. Just -link to the import library FreeImage.lib from either MinGW or -Microsoft Visual Studio. - - - ---------------------------------------------------------------------- -4. Useful links -===================================================================== - -- The MinGW homepage: - http://www.mingw.org/ - -- The GnuWin32 homepage: - http://gnuwin32.sourceforge.net/ - -- The GCC homepage and online documentation: - http://gcc.gnu.org/ - http://gcc.gnu.org/onlinedocs/ - -- The GNU Binutils homepage and online documentation: - http://www.gnu.org/software/binutils/ - http://sourceware.org/binutils/docs-2.19/ - -- The GNU Make homepage and online documentation: - http://www.gnu.org/software/make/ - http://www.gnu.org/software/make/manual/make.html diff --git a/DSTexCompress/FreeImage/Whatsnew.txt b/DSTexCompress/FreeImage/Whatsnew.txt deleted file mode 100644 index 622adc5..0000000 --- a/DSTexCompress/FreeImage/Whatsnew.txt +++ /dev/null @@ -1,1052 +0,0 @@ -What's New for FreeImage - -* : fixed -- : removed -! : changed -+ : added - -August 12th, 2010 - 3.14.1 -+ [Mihail Naydenov] added support for FIF_LOAD_NOPIXELS flag to EXR plugin -+ [Herve Drolon] added support for FIF_LOAD_NOPIXELS flag to CUT, HDR, RAS, ICO, PNM, RAW, BMP, PFM, XPM plugins -* [Eberhard Mattes] fixed memory allocation checking in multipage API -* [Herve Drolon] (compiler options) removed Win32 OpenMP support introduced in 3.14.0 - -August 9th, 2010 - 3.14.0 -! FreeImage now uses OpenEXR 1.7.0 -! FreeImage now uses ZLib 1.2.5 -! FreeImage now uses LibPNG 1.4.3 -! FreeImage now uses LibJPEG 8b -! FreeImage now uses LibTIFF 3.9.4 (CVS patch 2010-07-13) -! FreeImage now uses LibRaw 0.10-Beta3 -! FreeImage now uses OpenJPEG 1.4.0 (SVN patch 2010-04-16) -! [Herve Drolon] FreeImage_AllocateT now builds a default greyscale palette for 8-bit images -! [Volodymyr Goncharov] FreeImage_LoadMultiBitmapFromMemory now supports read/write operations -! [Herve Drolon] FreeImage_OpenMultiBitmapFromHandle now supports read/write operations -! [Herve Drolon] greyscale conversions now use the Rec. 709 formula -! [Mihail Naydenov] saving RGBF images to TIFF no longer use LogLuv encoding (unless you use the TIFF_LOGLUV save flag) -+ [Herve Drolon] added FIT_FLOAT to FIT_RGBF conversion to FreeImage_ConvertToRGBF & FreeImage_ConvertToType -+ [Herve Drolon] added VS 2008 project files -+ [Herve Drolon] added FreeImage_ConvertToFloat -+ [Mihail Naydenov] added RLE saving to the Targa plugin (see flag TARGA_SAVE_RLE) -+ [Volodymyr Goncharov] added FreeImage_SaveMultiBitmapToHandle -+ [Herve Drolon] added FreeImage_SaveMultiBitmapToMemory -+ [Herve Drolon] added new Exif maker note tags -+ [Lucian Sabo] added JPEG_OPTIMIZE to PluginJPEG:Save -+ [Mihail Naydenov] improved support for Exif tag reading in TIFF plugin -+ [Mihail Naydenov] allowed dataWindow with minimal bounds different from zero in OpenEXR plugin -+ [Herve Drolon] added FIMD_EXIF_RAW metadata model -+ [Herve Drolon] JPEG plugin can load & save raw Exif data (see FIMD_EXIF_RAW) -+ [Herve Drolon] added FIF_LOAD_NOPIXELS load flag constant - used to load header & metadata only -+ [Herve Drolon] added FreeImage_HasPixels -+ [Herve Drolon] added FreeImage_FIFSupportsNoPixels -+ [Herve Drolon] added support for FIF_LOAD_NOPIXELS flag to JPEG, PNG, PCD, PCX plugins -+ [Mihail Naydenov] added support for FIF_LOAD_NOPIXELS flag to TGA, PSD, TIFF plugins -+ [Mihail Naydenov] added support for 16-bit image types to FreeImage_Invert -+ [Mihail Naydenov] improved PSD plugin (faster code, added support for CMYK and LAB loading) + added load flags PSD_CMYK & PSD_LAB -+ [Mihail Naydenov] improved TIFF plugin (CMYK 16-bit loading and saving / RGBAF saving) + added TIFF_LOGLUV save flag -* [Herve Drolon] fixed FreeImage_GetFileType behavior with ANI file formats -* [Herve Drolon] fixed loading of JNG with progressive-JPEG formats -* [Mihail Naydenov] fixed loading of TGA with a corrupted rle count -* [Herve Drolon] fixed conversion formula in FreeImage_PreMultiplyWithAlpha -* [Christoph Brill] removed the use of libmng_data.h private API in MNG Plugin -* [phe02sf] fixed handling of bad Exif-GPS data in a Nikon D5000 image -* [Atsuhiro Igarashi] fixed handling of last data block in PluginGIF::Save (sometimes it saves corrupted images) -* [Christian Heimes] fixed saving of G3 & G4 compressed TIFF with 1bpp on 64bit Linux -* [Herve Drolon] fixed long data type being 64-bit on Unix/Linux platforms (use LONG/DWORD instead of long/unsigned long) -* [Herve Drolon] fixed a memory leak in FreeImage_DeletePage -* [Herve Drolon] fixed the loading of RGBZ images in OpenEXR plugin -* [Lucian Sabo] improved conversion from 1-, 4-, 8-bpp transparent images to 32-bpp -* [Roy F.] fixed a bug in FreeImage_EnlargeCanvas (unable to crop an image on the right) -* [Herve Drolon] fixed the loading of Exif with unusual IFD offset value -* [Eberhard Mattes] fixed page numbering info when saving multipage TIFF -* [Herve Drolon] fixed PluginPICT causing an infinite loop on a malformed PICT image -* [Eberhard Mattes] improved memory allocation checking when using the new operator -* [Herve Drolon] (multipage internals) fixed a potential buffer overflow in ReplaceExtension -* [Eberhard Mattes] improved error checking in FreeImage_CloseMultiBitmap - -December 22, 2009 - 3.13.1 -! FreeImage now uses libTIFF 3.9.2 -! FreeImage now uses OpenJPEG 1.3.0 (SVN patch 2009-11-05) -! FreeImage now uses libPNG 1.2.41 -+ [Berend Engelbrecht] added loading of Exif orientation tag in TIFF plugin -+ [Herve Drolon] added decoding support for the old and outdated JPEG-in-TIFF 6.0 format in TIFF plugin -+ [Herve Drolon] added new 'non standard' Exif tags -+ [Herve Drolon] added new Exif makernote tags -* [Herve Drolon] fixed TIF plugin crashing on a malformed TIFF-JPEG compressed image -* [Herve Drolon] fixed MNG plugin crashing on some old mng images -* [Herve Drolon] fixed handling of 2-bit grayscale transparent PNG -* [Herve Drolon] fixed a bug with the compression rate of JP2 and J2K encoders -* [zestony] fixed TIF plugin with the '65535 bytes' pitch size limitation on saving -* [Herve Drolon] fixed handling of PSD files with a non zero file header reserved member -* [Lucian Sabo] PNG plugin now keep transparency when saving 1- or 4-bit transparent images - -September 28th, 2009 - 3.13.0 -! FreeImage now uses LibJPEG 7 -! FreeImage now uses LibRaw-Lite 0.7.2 -! FreeImage now uses libPNG 1.2.40 -! FreeImage now uses libTIFF 3.9.1 -! FreeImage_RotateClassic is deprecated (use FreeImage_Rotate instead) -+ [Herve Drolon] added support for all Photoshop supported color modes to PSD plugin -+ [Herve Drolon] added support for 32-bit to JNG/MNG plugin -+ [Amir Ebrahimi] added loading support for the PICT format -+ [Herve Drolon] added loading support for camera RAW formats (using LibRawLite wrapper for dcraw) -+ [Mihail Naydenov] added UNICODE functions FreeImage_JPEGTransformU and FreeImage_JPEGCropU -+ [Carsten Klein] added FreeImage_OpenMultiBitmapFromHandle -+ [Carsten Klein] added FreeImage_FillBackground -+ [Carsten Klein] added FreeImage_EnlargeCanvas -+ [Carsten Klein] added FreeImage_AllocateEx / FreeImage_AllocateExT -+ [Mihail Naydenov/Herve Drolon] added FreeImage_TmoReinhard05Ex -+ [Herve Drolon] added FIT_RGBA16 to FIT_RGBF conversion to FreeImage_ConvertToRGBF -+ [Herve Drolon] added FreeImage_Rotate (support for most image types, support background color) -* [Christian Heimes] fixed function prototypes to use a void argument when no argument exist -* [Herve Drolon] fixed RGB color ordering on Intel macs -* [Herve Drolon] FreeImage_RotateClassic now keep transparency when applied to 8-bit images -* [Herve Drolon] fixed handling of transparency info in FreeImage_Copy -* [Herve Drolon] fixed a normalization error in FreeImage_GetAdjustColorsLookupTable -* [Herve Drolon] fixed invalid Exif rotation in PluginJPEG for orientation cases 2 and 4 -* [Mihail Naydenov / Carsten Klein] fixed compilation issues with MinGW32 -* [Mihail Naydenov] improved the loading speed of all targa images -* [Herve Drolon] FreeImage_TagToString now handles the Exif UserComment tag - -April 14th, 2009 - 3.12.0 -! FreeImage now uses libPNG 1.2.35 -! FreeImage now uses libTIFF 3.9.0beta (CVS patch 2009-02-12) -! FreeImage now uses OpenJPEG 1.3.0 (SVN patch 2008-08-21) -! [Herve Drolon] FreeImage_CloneMetadata no longer clone the FIMD_ANIMATION metadata (this was causing problems when saving to GIF format) -+ [Herve Drolon] added full support for the PFM format -+ [Herve Drolon] added JPEG_EXIFROTATE load flag to the JPEG plugin -+ [Herve Drolon] added 16-bit RGB(A) and float RGB(A)F support to FreeImage_GetChannel / FreeImage_SetChannel -+ [Herve Drolon] added src FIT_RGBA16 to dst 32-bit FIT_BITMAP conversion to FreeImage_ConvertToType -* [Carsten Klein] FreeImage_Copy now copies transparency info, resolution info, ICC profile and metadata -* [Carsten Klein] check for negative top/left values in FreeImage_Paste -* [Christian Heimes] changed exceptions with a "catch(char *text)" to a "catch(const char *text)" to make GCC 4.1 happy -* [Deif Lou] fixed a bug in FreeImage_SetTransparentIndex -* [Thomas Maiwald] BMP plugin: on saving, fixed correct setting of bfSize BMP file header for palettized images -* [Timothy Lee] fixed handling of frame disposal in GIF_PLAYBACK mode (GIF plugin) -* [Herve Drolon] fixed handling of Exif Olympus Type 2 maker notes (not yet supported but now safely ignored) -* [Rich Geldreich] fixed DXT1 color endpoint precision problem in DDS plugin -* [Mihail Naydenov] improved loading speed of 24-bit targa images -* [Eugene Golushkov] improved big endian / little endian swapping functions -* [Carsten Klein/Jean-Philippe Goerke] improved FreeImage_SetMetadata / FreeImage_GetMetadata accessors -* [Christian Ruppert] improved Linux Makefiles -* [Eugene Golushkov] fixed PluginBMP alignment bug while saving 16 or 24bit BMP on big endian or Apple machines - -July 28th, 2008 - 3.11.0 -! FreeImage now uses libTIFF 3.9.0beta (CVS patch 2008-05-24) -! FreeImage now uses OpenJPEG 1.3.0 (SVN patch 2008-05-22) -! FreeImage now uses libMNG 1.0.10 -! FreeImage now uses libPNG 1.2.29 -+ [Yves Schmid] added 48-bit RGB to 32-bit conversion support in FreeImage_ConvertTo32Bits -+ [Aaron Shumate] added RGB16-to-BITMAP and All-to-RGBF conversion support in FreeImage_ConvertToType -+ [Benjamin English] added a new OpenGL sample to FreeImage/Examples -+ [Lucian Sabo] added new compression flags to the PNG plugin -+ [Lucian Sabo] added new compression flags to the JPEG plugin (chroma subsampling options) -+ [Noam Gat] added support for SGI grayscale + alpha pics to SGI plugin -+ [Herve Drolon] added FreeImage_CloneMetadata -+ [Herve Drolon] added loading support for Windows Vista icons in ICO Plugin -+ [Herve Drolon] added loading and saving support for RGBF images to the TIF plugin (using the LogLuv codec) -* [Will Bryant] fixed makefile for MacOSX Tiger and Leopard -* [Maria Gullickson] fixed a 'divide by 0' error in PNM plugin and FreeImage_Rescale function -* [Yves Schmid] fixed a bug with Exif metadata reading in TIFF images -* [Herve Drolon] fixed some possible 64-bit portability issues with pointer calculations -* [wangyn] fixed a bug with transparency handling of indexed images in PNG plugin -* [Martin Dyring-Andersen] fixed a bug with GIFinfo structure initialization in GIF plugin -* [Noam Gat] fixed a bug in SGI plugin: when the file reports as two-dimensional, the height factor does not get loaded -* [Herve Drolon] added error messages in FreeImage_Load(U) / FreeImage_Save(U) in case of bad filenames -* [Scott Smith/Herve Drolon] added missing IPTC tags and renamed some tag names to be compatible with ExifTool naming convention -* [Martin Dyring-Andersen] fixed a crash problem with images containing exif data emitted by Picassa -* [Herve Drolon] removed RGBA to RGB transparent conversion in EXR plugin -* [Glenn Pierce] improved the speed of FreeImage_FlipHorizontal -* [Carsten Klein] fixed 65535 pixels width/height limitation in FreeImage_Paste - -November 19th, 2007 - 3.10.0 -! FreeImage now uses libTIFF 3.9.0beta (CVS patch 2007-10-05) -! FreeImage now uses OpenJPEG 1.2.0 (SVN patch 2007-07-13) -! FreeImage now uses OpenEXR 1.6.1 -! FreeImage now uses libPNG 1.2.23 -! FreeImage now hides its internal functions and internal libraries when compiled with gcc -- [Herve Drolon] removed VS C+ 6.0 project files : this IDE is no longer supported because of OpenEXR -+ [Herve Drolon] added VS 2005 project files -+ [Herve Drolon] added full support for the OpenEXR format -+ [Herve Drolon] added full support for the JPEG-2000 format -+ [Herve Drolon] added FreeImage_TmoFattal02 tone mapping operator -+ [Ryan Rubley] added support for RGB vs BGR regardless of endian -+ [Herve Drolon] added FreeImage_MultigridPoissonSolver -+ [Carsten Klein] added FreeImage_PreMultiplyWithAlpha -+ [Carsten Klein] added __stdcall version of FreeImage_OutputMessage -+ [Carsten Klein] added new palette and color manipulation functions (see below) : - added FreeImage_SetTransparentIndex - added FreeImage_GetTransparentIndex - added FreeImage_GetAdjustColorsLookupTable - added FreeImage_AdjustColors - added FreeImage_ApplyColorMapping - added FreeImage_SwapColors - added FreeImage_ApplyPaletteIndexMapping - added FreeImage_SwapPaletteIndices -* [Herve Drolon] fixed a bug in TIFF plugin when reading 8-bit + 8-bit alpha images -* [Herve Drolon] fixed a bug in TIFF plugin when reading images with uncommon bitdepths -* [rodrigo] fixed FreeImage exception handling under gcc (added -fexceptions to gcc compiler flags) -* [Martin Dyring-Andersen] fixed GIF plugin crashing on some corrupted files -* [Herve Drolon] fixed a bug with RLE encoding for 8-bit BMP images -* [Herve Drolon] fixed GPS metadata being skipped when reading metadata in Exif images -* [Herve Drolon] fixed a bug when reading OS/2 BMP images with a negative height -* [Ryan Rubley] fixed a bug with loading of GIFs with large amounts of solid color areas -* [Ryan Rubley] fixed OS X compile error in BitmapAccess.cpp -* [Herve Drolon] fixed a bug in FreeImage_Paste when pasting non-standard image types -* [Herve Drolon] saving 1-bit TIF with the TIFF_CCITTFAX3 flag is now compliant with the TIFF Class F specification -* [Carsten Klein] fixed topdown parameter in FreeImage_ConvertFromRawBits and FreeImage_ConvertToRawBits being handled in reverse -* [Herve Drolon] fixed a bug when reading some RLE-4 encoded BMP data -* [Carsten Klein] conversion from 1-bit to 32-bit now keep possibly present transparency - -February 11th, 2007 - 3.9.3 -! FreeImage now uses libPNG 1.2.16 -! [Ryan Rubley/Ryan Davis] reworked the MacOSX makefile in order to fully support Universal Binary builds of FreeImage -! [Herve Drolon] makefiles are now generated from VS2003 project files instead of VS6 project files -! [Herve Drolon] changed JPEG load/save flag option values -+ [Herve Drolon] added support for RGBAF images to FreeImage_ConvertToRGBF -+ [Herve Drolon] FreeImage_Paste now works with any bitmap type -+ [Herve Drolon] added full support for 64-bit RGBA images to the PNG and TIFF plugins -+ [Jascha Wetzel] added JPEG downsampling feature to PluginJPEG:Load -* [Thomas Chmielewski] fixed a bug in FreeImage_Dither and Bayer dithering, added FID_BAYER16x16 -* [Raphael Gaquer] greatly improved the speed of the GIF encoder -* [Herve Drolon] fixed saving of metadata in the PNG plugin -* [rampelstinskin] fixed transparency table to alpha channel conversion for 4-bit images in FreeImage_ConvertTo32Bits -* [Scott Smith] added missing IPTC tag named "Country/PrimaryLocationCode" -* [Herve Drolon] changed #include by #include in FreeImage.h (needed by Solaris 9) -* [Pierre Arnaud] fixed the use of FreeImage in low memory condition by checking some returned values of the malloc function -* [Pierre Arnaud] fixed TagLib::getTagFieldName not being thread safe - -October 30th, 2006 - 3.9.2 -! FreeImage now uses libTIFF 3.8.2 (with patch 2006-10-13) -+ [Herve Drolon] added full support for 16-bit greyscale and 48-bit RGB to the PNM plugin -+ [Herve Drolon] added IPTC writing support to JPEG & TIFF plugins -+ [Herve Drolon] added new Exif maker note tags -+ [Herve Drolon] added FreeImage_JPEGCrop -+ [Thorsten Radde] added support for 8-bit palettized bitmaps in FreeImage_RotateClassic -+ [Matt Rice] added automatic call to FreeImage_Initialise / FreeImage_DeInitialise when using FreeImage as a .so -+ [Martin Dyring-Andersen] added FreeImage_LoadMultiBitmapFromMemory to the multi-page API -+ [Herve Drolon] added support for tiled TIFF images -* [Carsten Klein] fixed a bug in FreeImage_SetMetadata occuring when deleting a tag -* [Herve Drolon] fixed a bug in PNG plugin when reading Macromedia 'false' PNG files -* [Thorsten Radde] added resolution support to PluginPSD -* [Ryan Rubley] fixed a bug in PluginGIF occuring with interlaced GIF -* [Ryan Rubley] fixed a bug in the multipage cache mechanism (internal FreeImage_FindBlock function) -* [Thorsten Radde] fixed a stack corruption in TIFF plugin occuring when reading exif tags -* [checkered] fixed a bug in the multipage cache mechanism causing VS2005 to crash on multipage files -* [Herve Drolon] fixed a bug with transparency support of 1- and 4-bit images -* [Roar Flolo] fixed a bug in PSD plugin when reading non compressed RGB images (alpha channel initialization) -* [Nicolas Hatier] fixed a bug in PluginGIF when using the GIF_PLAYBACK flag -* [Herve Drolon] fixed a bug in TIFF plugin when saving 8-bit images using LZW with differenciation -* [Herve Drolon] fixed 64-bit compilation issue with LibPNG and assembler code - -July 16th, 2006 - 3.9.1 -* [Ryan Rubley] fixed a bug in PluginGIF plugin causing FreeImage to crash on malformed GIF files - -July 6th, 2006 - 3.9.0 -! FreeImage now uses libPNG 1.2.12 -! FreeImage now uses libTIFF 3.8.2 (with patch 2006-06-24) -! FreeImage_Allocate/FreeImage_Allocate now set the resolution to 72 dpi instead of 0 -+ [Herve Drolon/Petr Pytelka] added a raw FAX G3 format loader -+ [Herve Drolon] added support for most image types to FreeImage_Rescale -+ [Herve Drolon] added FreeImage_MakeThumbnail -+ [Herve Drolon] added support for 64-bit images to FreeImage_ConvertTo32Bits -+ [Herve Drolon] added support for Exif tags to TIF plugin (read only) -+ [Herve Drolon] added FreeImage_ReadMemory -+ [Herve Drolon] added FreeImage_WriteMemory -+ [Herve Drolon] added new Exif maker note tags -+ [Sherman Wilcox] added a SGI file format loader -+ [Herve Drolon] added support for separated images to PluginTIFF -+ [Herve Drolon] added support for progressive-JPEG saving to PluginJPEG -* [Carsten Klein] FreeImage_Dither and FreeImage_Threshold now work with palettized 8-bit dib -* [Christophe Petit] fixed a bug in FreeImage_GetFIFFromFilenameU occuring with files without extension -* [Leigh Brasington] fixed a bug in PluginGIF causing FreeImage not working on Win/98/ME -* [Herve Drolon] fixed a bug in PluginTIFF with writing of JPEG-in-TIFF files -* [Jojakim Stahl] fixed a bug occuring with 4-bit PCX files -* [Sandor Szalacsi] fixed a bug in FreeImage_SetBackgroundColor (bkgnd clearing) -* [Petr Pytelka] fixed PluginTIFF::_tiffSizeProc failing on some images -* [Sherman Wilcox] fixed a bug in DDS plugin when loading images whose size is not a multiple of 4 -* [Sherman Wilcox] fixed a memory leak in PluginDDS::LoadDXT_Helper -* [Sherman Wilcox] fixed DDS plugin bad behavior with invalid DDS files (such as files with zero length) -* [Floris van den Berg] fixed a memory leak in the MultiPage cache mechanism -* [Herve Drolon] replaced WIN32 #define by _WIN32 #define as this is needed by VS2005 -* [Herve Drolon] fixed a VS2005 error in FreeImage_DeletePage -* [Petr Supina] fixed a pow(long,long) function not being standard ANSI C/C++ -* [Petr Supina] fixed FreeImage_FindBlock function not being standard ANSI C/C++ -* [Olaf Stoyke] added support for 64-bit Linux OS -* [Craig Stark] fixed FreeImage support on Intel based Mac OS -* [Herve Drolon] fixed PluginTIFF failing on bad fax tiff images (bad images are now loaded 'as is') -* [Zack Simpson] fixed a bug occuring in rare situations with FreeImage_Aligned_Malloc - -September 5, 2005 - 3.8.0 -! FreeImage now uses libTIFF 3.7.3 -! FreeImage now uses ZLib 1.2.3 -+ [Herve Drolon] added support for 48-bit images to FreeImage_ConvertTo24Bits -+ [Herve Drolon] added FreeImage_ConvertToGreyscale -+ [Herve Drolon] added support for 16-bit greyscale images to FreeImage_ConvertTo8Bits -+ [Petr Pytelka] added UNICODE functions (see below) - added FreeImage_LoadU - added FreeImage_SaveU - added FreeImage_GetFIFFromFilenameU - added FreeImage_GetFileTypeU -+ [Herve Drolon] FreeImage_Copy now works with any bitmap type -+ [Herve Drolon] added support for 1-bit images to FreeImage_Paste -* [Ryan Rubley] fixed PluginGIF failing to link on some broken gcc versions -* [Karl-Heinz Bussian] fixed a bug in LookupX11Color/LookupSVGColor with handling of grey color names -* [Herve Drolon] FreeImage_Dither now uses FreeImage_ConvertToGreyscale and handles 4/8-bit palletized images -* [Herve Drolon] FreeImage_Threshold now uses FreeImage_ConvertToGreyscale and handles 4/8-bit palletized images -* [Craig Hockenberry] fixed PluginGIF::Save swapping the byte order for the height on big endian machines (e.g. PPC on Mac OS X.) -* [Herve Drolon] fixed a bug in JPEG plugin when reading Exif maker notes from images produced by Nikon Editor -* [Herve Drolon] fixed a bug in BMP plugin when reading some malformed RLE8 bmp -* [Herve Drolon] fixed a bug in RAS plugin when loading 8-bit palettized images with less than 256 colors -* [Herve Drolon] fixed a bug in FreeImage_Rescale with 16-,48-,64-bit images -* [Herve Drolon] fixed a bug in the ICC profiles API when loading profile-less CMYK TIFF -* [Herve Drolon] 4-bit PNG are now loaded as 4-bit and no longer converted to 8-bit -* [Greg Ng] fixed a bug in FreeImage_ConvertToRGBF (FIT_BITMAP -> FIT_RGBF conversion) - -May 7, 2005 - 3.7.0 -! FreeImage now uses libTIFF 3.7.2 -! [Ryan Rubley] improved FreeImage_OpenMultiBitmap -+ [Detlev Vendt] added FreeImage_ZLibGUnzip -+ [Herve Drolon] added new image data types FIT_RGB16, FIT_RGBA16, FIT_RGBF, FIT_RGBAF -+ [Herve Drolon] FreeImage_FlipHorizontal & FreeImage_FlipVertical now work with any bitmap type -+ [Herve Drolon] added conversions to float and double in FreeImage_ConvertToType -+ [Herve Drolon] added FreeImage_ConvertToRGBF -+ [Herve Drolon] added support for 16-, 48- and 96-bit images to FreeImage_Rescale -+ [Ryan Rubley] added FreeImage_ColorQuantizeEx -+ [Ryan Rubley] added FIMD_ANIMATION and FIDT_PALETTE -+ [Ryan Rubley] added brand new PluginGIF with full animation multipage and metadata support -+ [Herve Drolon] added support for FIC_MINISWHITE 8-bit images to FreeImage_Rescale -+ [Herve Drolon] added HDR (High Dynamic Range) format (loader & writer) -+ [Herve Drolon] added support for 48-bit images in TIFF plugin -+ [Herve Drolon] added support for 48-bit images in PNG plugin -+ [Herve Drolon] added tone mapping operators (see below) -+ added FreeImage_ToneMapping -+ added FreeImage_TmoDrago03 -+ added FreeImage_TmoReinhard05 -+ [Petr Pytelka] added FreeImage_JPEGTransform -* [Herve Drolon] allowed loading of corrupted JPEG with a premature end of file -* [Herve Drolon] fixed a memory leak with loading of exif JPEG images -* [Detlev Vendt] changed some 'pointer-to-int' casts to 'pointer-to-long' for 64bit machines -* [Ryan Rubley] fixed a memory leak in the multipage API -* [Ryan Rubley] updated VB6 wrapper generation for new functions -* [Herve Drolon] fixed incorrect behavior when reading JPEG comments containing special characters -* [Herve Drolon] fixed incorrect behavior when reading JPEG ICC profiles with a size greater than 64 KB -* [Herve Drolon] fixed a bug in TIFF plugin when loading malformed multipage TIFF -* [Herve Drolon] fixed PluginTIFF not being thread safe - -February 20, 2005 - 3.6.1 -* [Ryan Rubley] fixed a memory leak in the metadata API -* [luedi] improved the robustness of FIBITMAP allocations - -February 13, 2005 - 3.6.0 -! FreeImage now uses libMNG 1.0.9 -! [Herve Drolon] improved the speed of FreeImage_Rescale -! [Herve Drolon] improved FreeImage_RotateClassic (more compact code, a little faster) -! [Herve Drolon] improved the metadata API using tag accessors -+ [Detlev Vendt] added LZW support to PluginGIF:Save -+ [Herve Drolon] added VS.Net 2003 project files -+ [Herve Drolon] added VERSIONINFO resource to the DLL -+ [Herve Drolon] added support for CMYK JPEG on loading -+ [Petr Supina] added 16-bytes alignment to FIBITMAP palette and pixels starting address -+ [Petr Supina] added support for MMX/SSE2 code in LibJPEG (based on Mozilla/Firefox code) -+ [Herve Drolon] added TIFF_JPEG compression flag to the TIFF plugin -+ [Detlev Vendt] added FreeImage_ZLibGZip -+ [Detlev Vendt] added FreeImage_ZLibCRC32 -* [Detlev Vendt] fixed PluginPNG not being thread safe -* [Herve Drolon] fixed compiler warning C4018 occuring with VS.Net 2003 - -December 29, 2004 - 3.5.3 -! FreeImage now uses ZLib 1.2.2 -! FreeImage now uses libPNG 1.2.8 -! FreeImage now uses libTIFF 3.7.1 -! [Herve Drolon] improved FreeImage_RotateClassic -! [Detlev Vendt] improved FreeImage_Rescale (more compact code, preserving 8-bpp colors) -+ [Herve Drolon] added support for transparency saving in ICO plugin -+ [Herve Drolon] added support for 1-bit images to FreeImage_RotateClassic -+ [Herve Drolon] added FreeImage_SetDotsPerMeterX and FreeImage_SetDotsPerMeterY -* [Nan Feng] fixed memory leak in FreeImage_DeleteTag (internal stuff) -* [Nigel Stewart] added conditional #pragma with #ifdef _MSC_VER / #endif -* [Herve Drolon] fixed the '65536 lines' limit on loading in PNM plugin - -November 27th, 2004 - 3.5.2 -* [Herve Drolon] fixed a second bug in FreeImage_Clone function - -November 26th, 2004 - 3.5.1 -+ [Riley McNiff] added FreeImage_ConvertTo4Bits -* [Herve Drolon] fixed a buffer overrun with some ILBM images -* [Riley McNiff] fixed a potential problem when reading TIFF resolution info -* [Dimitar Atanasov] fixed a bug in FreeImage_Clone function -* [Dimitar Atanasov] fixed several bugs in TIFF plugin - -November 1st, 2004 - 3.5.0 -! FreeImage now uses libPNG 1.2.7 -! FreeImage now uses libTIFF 3.7.0 -! FreeImage now uses libMNG 1.0.8 -! [Herve Drolon] improved TIFF LZW compression using a predictor -! [Detlev Vendt] FreeImagesPlus: corrected references to FreeImage.h and FreeImage.lib -+ [Herve Drolon] added support for loading/saving of 8-bit transparent TIFF -+ [Riley McNiff] added support for 4-bit dib in FreeImage_Paste -+ [Herve Drolon] added support for memory IO streams (see below) -+ added FreeImage_OpenMemory -+ added FreeImage_CloseMemory -+ added FreeImage_LoadFromMemory -+ added FreeImage_SaveToMemory -+ added FreeImage_TellMemory -+ added FreeImage_SeekMemory -+ added FreeImage_AcquireMemory -+ added FreeImage_GetFileTypeFromMemory -+ [Petr Pytelka] added FreeImage_GetFIFMimeType to the plugins function list -+ [Herve Drolon] added ICC profile support to JPEG plugin -+ [Herve Drolon] added support for metadata (see below) -+ added FreeImage_SetMetadata -+ added FreeImage_GetMetadata -+ added FreeImage_GetMetadataCount -+ added FreeImage_TagToString -+ added FreeImage_FindFirstMetadata -+ added FreeImage_FindNextMetadata -+ added FreeImage_FindCloseMetadata -* [Riley McNiff] fixed a bug with FreeImage_SetPixelIndex and 4-bit images -* [Petr Pytelka] fixed returned value in FreeImage_CloseMultiBitmap -* [Petr Pytelka] fixed index of new page in FreeImage_InsertPage -* [Aaron Shumate] fixed a minor bug in PNG plugin -* [Aaron Shumate] fixed a bug in IFF plugin (odd-length chunks) -* [Rupert Hewitt] fixed FreeImage not compiling on National Instruments Cvi Ccompiler -* [Herve Drolon] fixed a bug in IFF plugin (ILBM data) -* [Fred Harju] added a Makefile for Solaris 9 -* [Roddy Pratt] fixed FreeImage not linking under Borland C++ Builder -* [Vadim Alexandrov] fixed a memory leak in the multipage API -* [Herve Drolon] fixed a bug with DDS plugin behaviour on Big Endian OS -* [Herve Drolon] fixed a bug with conversion of JPEG resolution info on saving - -July 8th, 2004 - 3.4.0 -! [Jim Keir] improved FreeImage_FlipVertical function -! [Herve Drolon] LZW compression is now enabled in FreeImage -+ [Karl-Heinz Bussian] added constants to FreeImage.h to get at compile time the library version -+ [Karl-Heinz Bussian] added color lookup functions for X11 and SVG -+ [Herve Drolon] added TIFF tags TIFF_CCITTFAX3, TIFF_CCITTFAX4 and TIFF_LZW -+ [Detlev Vendt] added support for CMYK TIFF files with alpha channel -+ [Detlev Vendt] added (re-introduction of) PluginGIF -* [Herve Drolon] fixed a bug with loading of FAX TIFF images (introduced with LibTIFF 3.6.1) -* [Herve Drolon] fixed a bug in Floyd-Steinberg dithering algorithm -* [Herve Drolon] fixed a bug in Targa plugin save function -* [Herve Drolon] fixed a bug in FreeImage_AdjustCurve function -* [Ryan Rubley] fixed a bug with FreeImage_Rescale's filters accuracy -* [Ryan Rubley] fixed a bug in NN quantizer -* [Herve Drolon] fixed a bug with TIFF files containing additional Photoshop alpha channels -* [James Rossfeld] fixed a memory leak with some PSD images -* [Herve Drolon] fixed a bug with saving of 32-bit non transparent PNG images -* [Alexandr Zamaraev] fixed FreeImage not compiling with mingw32 -* [Herve Drolon] fixed FreeImage not compiling with VC.NET (pow function needs casts) - -May 2, 2004 - 3.3.0 -! [Ryan Rubley] FreeImage has been ported to MacOSX and should also work on other big endian processors -+ [Ryan Rubley] rewrote XPM plugin (better load support) and added save support -+ [Ryan Rubley] added ICO_MAKEALPHA flag to ICO plugin -+ [Ryan Rubley] Set/GetPixelColor now works with 16-bit pixels (555 or 565) -+ [Herve Drolon] PNG plugin now supports loading and saving of unsigned 16-bit greyscale images -* [Herve Drolon] fixed a bug with loading of 8-bit and 16-bit PNG with a 8-bit alpha channel -* [Herve Drolon] fixed a bug in NN quantizer algorithm with handling of 4-byte boundary alignment. -* [Herve Drolon] fixed a bug in PluginIFF Validate function -* [Herve Drolon] fixed a minor design issue in FreeImage_GetFIFFromFormat -* [Brad Schick] fixed some compiler warnings with VC++ 7.1 -* [Herve Drolon] fixed a bug with saving of 8-bit palettized images to 24-bit JPEG (channel inversion) - -March 16, 2004 - 3.2.1 -! [Volker Grtner] improved the DDS plugin -! [Herve Drolon] FreeImage_Rescale now works on 8-, 24- and 32-bit images -! [Herve Drolon] FreeImage_Copy now works on 1-, 4-, 8-, 16-, 24- and 32-bit images -* [Floris van den Berg] fixed a bug in the MultiPage cache mechanism -* [Herve Drolon] fixed a bug with loading/saving of 8-bit transparent tga images -* [Herve Drolon] fixed a bug with loading of 1-bit TIFF (introduced with LibTIFF 3.6.1) - -February 18, 2004 - 3.2.0 -! FreeImage now uses libTIFF 3.6.1 -+ [Herve Drolon] added FreeImage_HasBackgroundColor -+ [Herve Drolon] added FreeImage_GetBackgroundColor -+ [Herve Drolon] added FreeImage_SetBackgroundColor -+ [Herve Drolon] added FreeImage_Composite -+ [Herve Drolon] added ICC profile support to PNG plugin -+ [Herve Drolon] added background color support to PNG plugin -+ [Volker Grtner] added support for DDS format (loader) -* [Steve Johnson] improved FreeImage_OpenMultiBitmap/FreeImage_CloseMultiBitmap -* [Steve Johnson] fixed a bug in FreeImage_InsertPage -* [Herve Drolon] fixed a bug with JPEG compressed TIFF (red/blue swapping) -* [Herve Drolon] fixed a bug in PluginTarga where 8-bit images were saved incorrectly - -January 26, 2004 - 3.1.0 -! FreeImage now uses ZLib 1.2.1 -+ [Herve Drolon] added support for integer, real and complex image types (see below) -+ added FREE_IMAGE_TYPE enum -+ added FreeImage_AllocateT -+ added FreeImage_GetImageType -+ added FreeImage_FIFSupportsExportType -+ added FreeImage_ConvertToStandardType -+ added FreeImage_ConvertToType -+ added load/save support of all image types to TIFF plugin -+ [Peter Lemmens] added a Validate function to TARGA plugin -+ [Herve Drolon] added FreeImage_GetPixelIndex / FreeImage_SetPixelIndex -+ [Herve Drolon] added FreeImage_GetPixelColor / FreeImage_SetPixelColor -+ [Herve Drolon] added FreeImage_GetComplexChannel / FreeImage_SetComplexChannel -* [Serge Ivanchenko] TIFF_DEFLATE compression is now enabled in TIFF plugin -* [Herve Drolon] fixed a bug in NeuQuant color reduction algorithm - -November 16, 2003 - 3.0.4 -* [Tobias Persson] fixed FreeImage_GetChannel not working with FICC_ALPHA channel -* [Detlev Vendt] fixed a minor bug with PNG plugin and PNG_IGNOREGAMMA flag -* [Detlev Vendt] fixed a memory leak in PNG plugin save routine -* [Detlev Vendt] fixed JPEG validation problem with .jpe files -* [Ryan Rubley] added Source/LibTIFF/tif_extension.c to LibTIFF (needed for MacOSX) -* [Herve Drolon] improved error handling in TIFF plugin -+ [Karl-Heinz Bussian] added FreeImage_IsLittleEndian -+ [Karl-Heinz Bussian] added JPEG save support for 8-bit miniswhite bitmaps (transparent conversion to minisblack) -+ [Karl-Heinz Bussian] FreeImage_GetColorType now recognizes 8-bit FIC_MINISWHITE images -! [Herve Drolon] FreeImage_Rescale now supports rescaling of 32-bit images with alpha channel -! [Herve Drolon] FreeImage_Invert now supports inversion of 32-bit images with alpha channel -! [Herve Drolon] FreeImage_AdjustCurve now supports working with FICC_ALPHA channel - -November 2, 2003 - 3.0.3 -* [Ryan Rubley] improved makefile for Linux -* [Ryan Rubley] fixed FreeImage not compiling under MacOSX -* [Detlev Vendt] fixed still present inconsistancy with 32bpp transparency handling -* [Herve Drolon] fixed incorrect loading of 4-bit greyscale images in TIFF plugin - -October 27, 2003 - 3.0.2 -! FreeImage now uses libMNG 1.0.6 -* [Herve Drolon] fixed a boolean test in PluginCUT returning always false -* [Herve Drolon] fixed a warning in PluginIFF generated with g++ -* [Linus Tan] fixed a bug in FreeImage_Copy -* [Herve Drolon] fixed FreeImage not compiling under Linux (thanks to Michal) - -October 20, 2003 - 3.0.1 - -! FreeImage now uses libTIFF 3.6.0 -* [Detlev Vendt] fixed incorrect definition of the FREE_IMAGE_FORMAT enum -* [Detlev Vendt] fixed a potential crash problem with Load / Save routines -* [Herve Drolon] fixed incorrect loading of 16-bit greyscale images in TIFF plugin -* [Dennis Lim] fixed a memory leak in Floyd & Steinberg dithering routine -* [Herve Drolon] fixed a bug in BMP loader (incorrect loading of RLE4 bmp) -* [Detlev Vendt] fixed some inconsistancy with 32bpp transparency handling -+ [David Boland] added a C# wrapper -// Linux compatibility issues -- [Michal Novotny] removed the round function in Utilities.h -! [Herve Drolon] replaced the round routine by the clamp routine in PluginPCD -+ [Herve Drolon] added _itoa version in Utilities.h -* [Michal Novotny] fixed untyped consts not accepted by g++ in PluginBMP - -September 8, 2003 - 3.0.0 -- [Herve Drolon] removed deprecated functions -- [Herve Drolon] removed deprecated flags (TARGA_LOAD_RGB555, ICO_*, except ICO_DEFAULT) -- [Herve Drolon] removed the FreeImage pointer table (internal stuff) -+ [Herve Drolon] added a C++ wrapper -+ [Herve Drolon] added the FreeImage Toolkit (see below) -+ added FreeImage_Rescale -+ added FreeImage_RotateClassic -+ added FreeImage_RotateEx -+ added FreeImage_FlipHorizontal -+ added FreeImage_FlipVertical -+ added FreeImage_Invert -+ added FreeImage_AdjustCurve -+ added FreeImage_AdjustGamma -+ added FreeImage_AdjustBrightness -+ added FreeImage_AdjustContrast -+ added FreeImage_GetHistogram -+ added FreeImage_GetChannel -+ added FreeImage_SetChannel -+ added FreeImage_Copy -+ added FreeImage_Paste -+ [Karl-Heinz Bussian] added XPM loader -+ [Karl-Heinz Bussian] added flags parameter to FreeImage_CloseMultiBitmap -+ [Karl-Heinz Bussian] added JPEG save support for 8-bit palettized bitmaps (transparent conversion to 24-bit) -+ [Herve Drolon] added interface to ZLib compression functions -+ [Herve Drolon] added ICO format to the multipage API (loader & writer) -+ [Herve Drolon] added a MIME type to all plugins -* [Karl-Heinz Bussian] fixed incorrect conversion from 1-bit FIC_MINISWHITE bitmaps to 8-bit -* [Herve Drolon] fixed a bug in FreeImage_CloseMultiBitmap -* [Herve Drolon] fixed a potential memory leak in conversion functions (8-, 24-, 32-bit) -* [Robert Walker] fixed incorrect conversion from 16-bit to 24-bit and 16-bit to 32-bit -* [blurble] fixed TIFF validate signature problem (3DS files were recognized as TIFF) -* [Kurt Jankowski-Tepe] fixed FreeImage not compiling on MinGW / LCC WIN32 -* [Jani Peltonen] fixed bug in PluginTARGA where 32-bit bitmaps are not always correctly flipped -* [Detlev Vendt] fixed a bug with TIFF (memory leak with ICC profiles) - -May 25, 2003 - 2.6.1 -+ [Detlev Vendt] added FIC_CMYK to FREE_IMAGE_COLOR_TYPE -+ [Detlev Vendt] added ICC profile support to the library (see below) -+ added FreeImage_GetICCProfile -+ added FreeImage_CreateICCProfile -+ added FreeImage_DestroyICCProfile -+ added FIICCPROFILE & FIICCPROFILE flags -+ added plugin function FreeImage_FIFSupportsICCProfiles -+ [Detlev Vendt] added ICC profile support for TIFF -+ [Herve Drolon] added XBM (X11 Bitmap Format) support : loading -* [Herve Drolon] fixed incorrect IFF file detection (thanks Floris) -* [Herve Drolon] fixed incorrect conversion from 1/4-bit greyscale bitmaps to 8-bit -* [Herve Drolon] fixed a bug in TIFF writer when saving 1,4,8 bit dib (introduced in 2.6.0, sorry) -* [Herve Drolon] fixed a palette problem in TIFF loader when loading 1-bit b & w images -* [Herve Drolon] improved FreeImage_Dither to handle any bitdepth - -May 5th, 2003 - 2.6.0 -! FreeImage now uses libPNG 1.2.5 -! FreeImage now uses libMNG 1.0.5 -! [Markus Loibl] ActiveX wrapper is now distributed in a separate release (since 2.5.5) -! [Herve Drolon] the function FreeImage_Free is now deprecated : use FreeImage_Unload instead -! [Herve Drolon] updated the generic samples and removed deprecated functions -+ [Detlev Vendt] added CMYK support to TIFF save function -+ [Detlev Vendt] added TIFF_SAVE_CMYK flag constant -+ [Detlev Vendt] added 32-bit support (with transparency handling) to TIFF plugin -+ [Herve Drolon] added FreeImage_Threshold -+ [Herve Drolon] added FreeImage_Dither -+ [Herve Drolon] added FREE_IMAGE_DITHER parameter to FreeImage_Dither -* [Herve Drolon] improved error handling in PluginMNG -* [Herve Drolon] improved TIFF flags handling in TIFF save function -* [Herve Drolon] fixed a potential crash-problem in FreeImage_OutputMessage (in case of a null message) -* [Detlev Vendt] fixed a bug with the deprecated FreeImage_GetBitsRowCol (trailling backslash behind the DEPRECATE macro) - -July 24th, 2002 - 2.5.5 -! FreeImage now uses libPNG 1.2.4 -! FreeImage now uses libMNG 1.0.4 -+ [Markus Loibl] added ActiveX wrapper - -June 22th, 2002 - 2.5.4 -* [Timothy Roughton] fixed FreeImage not compiling on LCC WIN32 -* [Markus Loibl] fixed PluginTIFF sometimes saving with wrong X/Y resolution -* fixed crashbug when loading some RLE4 BMPs -! FreeImage now uses LibPNG 1.2.3 -! [Markus Loibl] improved startup plugin locate handling code -! [Gerhard Gruber] made some changes so that FreeImage compiles on VC5 -+ [Markus Loibl] added flags TIFF_PACKBITS, TIFF_DEFLATE, TIFF_ADOBE_DEFLATE and TIFF_NONE - -May 21th, 2002 - 2.5.3 -* fixed wrong colors when loading 16-bit grayscale TIFF -* fixed crash-problem with FreeImageQt -* fixed PluginTIFF saving some bitmaps flipped vertically -* [Laurent Rocher] fixed bug in FreeImage_GetLockedPageNumbers -* [Laurent Rocher] fixed bug in FreeImage_UnlockPage -! FreeImage now uses libpng 1.2.2 -+ added TARGA save support -+ added BMP RLE8 save support - -March 30th, 2002 - 2.5.2 -* fixed bug in PluginTARGA where 32-bit bitmaps are not always correctly flipped -* fixed FreeImage_GetLockedPageNumber being mentioned in FreeImage.h -* fixed crash bug when handling read-only multipage bitmaps -- removed internal function FreeImage_GetExtraDataPointer -! FreeImage now uses zlib 1.1.4 -+ added function FreeImage_GetLockedPageNumbers - -March 2nd 2002 - 2.5.1 -* fixed pluginTIFF not being able to save 32-bit bitmaps -* fixed not being able to save PNM bitmaps through the LoadXXX wrappers -* fixed a webcam generated BMP image being loaded with wrong colors -! FI_ReadProc, FI_WriteProc, etc. do now carry the DLL_CALLCONV flag -! the function FreeImage_GetBitsRowCol is now deprecated -! FreeImage_SetTransparencyTable now taken an integer as count parameter -! FreeImage_IsTransparent now always returns true for 32-bit bitmaps -! PluginPNG::Save now ignores the result of FreeImage_IsTransparent -! PluginTIFF now converts all 32-bit bitmaps to 24-bit, until our patch - to fully support alpha in TIFF is applied in libtiff -+ added full multi-paging support -+ added octal and hexadecimal number support to FreeImage_OutputMessage - -January 3rd 2002 - 2.5.0 -* fixed bug in FreeImage_SaveJPEG -* fixed bug in FreeImage_LoadMNG -* fixed bug in FreeImage_LoadPNG -* fixed small Visual C++ 5.0 compiler issue in PluginMNG.cpp -* fixed FreeImage crashing on JPEG 6.0 encoded TIFFs -! FreeImage now uses libTIFF 3.5.7 -! FreeImage now uses libPNG 1.2.1 -! all the FreeImage_LoadXXX and FreeImage_SaveXXX functions are now deprecated -+ added Dr. Halo (*.cut) support -+ added printf-like format string support to SetOutputMessage -+ added basic multi-paging support: open, close, counting and grabbing -+ added deprecation manager -+ added FreeImage_Clone function - -October 3rd 2001 - 2.4.2 -* fixed missing BI_BITFIELDS support for 32-bit BMPs -* fixed bug in FreeImage_ConvertLine16_555_To16_565 and vice versa -* fixed bug in FreeImage_ConvertToRawBits -* fixed PluginTIFF behaving incorrectly on PHOTOMETRIC_MASK images -* fixed 16 bit TIFFs not loading correctly -* fixed incorrect handling of CCITTFAX3 and CCITTFAX4 TIFFs -* fixed JPEG encoded TIFFs not being supported -! [Yours Detlev] patched libTIFF to handle EXTRASAMPLE_UNSPECIFIED -! [Juergen Riecker] improved speed of PCX loading a lot -! rewrote parts of FreeImage to improve support for c -! the internal RGB555 and RGB565 macros now read BGR instead of RGB -! FreeImage now uses libMNG 1.0.3 -! FreeImage now uses libPNG 1.2.0 -! FreeImage_Save now opens files with the "w+b" flag -! renamed internal macro CalculateUsedColors to CalculateUsedPaletteEntries -! enabling/disabling plugins no longer has effect on FIFSupportsReading -! enabling/disabling plugins no longer has effect on FIFSupportsWriting -+ added flag PNG_IGNOREGAMMA -+ added function FreeImage_FIFSupportsExportBPP - -July 30th 2001 - 2.4.1 -* [Jan Nauta] fixed some plugin ids not being passed to plugins -* [Jan Nauta] fixed some functions being natively called instead of indirect -* [Jan Nauta] fixed BMPs with signature BA not being regognised -* [Remo Eichenberger] fixed memory leak in the plugin system -* fixed seek bug in PluginIFF's Validate -* fixed transparency issue in PluginPNG -* fixed uncaught exceptions in WUQuantizer and NNQuantizer -* fixed some problems with PluginTARGA -* fixed some problems with PluginICO -* fixed some problems with PluginBMP -! improved FreeImageQt's load function a little -! tell/seek control for validation is now handled inside the plugin framework - -July 22th 2001 - 2.4.0 -* (Yours Detlev) fixed memory leak in FreeImage_GetFIFFromFilename -* (Yours Detlev) fixed memory leak in the ICO plugin -* (Yours Detlev) fixed memory leak in the PNG plugin -* fixed potential NULL-pointer access bug in Plugin::AddNode -* fixed problems with linking the static lib -- removed LBM plugin. Its functionality is placed in the IFF plugin now -- removed FreeImage_GetFIFByIndex -! FreeImage now uses LibMNG 1.0.2 -! FreeImage_SetTransparent now only enables alpha when the bitmap is 8 or 32 bit -! FreeImage_SetTransparencyTable now only enables alpha when the bitmap is 8 bit -! FreeImage_LoadLBM now uses Mark Sibly's IFF plugin -! FreeImage_SaveBMP now converts to 24-bit when bpp is 32 and transparency is off -! FreeImage_SaveJPEG now converts to 24-bit when bpp is 32 and transparency is off -! FreeImage_SavePNM now converts to 24-bit when bpp is 32 and transparency is off -! FreeImage_SaveTIFF now converts to 24-bit when bpp is 32 and transparency is off -+ [Mark Sibly] added IFF (ILBM) support -+ added basic support for Photoshop files -+ added mime type support (FreeImage_GetFIFFromMime) -+ added functions FreeImage_SetPluginEnabled and FreeImage_IsPluginEnabled - Disabling plugins modifies the behaviour of the following functions: - * FreeImage_LoadFromHandle - * FreeImage_SaveToHandle - * FreeImage_FIFSupportsReading - * FreeImage_FIFSupportsWriting - * FreeImage_GetFIFFromFormat - * FreeImage_GetFIFFromFilename - * FreeImage_GetFIFFromMime - * FreeImage_Validate - -June 30th 2001 - 2.3.2 -* fixed missing "targa" extension in targa extension list -* fixed small memory leak in PluginList::AddNode -* fixed 32 bit PNG saving suddenly disappeared from the distro? -* fixed 'black line' bug in LoadTARGA -- removed project FreeImageM2 -- removed FreeImage_Combine -! FreeImage_RegisterLocalPlugin now receives a FI_InitProc as first parameter -! FreeImage_GetFIFFromFilename now also takes the format id into account -! cleanup up the code a little for PluginPCD and PluginPCX -+ added static lib project - -June 11th 2001 - 2.3.1 -* [Machiel ten Brinke] fixed the loading of some 'ancient' TARGAs -* [Rui Lopes] fixed some bugs in the external plugin registration -* fixed the plugin system crashing when the init function isn't called -- removed project FreeImagePy -- removed 32 to 24 bit conversion while saving PNG in FreeImageQt -! the scanline convert functions are now accessable in plugins -! FreeImage now uses an STL map to store the plugin list -! PluginSDK.h is now integrated into FreeImage.h -! FreeImage_Register now receives the boolean parameter 'load_local_plugins_only' -! FreeImage now uses LibPNG 1.0.12 -+ [Rui Lopes] added plugin for GIF reading/writing support -+ added function FreeImage_SetTransparencyCount -+ added support for 32 bit PNG saving -+ added FreeImage_RegisterLocalPlugin to allow plugins inside apps -+ added FreeImage_RegisterExternalPlugin to manually load DLLs -+ added plugin for JBIG reading/writing support - -May 4th 2001 - 2.3.0 -* [Martin Weber] fixed some small bugs in the TARGA and BMP plugins -* [Martin Weber] fixed tiny bug in new 16 bit conversions -* [Martin Weber] fixed load flag inconsistency in the TARGA plugin -* [Martin Weber] fixed plugin id / load reference inconsistency for PNM -* [Jan Nauta] fixed bug in conversion 16 -> 16 -* [Herve Drolon] fixed small bug in 4-bit PCX loader -- removed code that loads BMPs renamed to ICO in PluginICO -! the flag TARGA_LOAD_RGB555 is now obsolete -! the plugin list is now sorted internally -! ConvertTo32Bits now stores the transparency table as alpha mask -! FreeImage now uses LibMNG 1.0,1 -! FreeImage now uses LibPNG 1.0.11 -+ added external plugin support via DLLs -+ added function FreeImage_GetFIFByIndex -+ added internal function CalculateScanLine -+ added transparency support for high-color PNGs -+ added transparency support for high-color TIFFs -+ added functions FreeImage_SetTransparent and FreeImage_IsTransparent -+ added constant FIC_RGBALPHA to FREE_IMAGE_COLOR_TYPE - -April 5th 2001 - 2.2.0 -* [Remo Eichenberger] fixed small bug concerning DLLMain and static LIB generation -* fixed 1-bit bitmaps not properly loading in FreeImageQt -* fixed bug in conversion 16->16 -* FreeImage now uses LibPNG 1.0.10 -! [Martin Weber] improved loading of BMP files -! [Martin Weber] improved loading of TARGA files -! [Dave Larson] improved visual appearance after 16 conversions -! FreeImageQt now converts 32-bit bitmaps to 24-bit when saving PNGs and JPEGs -+ added functions FreeImage_Initialise and FreeImage_DeInitialise -+ added internal plugins -+ re-added combine/alphablend functions - -March 8th 2001 - 2.1.0 -* [Martin Hemming] fixed bug in 16-bit TARGA loading code -* fixed PNG's with alpha masks not loading correctly -! FreeImage is now dual-licensed: the FI-License and the GPL license -! FreeImage now uses LibPNG 1.0.9 -! FreeImage now uses LibTIFF 3.5.6 Beta -! FreeImage now uses LiBMNG 1.0.0 -! changed the ordering of the FREE_IMAGE_FORMAT table -! improved linux support -! improved test script -+ added transparency table support to SavePNG -+ added BI_BITFIELDS support to LoadBMP and SaveBMP -+ added reading support for OS/2 2.x BMPs -+ added support for MNG and JNG reading using LibMNG -+ added support for Deluxe Paint reading -+ added 'hot swap' support to the Core DLL -+ added 'hot swap' support to FreeImage Qt -+ added functions GetFIFFromFormat and GetFIFFromFilename -+ added functions FIFSupportsReading and FIFSupportsWriting -+ added function GetFIFRegExpr - -January 14th 2001 - 2.0.0 -* [Herve Drolon] fixed a bug in the conversion 4->8 -* [Herve Drolon] fixed a bug in metrics handling in SaveJPEG -* [Herve Drolon] fixed a bug in the return value of the function SaveTIFF -* fixed the presence of two WuQuantizer.cpp files in the distribution -* fixed bug where a BMP renamed to ICO isn't loaded -- removed FreeImage_ConvertToGreyScale. Use FreeImage_ConvertTo8Bits instead. -- removed the boolean parameters from all conversion routines -- removed page handling in LoadTIFF. A new range of functions will be added. -! The void pointers used in FreeImage are now typed -! LoadBMP now takes palettes in 24/32 bit images in respect -! All effects and MMX functions are now stored in a new library (FreeEffects) -! [Herve Drolon] fixed bug in FreeImage_GetColorType -! [Herve Drolon] improved PCX loader. It can now read 1, 4, 8 and 24-bit images -! [Manfred Tausch] improved FreeImage_Rotate -! [Luca Piergentili] fixed crash bug when saving some 1-bit TIFFs -! rewrote all bitdepth conversion routines making use of the new scanline converters -! rewrote bitdepth conversion in FreeImageQt (uses less memory) -! FreeImage is now compiled __stdcall -+ [Herve Drolon] added WBMP (Wireless Bitmap Format) support: loading and saving -+ [Herve Drolon] added 4, 16 and 32 bitdepth handling in GetColorType -+ [Herve Drolon] added handling of 8-bit greyscale bitmaps in SaveJPEG -+ [Herve Drolon] added NeuQuant color reduction algorithm to ColorQuantize -+ added DLL_CALLCONV (calling convention) flag -+ added bitmask support to all bitmaps -+ added a series of functions converting scanlines from one bitdepth to another -+ added functions ConvertFromRawBits and ConvertToRawBits -+ added project FreeImageM2: Magenta II MMT bindings for FreeImage -+ added basic foundation for linux support - -December 2th 2000 - 1.4.4 -* fixed small bug related to TIFFSetDirectory in FreeImage_LoadTIFF -* fixed FreeImage_Rotate sometimes clipping too much pixels -* fixed other small bug in FreeImage_Rotate -* fixed FreeImage_Clone not taking the FREEIMAGEHEADER in account -* fixed bug in FreeImageQt where 1-bit images are not correctly allocated -* fixed FreeImage_Crop not copying the palette -* fixed message function pointer crash bug -* fixed bug where the palette wasn't copied when saving in FreeImageQt -* fixed FreeImage_Clone not copying the transparency table -- removed FreeImage_WritePaletteEntry -! [Adam Gates] rewrote parts of FreeImage so that c compilers can handle it better -! FreeImageQt doesn't statically link with the FreeImage lib anymore -! FreeImageQt now uses atexit() to automatically unregister -! rewrote parts of FreeImage_LoadBMP to increase speed -+ [Markus Loibl] added metrics handling code to LoadBMP, LoadJPEG, LoadTIFF and LoadPCX -+ added metrics handling code to FreeImageQt -+ added functions FIQT_IsLoaded, FIQT_GetVersion and FIQT_GetCopyrightMessage -+ added conversion 1 -> 16 -+ added FreeImage_SaveJPEG and JPEG quality settings -+ added FreeImage_GetBitsRowCol -+ added function FIQT_SetOutputMessage to FreeImageQt -+ added FreeImage_GetFileTypeFromExtension and FIQT_GetFileTypeFromFormat -+ added project FreeImagePy: python bindings for FreeImage - -November 7th 2000 - 1.4.3 -* fixed FreeImage_SavePNG crash bug -* fixed slighly corrupt size filter in FreeImage_Combine -* fixed FreeImage_SaveTIFF not saving 4-bit images -* [Herve Drolon] fixed bug in FreeImage_LoadTIFF -* [Herve Drolon] fixed bug in FreeImage_GetColorType -- removed fclose from FreeImage_SavePNM (who put it there?) -! rewrote FreeImage_Rotate -! FreeImageQt now automatically detects which formats are supported by Qt and which not -! FreeImage_Allocate now returns a void pointer -! FreeImage_Unload is now called FreeImage_Free -+ added 16-bit 5-5-5 support to FreeImage_LoadBMP -+ added RLE_DELTA support to FreeImage_LoadBMP -+ added directory support to FreeImage_LoadTIFF -+ added functions dealing with transparency -+ added transparency support to 8-bit PNG's in Qt -+ added FREE_IMAGE_QUANTIZE parameter to FreeImage_ColorQuantize -+ added custom FREEIMAGEHEADER header prepended to internal bitmaps -+ added new documentation - -October 18th 2000 - 1.4.2 -* fixed FreeImage_SaveBMP storing an incorrect bfSize value in the BITMAPFILEHEADER -* fixed bug where JPEG and PNG wouldn't load in FreeImageQt -* fixed FreeImage_Mirror mirroring one pixel less than needed -! FreeImage_MaskedCombine24 is now called FreeImage_MaskedCombine24Ex -! FreeImage_MaskedCombine32 is now called FreeImage_MaskedCombine32Ex -+ added 16-bit bitmap support to FreeImage_Mirror -+ added 16-bit bitmap support to FreeImage_ConvertTo8Bits -+ added simple version of FreeImage_MaskedCombine24 -+ added simple version of FreeImage_MaskedCombine32 - -October 17th 2000 - 1.4.1 -* [Herve Drolon] fixed bug in FreeImage_ConvertTo8Bits -* fixed bug in conversion with 16 -> 24 and 16 -> 32 -- removed static library support -- removed all unnecessary files from LibTIFF, LibPNG, LibJPEG and ZLib -- removed all absolute seeks from the library -! FreeImageQt now makes use of the DLL distro -! rebuilt the entire directory structure -! improved handling of BMP -! renamed FreeImage_MaskedCombine to FreeImage_MaskedCombine32 -+ [Alexander Dymerets] added 24-bit masked alpha blending with a seperate alpha mask -+ added FreeImage_Rotate (known bug in degrees 76 to 106) -+ added 4-bit bitmap support to FreeImage_ConvertTo16Bits -+ added 8-bit bitmap support to FreeImage_ConvertTo16Bits -+ added 32-bit bitmap support to FreeImage_ConvertTo16Bits -+ added 32-bit bitmap support to FreeImage_Mirror -+ added 16-bit 5-5-5 support to FreeImage_ConvertTo24Bits -+ added 16-bit 5-5-5 support to FreeImage_ConvertTo32Bits - -October 2th 2000 - 1.4.0 -* [Jani Kajala] fixed bug in conversion with 4 -> 24 and 8 -> 32 -* [Jani Kajala] fixed bug in FreeImage_Flip -* [Jani Kajala] fixed minor bug in FreeImage_LoadBMP -- [Herve Drolon] removed PBMFlags, PGMFlags and PPMFlags -- [Herve Drolon] removed FI_LoadGeneric -- removed FreeImage_Win32.h -! [Herve Drolon] changed FI_GetFileType -! [Herve Drolon] replaced FI_LoadPBM, FI_LoadPGM and FI_LoadPPM with FI_LoadPNM -! [Herve Drolon] improved FreeImage_LoadPNG -! FreeImage_WritePaletteEntry is now exported -+ [Herve Drolon] added FreeImage_SavePNG -+ [Herve Drolon] added FreeImage_SavePNM and PNMFlags -+ [Herve Drolon] added XXXFlags parameter to save functions -+ [Herve Drolon] added FreeImage_LoadRAS and FIF_RAS -+ added FreeImage_GetFileTypeFromExt - -September 7th 2000 - 1.3.5 -+ added conversion 4 -> 8 to FI_ConvertTo8Bits -+ added simple version of FI_GetFileType -+ added project FreeImageQt; a port of the library to the TrollTech library - -August 31th 2000 - 1.3.4 -* fixed 'ice effect' bug in new 24 bit PCX code -* fixed some bugs with the conversion 16 -> 24 and 16 -> 32 -! FI_Blur now returns void -! A debug build of the library now produces FreeImaged.dll and FreeImaged.lib -! TARGA_LOAD_ARGB8888 is now called TARGA_LOAD_RGB888 -! Alpha channels are now automatically loaded unless TARGA_LOAD_RGB888 is specified -! cleaned up the code a lot -+ added 32-bit bitmap support to FreeImage_ConvertToGreyscale -+ added support for 32-bit bottom-left TARGA images -+ added internal functions FreeImage_WritePaletteEntry() and FreeImage_GetScanLine() -+ added FreeImage_Win32.h, containing Windows functions needed to create DIBs -+ added documentation through Doxygen - -July 30th 2000 - 1.3.3 -* [Jani Kajala] fixed some bugs with the conversion 4 -> 24 and 8 -> 24 -* [Jani Kajala] fixed some bugs with the conversion 4 -> 32 and 8 -> 32 -* fixed bug in FI_LoadPNM's ASCII number loader -! [Herve Drolon] improved FI_LoadPNG -! [Herve Drolon] changed FI_ConvertToGreyScale (added changeable macro for conversion) -! improved FI_ConvertTo24Bits -! improved FI_ConvertTo32Bits -! freeImage now uses LibPNG 1.0.8 -+ [Herve Drolon] added FI_ColorQuantize, based on Wu's color quantizer -+ added the conversion 1 -> 24 -+ added the conversion 1 -> 32 -+ added FI_ConvertTo8Bits -+ added FI_Invert (very useful for image processing) -+ added FI_GetColorType and 'enum FREE_IMAGE_COLOR_TYPE' - -June 30th 2000 - 1.3.2 -- removed color reduction functions from the project -! [Herve Drolon] Improved FI_LoadTIFF code -! renamed FI_ToGrayscale to FI_ConvertToGreyScale -! renamed FI_IncreaseColors to FI_ConvertTo24Bits -! LoadBMP now supports 32-bit bitmaps -! [Jani Kajala] Improved FI_LoadTARGA and FI_LoadPCX code -+ added FI_ConvertTo32Bits to convert a bitmap to 32-bit -+ added FI_MaskCombine to combine two 32-bit bitmaps using a alpha mask -+ added FI_AddAlphaMask to enrich a 32-bit bitmap with an alpha mask -+ added FI_SaveTIFF -+ added 16-bit bitmap (565) support to the ConvertToXXX functions. -+ added FI_ConvertTo16Bits (555 and 565) - -June 1th 2000 - 1.3.1 -- removed Standard Template Library (STL) code -* [Jani Kajala] fixed minor bug in FI_LoadTARGA -* [Jani Kajala] fixed some minor bugs in FI_LoadPCX -! streamlined FI_LoadJPEG a little -! FreeImage now uses LibPNG 1.0.6 -! FreeImage now uses LibTIFF 3.5.5 -! FreeImage now uses malloc and free instead of new and delete -+ introduced compiler flags to disable certain features in the DLL -+ added experimental nearest color reduction (FI_ReduceColorsNearestColor) - -April 13th 2000 - 1.3.0 -* fixed some 8 bit PCX files loading incorrectly -* fixed tiny bug in internally used CalculateUsedColors function -- removed FI_SaveXPM. Only BMP is supported now. -- removed Windows dependencies for easier porting -! optimized FI_LoadKOALA a little -! optimized FI_Combine using MMX technology -! FI_Combine now receives an 'unsigned integer' as alpha blend parameter -! FI_InCreaseColors and FI_ReduceColors don't dispose the old bitmap anymore -+ added PNM support (PGM, PPM and PBM; both binary and ascii) -+ [Alexander Dymerets] added FI_EnableMMX and FI_DisableMMX -+ added various effect functions (FI_Blur, FI_Brighten and FI_Crop) - -March 1st 2000 - 1.2.1 -* fixed some 24 bit PCX files loading incorrectly - -February 8th 2000 - 1.2.0 -* fixed last bitmap data block in JPEG files being truncated -* fixed 4/8 bit BMP's incorrectly loading when the palette is smaller than the bitcount predicts -- removed FI_Load. There is no reliable way to identify all image formats -- removed FI_SetJpegDecodeMode. - Mode selection is now done using the 'DataEnum data' parameter of FI_LoadJPEG -! read_proc/write_proc/tell_proc in FreeImageIO now are same as fread/fwrite/ftell -+ added a 'DataEnum data' parameter to all FI_LoadXXX functions. -+ added 16 bit TARGA support -+ added RLE support for TARGA images -+ added FI_GetDIBSize to get the size of a DIB in bytes -+ added Kodak PhotoCD support (Base, Base/4 and Base/16 encoding) -+ added KOALA support -+ added FI_GetFileType. Note: there is no reliable way to identify TARGA, ICO and PCD. Therefore they have been excluded -In KOALA files only the files converted by a C64 emulator can be identified. -+ added FI_Combine to combine two 24-bit bitmaps with (optional) alpha blending - -January 15th 2000 - 1.1.1 -! FI_Copy is now called FI_Clone -+ added FI_ToGrayscale to convert a color bitmap to grayscale -+ added 32 bit TARGA support -+ added FI_IncreaseColors to increase the bitmap bitdepth from 4/8 bit to 24 bit - -January 14th 2000 - 1.1.0 -* FI_MIRROR: fixed nibbles not being mirrored in 4 bit images -* FI_MIRROR: fixed bits not being mirrored in 1 bit images -* fixed improper loading of 1, 4 and 8 bit OS/2 BMP's -* fixed some inconsistensies in the calculation of lines and pitches -* fixed incorrectly loading of Huffman and FAX encoded TIFFs -* fixed LoadTGA accepting 16 bit TGA's and returning corrupt DIB's -- removed LZW support for TIFFs -! FreeImage now uses LibTIFF 3.5.4 -+ added ICO support -+ added overridable file I/O support in the form of FreeImageIO and fi_handle -+ added FI_Load for generic image loading -+ added FI_ReduceColors for color reduction -+ added FI_Copy to copy a bitmap in memory - -January 5th 2000 - 1.0.0 diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/WhatsNew_Delphi.txt b/DSTexCompress/FreeImage/Wrapper/Delphi/WhatsNew_Delphi.txt deleted file mode 100644 index 4136b7f..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/WhatsNew_Delphi.txt +++ /dev/null @@ -1,92 +0,0 @@ -What's New for FreeImage Delphi Wrapper - -* : fixed -- : removed -! : changed -+ : added - -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 Bystrm] updated the wrapper for FreeImage 3.0.2 - -August 9, 2003 -+ [Simon Beavis] added a wrapper for FreeImage 2.6.1 - diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/_clean.bat b/DSTexCompress/FreeImage/Wrapper/Delphi/_clean.bat deleted file mode 100644 index c12f666..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/_clean.bat +++ /dev/null @@ -1,13 +0,0 @@ -del /S *.~* -del /S *.dcu -del /S *.dsk -del /S *.cfg -del /S *.dof -del /S *.obj -del /S *.hpp -del /S *.ddp -del /S *.mps -del /S *.mpt -del /S *.bak -del /S *.exe -del /S *.stat \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.dpr b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.dpr deleted file mode 100644 index 56efacb..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.dpr +++ /dev/null @@ -1,13 +0,0 @@ -program ImagePreview; - -uses - Forms, - MainFrm in 'MainFrm.pas' {MainForm}; - -{$R *.res} - -begin - Application.Initialize; - Application.CreateForm(TMainForm, MainForm); - Application.Run; -end. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.res b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.res deleted file mode 100644 index b40deef..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/ImagePreview.res and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.dfm b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.dfm deleted file mode 100644 index 2afeee9..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.dfm +++ /dev/null @@ -1,135 +0,0 @@ -object MainForm: TMainForm - Left = 304 - Top = 165 - Width = 467 - Height = 405 - Caption = 'Image Preview' - Color = clWhite - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - KeyPreview = True - OldCreateOrder = False - Position = poDesktopCenter - OnCreate = FormCreate - OnDestroy = FormDestroy - OnKeyUp = FormKeyUp - OnMouseWheel = ScrollBoxMouseWheel - OnShow = FormShow - PixelsPerInch = 96 - TextHeight = 13 - object ImgView32: TImgView32 - Left = 0 - Top = 0 - Width = 459 - Height = 371 - Align = alClient - ParentShowHint = False - PopupMenu = PopupMenu - Scale = 1 - ScrollBars.Color = clScrollBar - ScrollBars.ShowHandleGrip = True - ScrollBars.Style = rbsDefault - ShowHint = True - SizeGrip = sgAuto - TabOrder = 0 - OnScroll = ImgView32Scroll - object AlphaView: TImgView32 - Left = 8 - Top = 8 - Width = 161 - Height = 145 - Scale = 1 - ScrollBars.Color = clScrollBar - ScrollBars.ShowHandleGrip = True - ScrollBars.Style = rbsDefault - SizeGrip = sgAuto - TabOrder = 2 - Visible = False - end - end - object PopupMenu: TPopupMenu - Left = 304 - Top = 28 - object ZoomInItem: TMenuItem - Caption = 'Zoom In' - OnClick = ZoomInItemClick - end - object ZoomOutItem: TMenuItem - Caption = 'Zoom Out' - OnClick = ZoomOutItemClick - end - object ActualSizeItem: TMenuItem - Caption = 'Actual Size' - OnClick = ActualSizeItemClick - end - object N1: TMenuItem - Caption = '-' - end - object RotateClockwiseItem: TMenuItem - Caption = 'Rotate Clockwise' - OnClick = RotateClockwiseItemClick - end - object RotateAntiClockwiseItem: TMenuItem - Caption = 'Rotate Anti-Clockwise' - OnClick = RotateAntiClockwiseItemClick - end - object N4: TMenuItem - Caption = '-' - end - object FlipHorizontalItem: TMenuItem - Caption = 'Flip Horizontal' - OnClick = FlipHorizontalItemClick - end - object FilpVerticalItem: TMenuItem - Caption = 'Filp Vertical' - OnClick = FilpVerticalItemClick - end - object N3: TMenuItem - Caption = '-' - end - object ShowAlphaItem: TMenuItem - Caption = 'Show Just Alpha Channel' - OnClick = ShowAlphaItemClick - end - object ShowWithAlphaItem: TMenuItem - Caption = 'Show With Alpha Channel' - OnClick = ShowWithAlphaItemClick - end - object N2: TMenuItem - Caption = '-' - end - object OpenImageItem: TMenuItem - Caption = 'Open New Image' - OnClick = OpenImageItemClick - end - end - object FilterTimer: TTimer - Interval = 500 - OnTimer = FilterTimerTimer - Left = 308 - Top = 84 - end - object OpenDialog: TOpenDialog - Filter = - 'All image files|*.bmp;*.cut;*.ico;*.iff;*.lbm;*.jng;*.jpg;*.jpeg' + - ';*.koa;*.mng;*.pbm;*.pcd;*.pcx;*.pgm;*.png;*.ppm;*.psd;*.ras;*.t' + - 'ga;*.tif;*.tiff;.wbmp;*.xbm;*.xpm)|Windows or OS/2 Bitmap File (' + - '*.BMP)|*.BMP|Dr. Halo (*.CUT)|*.CUT|Windows Icon (*.ICO)|*.ICO|A' + - 'miga IFF (*.IFF, *.LBM)|*.IFF;*.LBM|JPEG Network Graphics (*.JNG' + - ')|*.JNG|Independent JPEG Group (*.JPG)|*.JPG|Commodore 64 Koala ' + - '(*.KOA)|*.KOA|Multiple Network Graphics (*.MNG)|*.MNG|Portable B' + - 'itmap (*.PBM)|*.PBM|Kodak PhotoCD (*.PCD)|*.PCD|PCX bitmap forma' + - 't (*.PCX)|*.PCX|Portable Graymap (*.PGM)|*.PGM|Portable Network ' + - 'Graphics (*.PNG)|*.PNG|Portable Pixelmap (*.PPM)|*.PPM|Photoshop' + - ' (*.PSD)|*.PSD|Sun Rasterfile (*.RAS)|*.RAS|Targa files (*.TGA)|' + - '*.TGA|Tagged Image File Format (*.TIF)|*.TIF;*.TIFF|Wireless Bit' + - 'map (*.WBMP)|*.WBMP|X11 Bitmap Format (*.XBM)|*.XBM|X11 Pixmap F' + - 'ormat (*.XPM)|*.XPM' - Title = 'Open Image File' - Left = 328 - Top = 228 - end -end diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.pas b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.pas deleted file mode 100644 index 5abf8a0..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/MainFrm.pas +++ /dev/null @@ -1,518 +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; - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -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); -begin - ImgView32.Bitmap.StretchFilter := sfSPline; - 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(PChar(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, PChar(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 ImgView32.Bitmap.StretchFilter <> sfNearest then - ImgView32.Bitmap.StretchFilter := sfNearest; - FilterTimer.Enabled := True; - - ImgView32.Scale := ImgView32.Scale * 2.0; - RecalcWindowSize; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.ZoomOutItemClick(Sender: TObject); -begin - FilterTimer.Enabled := False; - if ImgView32.Bitmap.StretchFilter <> sfNearest then - ImgView32.Bitmap.StretchFilter := sfNearest; - FilterTimer.Enabled := True; - - ImgView32.Scale := ImgView32.Scale / 2.0; - RecalcWindowSize; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.ActualSizeItemClick(Sender: TObject); -begin - FilterTimer.Enabled := False; - if ImgView32.Bitmap.StretchFilter <> sfNearest then - ImgView32.Bitmap.StretchFilter := sfNearest; - 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 ImgView32.Bitmap.StretchFilter <> sfNearest then - ImgView32.Bitmap.StretchFilter := sfNearest; - 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 ImgView32.Bitmap.StretchFilter <> sfNearest then - ImgView32.Bitmap.StretchFilter := sfNearest; - 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); -begin - FilterTimer.Enabled := False; - ImgView32.Bitmap.StretchFilter := sfSPline; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.ImgView32Scroll(Sender: TObject); -begin - FilterTimer.Enabled := False; - if ImgView32.Bitmap.StretchFilter <> sfNearest then - ImgView32.Bitmap.StretchFilter := sfNearest; - FilterTimer.Enabled := True; -end; -// ----------------------------------------------------------------------------- -procedure TMainForm.OpenImageItemClick(Sender: TObject); -begin - if OpenDialog.Execute then - begin - try - Screen.Cursor := crHourGlass; - LoadImage(OpenDialog.FileName); - finally - Screen.Cursor := crDefault; - end; - end; -end; - -end. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/Readme.txt b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/Readme.txt deleted file mode 100644 index bb10764..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/Readme.txt +++ /dev/null @@ -1,8 +0,0 @@ -This is a simple image viewing application that uses the FreeImage library to display images in many different formats. - -The app displays the image whose name is passed in as a command line argument. - - -To compile the app you will also need the Graphics32 library available from www.g32.org. It has been tested with version 1.5.1 of Graphics32. - -SJB. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/Tiger.jpg b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/Tiger.jpg deleted file mode 100644 index c152073..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/ImagePreview/Tiger.jpg and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.dpr b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.dpr deleted file mode 100644 index f592548..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.dpr +++ /dev/null @@ -1,13 +0,0 @@ -program MultiBitmap; - -uses - Forms, - mbMainForm in 'mbMainForm.pas' {MainForm}; - -{$R *.res} - -begin - Application.Initialize; - Application.CreateForm(TMainForm, MainForm); - Application.Run; -end. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.res b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.res deleted file mode 100644 index 1228533..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.res and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.stat b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.stat deleted file mode 100644 index 0acf82a..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/MultiBitmap.stat +++ /dev/null @@ -1,10 +0,0 @@ -[Stats] -EditorSecs=82 -DesignerSecs=5 -InspectorSecs=1 -CompileSecs=850 -OtherSecs=5 -StartTime=20.12.2004 11:40:22 -RealKeys=0 -EffectiveKeys=0 -DebugSecs=19 diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.dfm b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.dfm deleted file mode 100644 index cb39400..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.dfm +++ /dev/null @@ -1,89 +0,0 @@ -object MainForm: TMainForm - Left = 203 - Top = 192 - Width = 696 - Height = 480 - Caption = 'MultiBitmap Demo' - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Shell Dlg 2' - Font.Style = [] - OldCreateOrder = False - OnPaint = FormPaint - OnResize = FormResize - PixelsPerInch = 96 - TextHeight = 13 - object ToolBar: TToolBar - Left = 0 - Top = 0 - Width = 688 - Height = 25 - AutoSize = True - ButtonHeight = 21 - ButtonWidth = 33 - Caption = 'ToolBar' - EdgeBorders = [ebLeft, ebTop, ebRight, ebBottom] - Flat = True - Indent = 3 - ShowCaptions = True - TabOrder = 0 - object tbLoad: TToolButton - Left = 3 - Top = 0 - Caption = 'Load' - ImageIndex = 0 - OnClick = tbLoadClick - end - object ToolButton1: TToolButton - Left = 36 - Top = 0 - Width = 8 - Caption = 'ToolButton1' - ImageIndex = 1 - Style = tbsSeparator - end - object tbClose: TToolButton - Left = 44 - Top = 0 - Caption = 'Close' - ImageIndex = 1 - OnClick = tbCloseClick - end - object ToolButton2: TToolButton - Left = 77 - Top = 0 - Width = 8 - Caption = 'ToolButton2' - ImageIndex = 2 - Style = tbsSeparator - end - object Label1: TLabel - Left = 85 - Top = 0 - Width = 36 - Height = 21 - Caption = 'Pages: ' - Layout = tlCenter - end - object cbPages: TComboBox - Left = 121 - Top = 0 - Width = 60 - Height = 21 - Style = csDropDownList - DropDownCount = 15 - ItemHeight = 13 - TabOrder = 0 - OnChange = cbPagesChange - end - end - object OD: TOpenDialog - Filter = 'TIFF multibitmap (*.tiff, *.tif)|*.tiff; *.tif|ICO|*.ico' - Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing] - Title = 'Open multibitmap..' - Left = 64 - Top = 96 - end -end diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.pas b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.pas deleted file mode 100644 index 36c1fa0..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/MultiBitmap/mbMainForm.pas +++ /dev/null @@ -1,150 +0,0 @@ -unit mbMainForm; - -interface - -uses - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, ComCtrls, ToolWin, StdCtrls, FreeBitmap; - -type - TMainForm = class(TForm) - ToolBar: TToolBar; - tbLoad: TToolButton; - ToolButton1: TToolButton; - tbClose: TToolButton; - ToolButton2: TToolButton; - cbPages: TComboBox; - Label1: TLabel; - OD: TOpenDialog; - procedure tbLoadClick(Sender: TObject); - procedure FormPaint(Sender: TObject); - procedure tbCloseClick(Sender: TObject); - procedure cbPagesChange(Sender: TObject); - procedure FormResize(Sender: TObject); - private - FMultiBitmap: TFreeMultiBitmap; - FPage: TFreeWinBitmap; - - procedure PageBitmapChangeHandler(Sender: TObject); - procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - - procedure OpenMultiBitmap(const FileName: string); - procedure CloseMultiBitmap; - procedure OpenPage(Number: Integer); - end; - -var - MainForm: TMainForm; - -implementation - -{$R *.dfm} - -{ TMainForm } - -procedure TMainForm.CloseMultiBitmap; -begin - if FPage.IsValid then - FMultiBitmap.UnlockPage(Fpage, False); - FMultiBitmap.Close; - cbPages.Clear; -end; - -constructor TMainForm.Create(AOwner: TComponent); -begin - inherited; - FMultiBitmap := TFreeMultiBitmap.Create; - FPage := TFreeWinBitmap.Create; - FPage.OnChange := PageBitmapChangeHandler; -end; - -destructor TMainForm.Destroy; -begin - if FMultiBitmap.IsValid then - CloseMultiBitmap; - FMultiBitmap.Free; - inherited; -end; - -procedure TMainForm.OpenMultiBitmap(const FileName: string); -var - I, Cnt: Integer; -begin - if FMultiBitmap.IsValid then CloseMultiBitmap; - - FMultiBitmap.Open(FileName, False, True); - - Cnt := FMultiBitmap.GetPageCount; - cbPages.OnChange := nil; - cbPages.Clear; - for I := 0 to Cnt - 1 do - cbPages.Items.Add(IntToStr(I)); - cbPages.OnChange := cbPagesChange; -end; - -procedure TMainForm.OpenPage(Number: Integer); -begin - if not FMultiBitmap.IsValid then Exit; - - if FPage.IsValid then - FMultiBitmap.UnlockPage(FPage, False); - - FMultiBitmap.LockPage(Number, FPage); -end; - -procedure TMainForm.PageBitmapChangeHandler(Sender: TObject); -begin - Invalidate; -end; - -procedure TMainForm.tbLoadClick(Sender: TObject); -begin - if OD.Execute then - begin - try - OpenMultiBitmap(OD.FileName); - except - raise Exception.CreateFmt('Can not load file %s', [OD.FileName]); - end; - end; -end; - -procedure TMainForm.WMEraseBkgnd(var Message: TWMEraseBkgnd); -begin - Message.Result := 1; -end; - -procedure TMainForm.FormPaint(Sender: TObject); -begin - if not FPage.IsValid then - begin - Canvas.Brush.Color := clBtnFace; - Canvas.FillRect(ClientRect); - end - else - FPage.Draw(Canvas.Handle, ClientRect); -end; - -procedure TMainForm.tbCloseClick(Sender: TObject); -begin - if FMultiBitmap.IsValid then - CloseMultiBitmap; -end; - -procedure TMainForm.cbPagesChange(Sender: TObject); -var - Page: Integer; -begin - Page := StrToInt(cbPages.Text); - OpenPage(Page); -end; - -procedure TMainForm.FormResize(Sender: TObject); -begin - Invalidate; -end; - -end. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/TargaUnit/Readme.txt b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/TargaUnit/Readme.txt deleted file mode 100644 index de9ed24..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/TargaUnit/Readme.txt +++ /dev/null @@ -1,22 +0,0 @@ -TargaImage.pas is a TGraphic descendant for Delphi. Installing it -will allow Delphi TImage and TDBImage components to read Targa files -just like BMP & WMF files with no coding on your part. - -It also adds the TGA file type to the Delphi Open/Save Picture dialog -boxes. - -To install this unit, place it in your one of your library folders -and make it available to all your Delphi projects by using -Component>Install Component from the Delphi menus. - -NOTE: any Delphi applications using this *must* have FreeImage.dll -installed in your application's folder, or somewhere in the path. - ------------------------ - -Tommy -Edinburgh, Scotland -LeTene@battlefieldeurope.org - - - diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/TargaUnit/TargaImage.pas b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/TargaUnit/TargaImage.pas deleted file mode 100644 index 4a355c2..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/TargaUnit/TargaImage.pas +++ /dev/null @@ -1,212 +0,0 @@ -unit TargaImage; - -// ========================================================== -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// -// ========================================================== - -interface - -uses - Windows, - Classes, - FreeImage, - Graphics, - Types; - -type - TTargaImage = class(TGraphic) - private - fImage: PFIBITMAP; - fWidth: Integer; - fHeight: Integer; - protected - procedure Draw(ACanvas: TCanvas; const ARect: TRect); override; - function GetEmpty: Boolean; override; - function GetHeight: Integer; override; - function GetWidth: Integer; override; - procedure SetHeight(Value: Integer); override; - procedure SetWidth(Value: Integer); override; - public - constructor Create; override; - destructor Destroy; override; - procedure Assign(Source: TPersistent); override; - procedure LoadFromClipboardFormat(AFormat: Word; AData: THandle; APalette: HPALETTE); override; - procedure LoadFromStream(Stream: TStream); override; - procedure SaveToClipboardFormat(var AFormat: Word; var AData: THandle; var APalette: HPALETTE); override; - procedure SaveToStream(Stream: TStream); override; - end; - - procedure Register; - -implementation - -{ Design-time registration } - -procedure Register; -begin - TPicture.RegisterFileFormat('tga', 'TARGA Files', TTargaImage); -end; - -{ IO functions } - -function FI_ReadProc(buffer : pointer; size : Cardinal; count : Cardinal; handle : fi_handle) : UInt; stdcall; -var - stream: TStream; - bytesToRead: Cardinal; -begin - stream := TStream(handle); - bytesToRead := size*count; - Result := stream.Read(buffer^, bytesToRead); -end; - -function FI_WriteProc(buffer : pointer; size, count : Cardinal; handle : fi_handle) : UInt; stdcall; -var - stream: TStream; - bytesToWrite: Cardinal; -begin - stream := TStream(handle); - bytesToWrite := size*count; - Result := stream.Write(buffer^, bytesToWrite); -end; - -function FI_SeekProc(handle : fi_handle; offset : longint; origin : integer) : Integer; stdcall; -begin - TStream(handle).Seek(offset, origin); - Result := 0; -end; - -function FI_TellProc(handle : fi_handle) : LongInt; stdcall; -begin - Result := TStream(handle).Position; -end; - -{ TTargaImage } - -constructor TTargaImage.Create; -begin - fImage := nil; - fWidth := 0; - fHeight := 0; - inherited; -end; - -destructor TTargaImage.Destroy; -begin - if Assigned(fImage) then - FreeImage_Unload(fImage); - inherited; -end; - -procedure TTargaImage.Assign(Source: TPersistent); -begin - if Source is TTargaImage then begin - fImage := FreeImage_Clone(TTargaImage(Source).fImage); - fWidth := FreeImage_GetWidth(fImage); - fHeight := FreeImage_GetHeight(fImage); - Changed(Self); - end else - inherited; -end; - -procedure TTargaImage.Draw(ACanvas: TCanvas; const ARect: TRect); -var - pbi: PBitmapInfo; -begin - if Assigned(fImage) then begin - pbi := FreeImage_GetInfo(fImage); - SetStretchBltMode(ACanvas.Handle, COLORONCOLOR); - StretchDIBits(ACanvas.Handle, ARect.left, ARect.top, - ARect.right-ARect.left, ARect.bottom-ARect.top, - 0, 0, fWidth, fHeight, - FreeImage_GetBits(fImage), pbi^, DIB_RGB_COLORS, SRCCOPY); - end; -end; - -function TTargaImage.GetEmpty: Boolean; -begin - Result := Assigned(fImage); -end; - -function TTargaImage.GetHeight: Integer; -begin - Result := fHeight; -end; - -function TTargaImage.GetWidth: Integer; -begin - Result := fWidth; -end; - -procedure TTargaImage.LoadFromClipboardFormat(AFormat: Word; AData: THandle; APalette: HPALETTE); -begin - if Assigned(fImage) then begin - end; -end; - -procedure TTargaImage.LoadFromStream(Stream: TStream); -var - io: FreeImageIO; -begin - with io do begin - read_proc := FI_ReadProc; - write_proc := FI_WriteProc; - seek_proc := FI_SeekProc; - tell_proc := FI_TellProc; - end; - fImage := FreeImage_LoadFromHandle(FIF_TARGA, @io, Stream); - if Assigned(fImage) then begin - fWidth := FreeImage_GetWidth(fImage); - fHeight := FreeImage_GetHeight(fImage); - end; -end; - -procedure TTargaImage.SaveToClipboardFormat(var AFormat: Word; var AData: THandle; var APalette: HPALETTE); -begin -end; - -procedure TTargaImage.SaveToStream(Stream: TStream); -var - io: FreeImageIO; -begin - with io do begin - read_proc := FI_ReadProc; - write_proc := FI_WriteProc; - seek_proc := FI_SeekProc; - tell_proc := FI_TellProc; - end; - FreeImage_SaveToHandle(FIF_TARGA, fImage, @io, Stream); -end; - -procedure TTargaImage.SetHeight(Value: Integer); -begin - if Assigned(fImage) then begin - fHeight := Value; - FreeImage_Rescale(fImage, fWidth, fHeight, FILTER_BICUBIC); - end; -end; - -procedure TTargaImage.SetWidth(Value: Integer); -begin - if Assigned(fImage) then begin - fWidth := Value; - FreeImage_Rescale(fImage, fWidth, fHeight, FILTER_BICUBIC); - end; -end; - -initialization - TPicture.RegisterFileFormat('tga', 'TARGA Files', TTargaImage); -end. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.dpr b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.dpr deleted file mode 100644 index 17c3eb3..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.dpr +++ /dev/null @@ -1,13 +0,0 @@ -program MainDemo; - -uses - Forms, - MainForm in 'MainForm.pas' {fwbMainForm}; - -{$R *.res} - -begin - Application.Initialize; - Application.CreateForm(TfwbMainForm, fwbMainForm); - Application.Run; -end. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.res b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.res deleted file mode 100644 index 1228533..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainDemo.res and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.dfm b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.dfm deleted file mode 100644 index fe38589..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.dfm +++ /dev/null @@ -1,607 +0,0 @@ -object fwbMainForm: TfwbMainForm - Left = 205 - Top = 206 - Width = 696 - Height = 480 - Caption = 'FreeWinBitmap - MainDemo' - Color = clCaptionText - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Tahoma' - Font.Style = [] - Menu = MainMenu - OldCreateOrder = False - ShowHint = True - OnCreate = FormCreate - OnDestroy = FormDestroy - OnPaint = FormPaint - OnResize = FormResize - PixelsPerInch = 96 - TextHeight = 13 - object StatusBar: TStatusBar - Left = 0 - Top = 411 - Width = 688 - Height = 23 - Panels = < - item - Alignment = taCenter - Width = 120 - end - item - Alignment = taCenter - Width = 80 - end - item - Width = 50 - end> - end - object tbTools: TToolBar - Left = 0 - Top = 0 - Width = 688 - Height = 29 - Caption = 'ToolBar' - Color = clBtnFace - EdgeBorders = [ebTop, ebBottom] - Flat = True - Images = ImageList1 - ParentColor = False - TabOrder = 1 - object ToolButton1: TToolButton - Left = 0 - Top = 0 - Width = 8 - Caption = 'ToolButton1' - ImageIndex = 1 - Style = tbsSeparator - end - object btnOpen: TToolButton - Left = 8 - Top = 0 - Hint = 'Open image file...' - Caption = 'Open...' - ImageIndex = 0 - OnClick = mnuFileOpenClick - end - object ToolButton4: TToolButton - Left = 31 - Top = 0 - Width = 8 - Caption = 'ToolButton4' - ImageIndex = 4 - Style = tbsSeparator - end - object btnCopy: TToolButton - Left = 39 - Top = 0 - Hint = 'Copy to clipboard' - Caption = 'Copy' - ImageIndex = 1 - OnClick = btnCopyClick - end - object btnPaste: TToolButton - Left = 62 - Top = 0 - Hint = 'Paste from from clipboard' - Caption = 'Paste' - ImageIndex = 2 - OnClick = btnPasteClick - end - object ToolButton3: TToolButton - Left = 85 - Top = 0 - Width = 8 - Caption = 'ToolButton3' - ImageIndex = 4 - Style = tbsSeparator - end - object btnClear: TToolButton - Left = 93 - Top = 0 - Caption = 'Clear' - ImageIndex = 3 - OnClick = btnClearClick - end - end - object MainMenu: TMainMenu - Left = 120 - Top = 48 - object mnuFile: TMenuItem - Caption = '&File' - object mnuFileOpen: TMenuItem - Caption = '&Open' - OnClick = mnuFileOpenClick - end - object mnuExit: TMenuItem - Caption = 'E&xit' - OnClick = mnuExitClick - end - end - object mnuImage: TMenuItem - Caption = 'Image' - object mnuImageFlip: TMenuItem - Caption = 'Flip' - object mnuFlipHorz: TMenuItem - Caption = 'Horizontal' - OnClick = mnuFlipHorzClick - end - object mnuFlipVert: TMenuItem - Caption = 'Vertical' - OnClick = mnuFlipHorzClick - end - end - object mnuConvert: TMenuItem - Caption = 'Convert' - object mnuTo4Bits: TMenuItem - Caption = 'To 4 Bits' - OnClick = mnuFlipHorzClick - end - object mnuTo8Bits: TMenuItem - Caption = 'To 8 Bits' - OnClick = mnuFlipHorzClick - end - object mnuTo16Bits555: TMenuItem - Caption = 'To 16 Bits (555)' - OnClick = mnuFlipHorzClick - end - object mnuTo16Bits565: TMenuItem - Caption = 'To 16 Bits (565)' - OnClick = mnuFlipHorzClick - end - object mnuTo24Bits: TMenuItem - Caption = 'To 24 Bits' - OnClick = mnuFlipHorzClick - end - object mnuTo32Bits: TMenuItem - Caption = 'To 32 Bits' - OnClick = mnuFlipHorzClick - end - object mnuDither: TMenuItem - Caption = 'Dither' - OnClick = mnuFlipHorzClick - end - object mnuQuantize: TMenuItem - Caption = 'Quantize' - OnClick = mnuFlipHorzClick - end - object mnuGrayScale: TMenuItem - Caption = 'GrayScale' - OnClick = mnuFlipHorzClick - end - end - object mnuRotate: TMenuItem - Caption = 'Rotate' - object mnuClockwise: TMenuItem - Caption = 'Clockwise' - OnClick = mnuFlipHorzClick - end - object mnuAntiClockwise: TMenuItem - Caption = 'AntiClockwise' - OnClick = mnuFlipHorzClick - end - end - object mnuInvert: TMenuItem - Caption = 'Invert' - OnClick = mnuFlipHorzClick - end - object mnuClear: TMenuItem - Caption = 'Clear' - OnClick = mnuFlipHorzClick - end - end - end - object OD: TOpenDialog - Title = 'Open file ...' - Left = 152 - Top = 48 - end - object ImageList1: TImageList - Left = 184 - Top = 48 - Bitmap = { - 494C010104000900040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 - 0000000000003600000028000000400000003000000001002000000000000030 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000007088900060809000607880005070 - 8000506070004058600040485000303840002030300020203000101820001010 - 1000101020000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000080685000203040002030400020304000203040002030 - 4000203040002030400020304000203040000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000DFE2F700EFF0FB0000000000000000007088900090A0B00070B0D0000090 - D0000090D0000090D0000090C0001088C0001080B0001080B0002078A0002070 - 900020486000B9BEBE0000000000000000000000000000000000000000000000 - 00000000000000000000C0704000B0583000B0583000A0502000A05020009048 - 2000904820009040200080402000000000007086900060809000506070004050 - 6000304050002030400090706000F0E0D000B0A09000B0A09000B0A09000B0A0 - 9000B0A09000B0A09000B0A0900020304000000000000000000000000000EFF1 - FF001F3BF100EFF1FF000000000000000000000000000000000000000000CFD3 - F3001F2DB900CFD2F30000000000000000008088900080C0D00090A8B00080E0 - FF0060D0FF0050C8FF0050C8FF0040C0F00030B0F00030A8F00020A0E0001090 - D00020688000656A700000000000000000000000000000000000000000000000 - 00000000000000000000C0785000FFF8F000D0B0A000D0B0A000D0B0A000C0B0 - A000C0A8A000C0A8900090402000000000007080900020B8F0000090D0000090 - D0000090D0000090D00090786000F0E8E000F0D8D000E0D0C000E0C8C000D0C0 - B000D0B8B000D0B8B000B0A09000203040000000000000000000F0F2FF00576F - FF001030FF001E34FF00EFF1FF00000000000000000000000000DFE2F7003F51 - CF000018C0000F1EB400DFE2F700000000008090A00080D0F00090A8B00090C0 - D00070D8FF0060D0FF0060D0FF0050C8FF0050C0FF0040B8F00030B0F00030A8 - F0001088D00020486000E1E4E500000000000000000000000000000000000000 - 00000000000000000000D0886000FFFFFF00E0906000D0805000D0805000D080 - 5000D0805000C0A8A00090482000000000007088900070C8F00010B8F00010B0 - F00000A8E0000098D000A0807000F0F0F000C0B0A000C0B0A000C0A8A000B0A0 - 9000D0C0B000B0A09000B0A0900020304000000000000000000000000000F1F2 - FF002D52FF001030FF000028FF00CFD5FF0000000000CFD3F3001F34C7000018 - D0000F25C300BFC5EF0000000000000000008090A00080D8F00080C8E00090A8 - B00080E0FF0070D0FF0060D8FF0060D0FF0060D0FF0050C8FF0040C0F00040B8 - F00030B0F000206880007897A50000000000B0A0900060483000604830006048 - 30006048300060483000D0907000FFFFFF00FFFFFF00FFF0F000F0E0D000F0D0 - C000F0C0B000C0B0A00090482000000000008088900070D0F00030C0F00010B8 - F00000A8F00000A0E000A0888000FFF8FF00F0F0F000F0E8E000F0D8D000E0D0 - C000705850006050400050484000404040000000000000000000000000000000 - 0000F1F2FF002D52FF001030FF000F2DFF00CFD3F6001F34D5000020E0000F25 - D200DFE2F7000000000000000000000000008098A00090E0F00090E0FF0090A8 - B00090B8C00070D8FF0060D8FF0060D8FF0060D8FF0060D0FF0050D0FF0050C8 - FF0040B8F00030A0E0004B697800DEE1E400B0A09000FFF0F000F0E0D000E0D8 - D000E0D0C000E0C8C000E0A08000FFFFFF00F0A88000E0987000E0906000D080 - 5000D0805000D0B0A000A0482000000000008090A00080D8F00040C8F00030C0 - F00010B8F00000A0E000B0908000FFFFFF00C0B0A000C0B0A000C0A8A000F0E0 - D00080605000D0C8C00060504000000000000000000000000000000000000000 - 000000000000E3E6FF005669FF001038FF000020F0000F2DF0002F42D800DFE2 - F700000000000000000000000000000000008098A00090E0F000A0E8FF0080C8 - E00090A8B00080E0FF0080E0FF0080E0FF0080E0FF0080E0FF0080E0FF0080E0 - FF0070D8FF0070D8FF0050A8D000919BA500B0A09000FFF8F000E0B08000E0A0 - 7000E0A07000D0987000E0A89000FFFFFF00FFFFFF00FFFFFF00FFF8F000F0E8 - E000F0D0C000D0B0A000A0502000000000008098A00090E0F00060D8F00050C8 - F00030C0F00010B0F000B0989000FFFFFF00FFFFFF00FFF8FF00F0F0F000F0E8 - E000806850008060500000000000000000000000000000000000000000000000 - 00000000000000000000C3CAFF002048FF001030FF000F2DF000CFD3F6000000 - 00000000000000000000000000000000000090A0A000A0E8F000A0E8FF00A0E8 - FF0090B0C00090B0C00090A8B00090A8B00080A0B00080A0B0008098A0008098 - A0008090A0008090A0008088900070889000C0A89000FFFFFF00FFF8F000F0F0 - F000F0E8E000F0E0D000E0B8A000FFFFFF00FFB09000FFB09000F0D8D000E090 - 6000B0583000B0583000A0502000000000008098A000A0E8F00080E0F00070D8 - F00050D0F00010B0F000B0A09000B0989000B0908000A0888000A08070009078 - 6000907060000000000000000000000000000000000000000000000000000000 - 000000000000CFD7FF004060FF003050FF002D4BFF001038FF000020F000DFE3 - FD000000000000000000000000000000000090A0B000A0E8F000A0F0FF00A0E8 - FF00A0E8FF0080D8FF0060D8FF0060D8FF0060D8FF0060D8FF0060D8FF0060D8 - FF0070889000000000000000000000000000C0A8A000FFFFFF00FFC8A000F0B8 - 9000E0B08000E0A07000F0C0A000FFFFFF00FFFFFF00FFFFFF00FFFFFF00F098 - 7000F0C8B000B0583000EBD5CB000000000090A0A000B0F0FF00A0E8FF0090E0 - F00070D0F00010A0D00010A0D00010A0D0001098D0000090D0000090D0000090 - D000303840000000000000000000000000000000000000000000000000000000 - 0000DBE1FF004060FF004058FF004B70FF00CFD5FF004B69FF002040FF000020 - F000CFD5FC0000000000000000000000000090A0B000A0F0F000B0F0F000A0F0 - FF00A0E8FF00A0E8FF0070D8FF0090A0A0008098A0008098A0008090A0008090 - 900070889000000000000000000000000000C0B0A000FFFFFF00FFFFFF00FFF8 - FF00FFF0F000F0E8E000F0C8B000FFFFFF00FFFFFF00FFFFFF00FFFFFF00F0A8 - 8000C0683000EFD9CB00000000000000000090A0B000B0F0FF00A0F0FF006080 - 9000607080005070800050687000506870005060700040587000207090000090 - D00040486000000000000000000000000000000000000000000000000000E7EB - FF005070FF005078FF00708AFF00E7EBFF0000000000DBDFFF004B69FF003048 - FF000020F000CFD5FC00000000000000000090A8B000A0D0E000B0F0F000B0F0 - F000A0F0FF00A0E8FF0090A0B000B3C7CB000000000000000000000000000000 - 000000000000906850009068500090685000D0B8B000FFFFFF00FFD8C000FFD0 - B000F0E0D000B0A09000F0C8B000F0C0B000F0C0B000F0B8A000F0B09000F0B0 - 9000F7E3D70000000000000000000000000090A8B000B0F0FF00B0F0FF006088 - 900090C8D00090E8F00080D8E00060C8E0005098B000405860002080A0000090 - D000505870000000000000000000000000000000000000000000F3F5FF006078 - FF006078FF00697FFF00F3F5FF00000000000000000000000000E7EAFF004B69 - FF003050FF000028FF00DFE3FD0000000000DCE3E60090A8B00090A8B00090A8 - B00090A8B00090A8B000AAB3B400000000000000000000000000000000000000 - 000000000000E1D4D2009068500090685000D0C0B000FFFFFF00FFFFFF00FFFF - FF00FFFFFF00C0A89000D0C8C00090706000E1DCD80000000000000000000000 - 00000000000000000000000000000000000090A8B000B0F0F000B0F0FF00A0F0 - F0007098A000A0F0F00060757C0080C8D000507080003060800060C0F00020B8 - F00050607000000000000000000000000000000000000000000000000000E7EB - FF006987FF00F3F5FF000000000000000000000000000000000000000000E7EA - FF005773FF00E1E5FF0000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000090786000B7A498000000 - 0000F9F6F600A0908000E1D9D20090786000E0C0B000FFFFFF00FFFFFF00FFFF - FF00FFFFFF00C0B0A000A0806000E1DCD8000000000000000000000000000000 - 000000000000000000000000000000000000CED8DC0090A8B00090A8B00090A8 - B0006090A000A0E8F000A0E8F00090D8E0004068700070889000808890007088 - 9000D7DADC000000000000000000000000000000000000000000000000000000 - 0000F3F5FF000000000000000000000000000000000000000000000000000000 - 0000E7EAFF000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000000000000000D1CFC900A0908000A088 - 8000B0988000CFC7BF000000000000000000E0C0B000E0C0B000D0C0B000D0C0 - B000D0B8B000D0B0A000E6DEDC00000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000080B0C00080B0C00080A0B000DEE1E40000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 000000000000000000000000000000000000424D3E000000000000003E000000 - 2800000040000000300000000100010000000000800100000000000000000000 - 000000000000000000000000FFFFFF0000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 0000000000000000000000000000000000000000000000000000000000000000 - 00000000000000000000000000000000FFFFFFFFFFFFFFFF0007FFFFFC00FFF3 - 0003FC010000E3E30003FC010000C1C10001FC010000E083000100010000F007 - 000000010001F80F000000010003FC1F000000010007F80F000700010007F007 - 000700030007E08300F800070007C1C101F8007F0007E3E3FF9000FF0007F7F7 - FF8301FFF87FFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000 - 000000000000} - end -end diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.pas b/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.pas deleted file mode 100644 index 5972081..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/demo/WinBitmap/MainForm.pas +++ /dev/null @@ -1,227 +0,0 @@ -unit MainForm; - -interface - -uses - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, Menus, FreeBitmap, ComCtrls, ImgList, ToolWin; - -type - TfwbMainForm = class(TForm) - MainMenu: TMainMenu; - mnuFile: TMenuItem; - mnuFileOpen: TMenuItem; - mnuExit: TMenuItem; - OD: TOpenDialog; - StatusBar: TStatusBar; - mnuImage: TMenuItem; - mnuImageFlip: TMenuItem; - mnuFlipHorz: TMenuItem; - mnuFlipVert: TMenuItem; - mnuConvert: TMenuItem; - mnuTo8Bits: TMenuItem; - mnuTo16Bits555: TMenuItem; - mnuTo16Bits565: TMenuItem; - mnuTo24Bits: TMenuItem; - mnuTo32Bits: TMenuItem; - mnuDither: TMenuItem; - mnuQuantize: TMenuItem; - mnuGrayScale: TMenuItem; - mnuRotate: TMenuItem; - mnuClockwise: TMenuItem; - mnuAntiClockwise: TMenuItem; - mnuInvert: TMenuItem; - mnuClear: TMenuItem; - mnuTo4Bits: TMenuItem; - tbTools: TToolBar; - btnCopy: TToolButton; - ImageList1: TImageList; - ToolButton1: TToolButton; - btnPaste: TToolButton; - btnClear: TToolButton; - btnOpen: TToolButton; - ToolButton3: TToolButton; - ToolButton4: TToolButton; - procedure FormDestroy(Sender: TObject); - procedure FormPaint(Sender: TObject); - procedure FormCreate(Sender: TObject); - procedure mnuExitClick(Sender: TObject); - procedure mnuFileOpenClick(Sender: TObject); - procedure FormResize(Sender: TObject); - procedure mnuFlipHorzClick(Sender: TObject); - procedure btnCopyClick(Sender: TObject); - procedure btnClearClick(Sender: TObject); - procedure btnPasteClick(Sender: TObject); - private - FBitmap: TFreeWinBitmap; - procedure WMEraseBkgnd(var Message: TMessage); message WM_ERASEBKGND; - public - { Public declarations } - end; - -var - fwbMainForm: TfwbMainForm; - -implementation - -{$R *.dfm} - -uses - FreeUtils, FreeImage, Math; - -procedure TfwbMainForm.FormDestroy(Sender: TObject); -begin - if Assigned(FBitmap) then - FBitmap.Free; -end; - -procedure TfwbMainForm.FormPaint(Sender: TObject); -var - dx, dy, w, h: Integer; - r1, r2: Double; - R: TRect; -begin - if FBitmap.IsValid then // draw the bitmap - begin - // determine paint rect - r1 := FBitmap.GetWidth / FBitmap.GetHeight; - r2 := ClientWidth / ClientHeight; - if r1 > r2 then // fit by width - begin - w := ClientWidth; - h := Floor(w / r1); - dx := 0; - dy := (ClientHeight - h) div 2; - end - else // fit by height - begin - h := ClientHeight; - w := Floor(h * r1); - dy := 0; - dx := (ClientWidth - w) div 2; - end; - with ClientRect do - R := Bounds(Left + dx, Top + dy, w, h); - FBitmap.Draw(Canvas.Handle, R); - - // erase area around the image - Canvas.Brush.Color := Color; - if dx > 0 then - begin - with ClientRect do - R := Bounds(Left, Top, dx, ClientHeight); - Canvas.FillRect(R); - with ClientRect do - R := Bounds(Right - dx, Top, dx, ClientHeight); - Canvas.FillRect(R); - end else - if dy > 0 then - begin - with ClientRect do - R := Bounds(Left, Top, ClientWidth, dy); - Canvas.FillRect(R); - with ClientRect do - R := Bounds(Left, Bottom - dy, ClientWidth, dy); - Canvas.FillRect(R); - end - end - else // clear - begin - Canvas.Brush.Color := Color; - Canvas.FillRect(ClientRect); - end -end; - -procedure TfwbMainForm.FormCreate(Sender: TObject); -begin - FBitmap := TFreeWinBitmap.Create; - - mnuImage.Enabled := FBitmap.IsValid; - OD.Filter := FIU_GetAllFilters; -end; - -procedure TfwbMainForm.mnuExitClick(Sender: TObject); -begin - Close; -end; - -procedure TfwbMainForm.mnuFileOpenClick(Sender: TObject); -var - t: Cardinal; -begin - if OD.Execute then - begin - t := GetTickCount; - FBitmap.Load(OD.FileName); - t := GetTickCount - t; - mnuImage.Enabled := FBitmap.IsValid; - StatusBar.Panels[0].Text := 'Loaded in ' + IntToStr(t) + ' msec.'; - StatusBar.Panels[1].Text := Format('%dx%d', [FBitmap.GetWidth, FBitmap.GetHeight]); - Invalidate; - end; -end; - -procedure TfwbMainForm.FormResize(Sender: TObject); -begin - Invalidate -end; - -procedure TfwbMainForm.WMEraseBkgnd(var Message: TMessage); -begin - Message.Result := 1; -end; - -procedure TfwbMainForm.mnuFlipHorzClick(Sender: TObject); -begin - with FBitmap do - if Sender = mnuFlipHorz then - FLipHorizontal else - if Sender = mnuFlipVert then - FlipVertical else - if Sender = mnuTo4Bits then - ConvertTo4Bits else - if Sender = mnuTo8Bits then - ConvertTo8Bits else - if Sender = mnuTo16Bits555 then - ConvertTo16Bits555 else - if Sender = mnuTo16Bits565 then - ConvertTo16Bits565 else - if Sender = mnuTo24Bits then - ConvertTo24Bits else - if Sender = mnuTo32Bits then - ConvertTo32Bits else - if Sender = mnuDither then - Dither(FID_FS) else - if Sender = mnuQuantize then - ColorQuantize(FIQ_WUQUANT) else - if Sender = mnuGrayScale then - ConvertToGrayscale else - if Sender = mnuClockwise then - Rotate(-90) else - if Sender = mnuAntiClockwise then - Rotate(90) else - if Sender = mnuInvert then - Invert else - if Sender = mnuClear then - Clear; - Invalidate; -end; - -procedure TfwbMainForm.btnCopyClick(Sender: TObject); -begin - if FBitmap.IsValid then FBitmap.CopyToClipBoard(Handle); -end; - -procedure TfwbMainForm.btnClearClick(Sender: TObject); -begin - FBitmap.Clear; - Invalidate; -end; - -procedure TfwbMainForm.btnPasteClick(Sender: TObject); -begin - FBitmap.PasteFromClipBoard; - Invalidate; -end; - -end. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/license.txt b/DSTexCompress/FreeImage/Wrapper/Delphi/license.txt deleted file mode 100644 index 48215b6..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/license.txt +++ /dev/null @@ -1,3 +0,0 @@ -The contents of FreeImageDW package are subject to the FreeImage Public License Version 1.0 (the "License"); you may not use this package except in compliance with the License. You may obtain a copy of the License at http://home.wxs.nl/~flvdberg/freeimage-license.txt - -Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/src/FreeBitmap.pas b/DSTexCompress/FreeImage/Wrapper/Delphi/src/FreeBitmap.pas deleted file mode 100644 index cae4b45..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/src/FreeBitmap.pas +++ /dev/null @@ -1,2131 +0,0 @@ -unit FreeBitmap; - -// ========================================================== -// -// Delphi wrapper for FreeImage 3 -// -// Design and implementation by -// - Anatoliy Pulyaevskiy (xvel84@rambler.ru) -// -// Contributors: -// - Enzo Costantini (enzocostantini@libero.it) -// - Lorenzo Monti (LM) lomo74@gmail.com -// -// 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! -// -// ========================================================== -// -// From begining all code of this file is based on C++ wrapper to -// FreeImage - FreeImagePlus. -// -// ========================================================== - -interface - -{$I 'Version.inc'} - -uses - SysUtils, Classes, Windows, FreeImage; - -type - { TFreeObject } - - TFreeObject = class(TObject) - public - function IsValid: Boolean; virtual; - end; - - { TFreeTag } - - TFreeTag = class(TFreeObject) - private - // fields - FTag: PFITAG; - - // getters & setters - function GetCount: Cardinal; - function GetDescription: AnsiString; - function GetID: Word; - function GetKey: AnsiString; - function GetLength: Cardinal; - function GetTagType: FREE_IMAGE_MDTYPE; - function GetValue: Pointer; - procedure SetCount(const Value: Cardinal); - procedure SetDescription(const Value: AnsiString); - procedure SetID(const Value: Word); - procedure SetKey(const Value: AnsiString); - procedure SetLength(const Value: Cardinal); - procedure SetTagType(const Value: FREE_IMAGE_MDTYPE); - procedure SetValue(const Value: Pointer); - public - // construction & destruction - constructor Create(ATag: PFITAG = nil); virtual; - destructor Destroy; override; - - // methods - function Clone: TFreeTag; - function IsValid: Boolean; override; - function ToString(Model: FREE_IMAGE_MDMODEL; Make: PAnsiChar = nil): AnsiString; reintroduce; - - // properties - property Key: AnsiString read GetKey write SetKey; - property Description: AnsiString read GetDescription write SetDescription; - property ID: Word read GetID write SetID; - property TagType: FREE_IMAGE_MDTYPE read GetTagType write SetTagType; - property Count: Cardinal read GetCount write SetCount; - property Length: Cardinal read GetLength write SetLength; - property Value: Pointer read GetValue write SetValue; - property Tag: PFITAG read FTag; - end; - - { forward declarations } - - TFreeBitmap = class; - TFreeMemoryIO = class; - - { TFreeBitmap } - - TFreeBitmapChangingEvent = procedure(Sender: TFreeBitmap; var OldDib, NewDib: PFIBITMAP; var Handled: Boolean) of object; - - TFreeBitmap = class(TFreeObject) - private - // fields - FDib: PFIBITMAP; - FOnChange: TNotifyEvent; - FOnChanging: TFreeBitmapChangingEvent; - - procedure SetDib(Value: PFIBITMAP); - protected - function DoChanging(var OldDib, NewDib: PFIBITMAP): Boolean; dynamic; - function Replace(NewDib: PFIBITMAP): Boolean; dynamic; - public - constructor Create(ImageType: FREE_IMAGE_TYPE = FIT_BITMAP; Width: Integer = 0; Height: Integer = 0; Bpp: Integer = 0); - destructor Destroy; override; - function SetSize(ImageType: FREE_IMAGE_TYPE; Width, Height, Bpp: Integer; RedMask: Cardinal = 0; GreenMask: Cardinal = 0; BlueMask: Cardinal = 0): Boolean; - procedure Change; dynamic; - procedure Assign(Source: TFreeBitmap); - function CopySubImage(Left, Top, Right, Bottom: Integer; Dest: TFreeBitmap): Boolean; - function PasteSubImage(Src: TFreeBitmap; Left, Top: Integer; Alpha: Integer = 256): Boolean; - procedure Clear; virtual; - function Load(const FileName: AnsiString; Flag: Integer = 0): Boolean; - function LoadU(const FileName: {$IFDEF DELPHI2010}string{$ELSE}WideString{$ENDIF}; Flag: Integer = 0): Boolean; - function LoadFromHandle(IO: PFreeImageIO; Handle: fi_handle; Flag: Integer = 0): Boolean; - function LoadFromMemory(MemIO: TFreeMemoryIO; Flag: Integer = 0): Boolean; - function LoadFromStream(Stream: TStream; Flag: Integer = 0): Boolean; - // save functions - function CanSave(fif: FREE_IMAGE_FORMAT): Boolean; - function Save(const FileName: AnsiString; Flag: Integer = 0): Boolean; - function SaveU(const FileName: {$IFDEF DELPHI2010}string{$ELSE}WideString{$ENDIF}; Flag: Integer = 0): Boolean; - function SaveToHandle(fif: FREE_IMAGE_FORMAT; IO: PFreeImageIO; Handle: fi_handle; Flag: Integer = 0): Boolean; - function SaveToMemory(fif: FREE_IMAGE_FORMAT; MemIO: TFreeMemoryIO; Flag: Integer = 0): Boolean; - function SaveToStream(fif: FREE_IMAGE_FORMAT; Stream: TStream; Flag: Integer = 0): Boolean; - // image information - function GetImageType: FREE_IMAGE_TYPE; - function GetWidth: Integer; - function GetHeight: Integer; - function GetScanWidth: Integer; - function IsValid: Boolean; override; - function GetInfo: PBitmapInfo; - function GetInfoHeader: PBitmapInfoHeader; - function GetImageSize: Cardinal; - function GetBitsPerPixel: Integer; - function GetLine: Integer; - function GetHorizontalResolution: Double; - function GetVerticalResolution: Double; - procedure SetHorizontalResolution(Value: Double); - procedure SetVerticalResolution(Value: Double); - // palette operations - function GetPalette: PRGBQUAD; - function GetPaletteSize: Integer; - function GetColorsUsed: Integer; - function GetColorType: FREE_IMAGE_COLOR_TYPE; - function IsGrayScale: Boolean; - // pixels access - function AccessPixels: PByte; - function GetScanLine(ScanLine: Integer): PByte; - function GetPixelIndex(X, Y: Cardinal; var Value: Byte): Boolean; - function GetPixelColor(X, Y: Cardinal; var Value: RGBQUAD): Boolean; - function SetPixelIndex(X, Y: Cardinal; var Value: Byte): Boolean; - function SetPixelColor(X, Y: Cardinal; var Value: RGBQUAD): Boolean; - // convertion - function ConvertToStandardType(ScaleLinear: Boolean): Boolean; - function ConvertToType(ImageType: FREE_IMAGE_TYPE; ScaleLinear: Boolean): Boolean; - function Threshold(T: Byte): Boolean; - function ConvertTo4Bits: Boolean; - function ConvertTo8Bits: Boolean; - function ConvertTo16Bits555: Boolean; - function ConvertTo16Bits565: Boolean; - function ConvertTo24Bits: Boolean; - function ConvertTo32Bits: Boolean; - function ConvertToGrayscale: Boolean; - function ColorQuantize(Algorithm: FREE_IMAGE_QUANTIZE): Boolean; - function Dither(Algorithm: FREE_IMAGE_DITHER): Boolean; - function ConvertToRGBF: Boolean; - function ToneMapping(TMO: FREE_IMAGE_TMO; FirstParam, SecondParam: Double): Boolean; - // transparency - function IsTransparent: Boolean; - function GetTransparencyCount: Cardinal; - function GetTransparencyTable: PByte; - procedure SetTransparencyTable(Table: PByte; Count: Integer); - function HasFileBkColor: Boolean; - function GetFileBkColor(var BkColor: RGBQUAD): Boolean; - function SetFileBkColor(BkColor: PRGBQuad): Boolean; - // channel processing routines - function GetChannel(Bitmap: TFreeBitmap; Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; - function SetChannel(Bitmap: TFreeBitmap; Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; - function SplitChannels(RedChannel, GreenChannel, BlueChannel: TFreeBitmap): Boolean; - function CombineChannels(Red, Green, Blue: TFreeBitmap): Boolean; - // rotation and flipping - function RotateEx(Angle, XShift, YShift, XOrigin, YOrigin: Double; UseMask: Boolean): Boolean; - function Rotate(Angle: Double): Boolean; - function FlipHorizontal: Boolean; - function FlipVertical: Boolean; - // color manipulation routines - function Invert: Boolean; - function AdjustCurve(Lut: PByte; Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; - function AdjustGamma(Gamma: Double): Boolean; - function AdjustBrightness(Percentage: Double): Boolean; - function AdjustContrast(Percentage: Double): Boolean; - function GetHistogram(Histo: PDWORD; Channel: FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK): Boolean; - // upsampling / downsampling - procedure MakeThumbnail(const Width, Height: Integer; DestBitmap: TFreeBitmap); - function Rescale(NewWidth, NewHeight: Integer; Filter: FREE_IMAGE_FILTER; Dest: TFreeBitmap = nil): Boolean; - // metadata routines - function FindFirstMetadata(Model: FREE_IMAGE_MDMODEL; var Tag: TFreeTag): PFIMETADATA; - function FindNextMetadata(MDHandle: PFIMETADATA; var Tag: TFreeTag): Boolean; - procedure FindCloseMetadata(MDHandle: PFIMETADATA); - function SetMetadata(Model: FREE_IMAGE_MDMODEL; const Key: AnsiString; Tag: TFreeTag): Boolean; - function GetMetadata(Model: FREE_IMAGE_MDMODEL; const Key: AnsiString; var Tag: TFreeTag): Boolean; - function GetMetadataCount(Model: FREE_IMAGE_MDMODEL): Cardinal; - - // properties - property Dib: PFIBITMAP read FDib write SetDib; - property OnChange: TNotifyEvent read FOnChange write FOnChange; - property OnChanging: TFreeBitmapChangingEvent read FOnChanging write FOnChanging; - end; - - { TFreeWinBitmap } - - TFreeWinBitmap = class(TFreeBitmap) - private - FDeleteMe: Boolean; // True - need to delete FDisplayDib - FDisplayDib: PFIBITMAP; // Image that paints on DC - public - constructor Create(ImageType: FREE_IMAGE_TYPE = FIT_BITMAP; Width: Integer = 0; Height: Integer = 0; Bpp: Integer = 0); - destructor Destroy; override; - - procedure Clear; override; - function CopyToHandle: THandle; - function CopyFromHandle(HMem: THandle): Boolean; - function CopyFromBitmap(HBmp: HBITMAP): Boolean; - function CopyToBitmapH: HBITMAP; - function CopyToClipBoard(NewOwner: HWND): Boolean; - function PasteFromClipBoard: Boolean; - function CaptureWindow(ApplicationWindow, SelectedWindow: HWND): Boolean; - - procedure Draw(DC: HDC; Rect: TRect); - procedure DrawEx(DC: HDC; Rect: TRect; UseFileBkg: Boolean = False; AppBkColor: PRGBQuad = nil; Bg: PFIBITMAP = nil); - end; - - { TFreeMemoryIO } - - TFreeMemoryIO = class(TFreeObject) - private - FHMem: PFIMEMORY; - public - // construction and destruction - constructor Create(Data: PByte = nil; SizeInBytes: DWORD = 0); - destructor Destroy; override; - - function GetFileType: FREE_IMAGE_FORMAT; - function Read(fif: FREE_IMAGE_FORMAT; Flag: Integer = 0): PFIBITMAP; - function Write(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; Flag: Integer = 0): Boolean; - function Tell: Longint; - function Seek(Offset: Longint; Origin: Word): Boolean; - function Acquire(var Data: PByte; var SizeInBytes: DWORD): Boolean; - // overriden methods - function IsValid: Boolean; override; - end; - - { TFreeMultiBitmap } - - TFreeMultiBitmap = class(TFreeObject) - private - FMPage: PFIMULTIBITMAP; - FMemoryCache: Boolean; - public - // constructor and destructor - constructor Create(KeepCacheInMemory: Boolean = False); - destructor Destroy; override; - - // methods - function Open(const FileName: AnsiString; CreateNew, ReadOnly: Boolean; Flags: Integer = 0): Boolean; - function Close(Flags: Integer = 0): Boolean; - function GetPageCount: Integer; - procedure AppendPage(Bitmap: TFreeBitmap); - procedure InsertPage(Page: Integer; Bitmap: TFreeBitmap); - procedure DeletePage(Page: Integer); - function MovePage(Target, Source: Integer): Boolean; - procedure LockPage(Page: Integer; DestBitmap: TFreeBitmap); - procedure UnlockPage(Bitmap: TFreeBitmap; Changed: Boolean); - function GetLockedPageNumbers(var Pages: Integer; var Count: Integer): Boolean; - // overriden methods - function IsValid: Boolean; override; - - // properties - // change of this property influences only on the next opening of a file - property MemoryCache: Boolean read FMemoryCache write FMemoryCache; - end; - -implementation - -const - ThumbSize = 150; - -// marker used for clipboard copy / paste - -procedure SetFreeImageMarker(bmih: PBitmapInfoHeader; dib: PFIBITMAP); -begin - // Windows constants goes from 0L to 5L - // Add $FF to avoid conflicts - bmih.biCompression := $FF + FreeImage_GetImageType(dib); -end; - -function GetFreeImageMarker(bmih: PBitmapInfoHeader): FREE_IMAGE_TYPE; -begin - Result := FREE_IMAGE_TYPE(bmih.biCompression - $FF); -end; - -{ TFreePersistent } - -function TFreeObject.IsValid: Boolean; -begin - Result := False -end; - -{ TFreeBitmap } - -function TFreeBitmap.AccessPixels: PByte; -begin - Result := FreeImage_GetBits(FDib) -end; - -function TFreeBitmap.AdjustBrightness(Percentage: Double): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_AdjustBrightness(FDib, Percentage); - Change; - end - else - Result := False -end; - -function TFreeBitmap.AdjustContrast(Percentage: Double): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_AdjustContrast(FDib, Percentage); - Change; - end - else - Result := False -end; - -function TFreeBitmap.AdjustCurve(Lut: PByte; - Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_AdjustCurve(FDib, Lut, Channel); - Change; - end - else - Result := False -end; - -function TFreeBitmap.AdjustGamma(Gamma: Double): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_AdjustGamma(FDib, Gamma); - Change; - end - else - Result := False -end; - -procedure TFreeBitmap.Assign(Source: TFreeBitmap); -var - SourceBmp: TFreeBitmap; - Clone: PFIBITMAP; -begin - if Source = nil then - begin - Clear; - Exit; - end; - - if Source is TFreeBitmap then - begin - SourceBmp := TFreeBitmap(Source); - if SourceBmp <> Self then - begin - if SourceBmp.IsValid then - begin - Clone := FreeImage_Clone(SourceBmp.FDib); - Replace(Clone); - end - else - Clear; - end; - end; -end; - -function TFreeBitmap.CanSave(fif: FREE_IMAGE_FORMAT): Boolean; -var - ImageType: FREE_IMAGE_TYPE; - Bpp: Word; -begin - Result := False; - if not IsValid then Exit; - - if fif <> FIF_UNKNOWN then - begin - // check that the dib can be saved in this format - ImageType := FreeImage_GetImageType(FDib); - if ImageType = FIT_BITMAP then - begin - // standard bitmap type - Bpp := FreeImage_GetBPP(FDib); - Result := FreeImage_FIFSupportsWriting(fif) - and FreeImage_FIFSupportsExportBPP(fif, Bpp); - end - else // special bitmap type - Result := FreeImage_FIFSupportsExportType(fif, ImageType); - end; -end; - -procedure TFreeBitmap.Change; -begin - if Assigned(FOnChange) then FOnChange(Self) -end; - -procedure TFreeBitmap.Clear; -begin - if FDib <> nil then - begin - FreeImage_Unload(FDib); - FDib := nil; - Change; - end; -end; - -function TFreeBitmap.ColorQuantize( - Algorithm: FREE_IMAGE_QUANTIZE): Boolean; -var - dib8: PFIBITMAP; -begin - if FDib <> nil then - begin - dib8 := FreeImage_ColorQuantize(FDib, Algorithm); - Result := Replace(dib8); - end - else - Result := False; -end; - -function TFreeBitmap.CombineChannels(Red, Green, - Blue: TFreeBitmap): Boolean; -var - Width, Height: Integer; -begin - if FDib = nil then - begin - Width := Red.GetWidth; - Height := Red.GetHeight; - FDib := FreeImage_Allocate(Width, Height, 24, FI_RGBA_RED_MASK, - FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK); - end; - - if FDib <> nil then - begin - Result := FreeImage_SetChannel(FDib, Red.FDib, FICC_RED) and - FreeImage_SetChannel(FDib, Green.FDib, FICC_GREEN) and - FreeImage_SetChannel(FDib, Blue.FDib, FICC_BLUE); - - Change - end - else - Result := False; -end; - -function TFreeBitmap.ConvertTo16Bits555: Boolean; -var - dib16_555: PFIBITMAP; -begin - if FDib <> nil then - begin - dib16_555 := FreeImage_ConvertTo16Bits555(FDib); - Result := Replace(dib16_555); - end - else - Result := False -end; - -function TFreeBitmap.ConvertTo16Bits565: Boolean; -var - dib16_565: PFIBITMAP; -begin - if FDib <> nil then - begin - dib16_565 := FreeImage_ConvertTo16Bits565(FDib); - Result := Replace(dib16_565); - end - else - Result := False -end; - -function TFreeBitmap.ConvertTo24Bits: Boolean; -var - dibRGB: PFIBITMAP; -begin - if FDib <> nil then - begin - dibRGB := FreeImage_ConvertTo24Bits(FDib); - Result := Replace(dibRGB); - end - else - Result := False -end; - -function TFreeBitmap.ConvertTo32Bits: Boolean; -var - dib32: PFIBITMAP; -begin - if FDib <> nil then - begin - dib32 := FreeImage_ConvertTo32Bits(FDib); - Result := Replace(dib32); - end - else - Result := False -end; - -function TFreeBitmap.ConvertTo4Bits: Boolean; -var - dib4: PFIBITMAP; -begin - Result := False; - if IsValid then - begin - dib4 := FreeImage_ConvertTo4Bits(FDib); - Result := Replace(dib4); - end; -end; - -function TFreeBitmap.ConvertTo8Bits: Boolean; -var - dib8: PFIBITMAP; -begin - if FDib <> nil then - begin - dib8 := FreeImage_ConvertTo8Bits(FDib); - Result := Replace(dib8); - end - else - Result := False -end; - -function TFreeBitmap.ConvertToGrayscale: Boolean; -var - dib8: PFIBITMAP; -begin - Result := False; - - if IsValid then - begin - dib8 := FreeImage_ConvertToGreyscale(FDib); - Result := Replace(dib8); - end -end; - -function TFreeBitmap.ConvertToRGBF: Boolean; -var - ImageType: FREE_IMAGE_TYPE; - NewDib: PFIBITMAP; -begin - Result := False; - if not IsValid then Exit; - - ImageType := GetImageType; - - if (ImageType = FIT_BITMAP) then - begin - if GetBitsPerPixel < 24 then - if not ConvertTo24Bits then - Exit - end; - NewDib := FreeImage_ConvertToRGBF(FDib); - Result := Replace(NewDib); -end; - -function TFreeBitmap.ConvertToStandardType(ScaleLinear: Boolean): Boolean; -var - dibStandard: PFIBITMAP; -begin - if IsValid then - begin - dibStandard := FreeImage_ConvertToStandardType(FDib, ScaleLinear); - Result := Replace(dibStandard); - end - else - Result := False; -end; - -function TFreeBitmap.ConvertToType(ImageType: FREE_IMAGE_TYPE; - ScaleLinear: Boolean): Boolean; -var - dib: PFIBITMAP; -begin - if FDib <> nil then - begin - dib := FreeImage_ConvertToType(FDib, ImageType, ScaleLinear); - Result := Replace(dib) - end - else - Result := False -end; - -function TFreeBitmap.CopySubImage(Left, Top, Right, Bottom: Integer; - Dest: TFreeBitmap): Boolean; -begin - if FDib <> nil then - begin - Dest.FDib := FreeImage_Copy(FDib, Left, Top, Right, Bottom); - Result := Dest.IsValid; - end else - Result := False; -end; - -constructor TFreeBitmap.Create(ImageType: FREE_IMAGE_TYPE; Width, Height, - Bpp: Integer); -begin - inherited Create; - - FDib := nil; - if (Width > 0) and (Height > 0) and (Bpp > 0) then - SetSize(ImageType, Width, Height, Bpp); -end; - -destructor TFreeBitmap.Destroy; -begin - if FDib <> nil then - FreeImage_Unload(FDib); - inherited; -end; - -function TFreeBitmap.Dither(Algorithm: FREE_IMAGE_DITHER): Boolean; -var - dib: PFIBITMAP; -begin - if FDib <> nil then - begin - dib := FreeImage_Dither(FDib, Algorithm); - Result := Replace(dib); - end - else - Result := False; -end; - -function TFreeBitmap.DoChanging(var OldDib, NewDib: PFIBITMAP): Boolean; -begin - Result := False; - if (OldDib <> NewDib) and Assigned(FOnChanging) then - FOnChanging(Self, OldDib, NewDib, Result); -end; - -procedure TFreeBitmap.FindCloseMetadata(MDHandle: PFIMETADATA); -begin - FreeImage_FindCloseMetadata(MDHandle); -end; - -function TFreeBitmap.FindFirstMetadata(Model: FREE_IMAGE_MDMODEL; - var Tag: TFreeTag): PFIMETADATA; -begin - Result := FreeImage_FindFirstMetadata(Model, FDib, Tag.FTag); -end; - -function TFreeBitmap.FindNextMetadata(MDHandle: PFIMETADATA; - var Tag: TFreeTag): Boolean; -begin - Result := FreeImage_FindNextMetadata(MDHandle, Tag.FTag); -end; - -function TFreeBitmap.FlipHorizontal: Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_FlipHorizontal(FDib); - Change; - end - else - Result := False -end; - -function TFreeBitmap.FlipVertical: Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_FlipVertical(FDib); - Change; - end - else - Result := False -end; - -function TFreeBitmap.GetBitsPerPixel: Integer; -begin - Result := FreeImage_GetBPP(FDib) -end; - -function TFreeBitmap.GetChannel(Bitmap: TFreeBitmap; - Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; -begin - if FDib <> nil then - begin - Bitmap.Dib := FreeImage_GetChannel(FDib, Channel); - Result := Bitmap.IsValid; - end - else - Result := False -end; - -function TFreeBitmap.GetColorsUsed: Integer; -begin - Result := FreeImage_GetColorsUsed(FDib) -end; - -function TFreeBitmap.GetColorType: FREE_IMAGE_COLOR_TYPE; -begin - Result := FreeImage_GetColorType(FDib); -end; - -function TFreeBitmap.GetFileBkColor(var BkColor: RGBQUAD): Boolean; -begin - Result := FreeImage_GetBackgroundColor(FDib, BkColor); -end; - -function TFreeBitmap.GetHeight: Integer; -begin - Result := FreeImage_GetHeight(FDib) -end; - -function TFreeBitmap.GetHistogram(Histo: PDWORD; - Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; -begin - if FDib <> nil then - Result := FreeImage_GetHistogram(FDib, Histo, Channel) - else - Result := False -end; - -function TFreeBitmap.GetHorizontalResolution: Double; -begin - Result := FreeImage_GetDotsPerMeterX(FDib) / 100 -end; - -function TFreeBitmap.GetImageSize: Cardinal; -begin - Result := FreeImage_GetDIBSize(FDib); -end; - -function TFreeBitmap.GetImageType: FREE_IMAGE_TYPE; -begin - Result := FreeImage_GetImageType(FDib); -end; - -function TFreeBitmap.GetInfo: PBitmapInfo; -begin - Result := FreeImage_GetInfo(FDib); -end; - -function TFreeBitmap.GetInfoHeader: PBITMAPINFOHEADER; -begin - Result := FreeImage_GetInfoHeader(FDib) -end; - -function TFreeBitmap.GetLine: Integer; -begin - Result := FreeImage_GetLine(FDib) -end; - -function TFreeBitmap.GetMetadata(Model: FREE_IMAGE_MDMODEL; - const Key: AnsiString; var Tag: TFreeTag): Boolean; -begin - Result := FreeImage_GetMetaData(Model, FDib, PAnsiChar(Key), Tag.FTag); -end; - -function TFreeBitmap.GetMetadataCount(Model: FREE_IMAGE_MDMODEL): Cardinal; -begin - Result := FreeImage_GetMetadataCount(Model, FDib); -end; - -function TFreeBitmap.GetPalette: PRGBQUAD; -begin - Result := FreeImage_GetPalette(FDib) -end; - -function TFreeBitmap.GetPaletteSize: Integer; -begin - Result := FreeImage_GetColorsUsed(FDib) * SizeOf(RGBQUAD) -end; - -function TFreeBitmap.GetPixelColor(X, Y: Cardinal; - var Value: RGBQUAD): Boolean; -begin - Result := FreeImage_GetPixelColor(FDib, X, Y, Value); -end; - -function TFreeBitmap.GetPixelIndex(X, Y: Cardinal; - var Value: Byte): Boolean; -begin - Result := FreeImage_GetPixelIndex(FDib, X, Y, Value); -end; - -function TFreeBitmap.GetScanLine(ScanLine: Integer): PByte; -var - H: Integer; -begin - H := FreeImage_GetHeight(FDib); - if ScanLine < H then - Result := FreeImage_GetScanLine(FDib, ScanLine) - else - Result := nil; -end; - -function TFreeBitmap.GetScanWidth: Integer; -begin - Result := FreeImage_GetPitch(FDib) -end; - -function TFreeBitmap.GetTransparencyCount: Cardinal; -begin - Result := FreeImage_GetTransparencyCount(FDib) -end; - -function TFreeBitmap.GetTransparencyTable: PByte; -begin - Result := FreeImage_GetTransparencyTable(FDib) -end; - -function TFreeBitmap.GetVerticalResolution: Double; -begin - Result := FreeImage_GetDotsPerMeterY(Fdib) / 100 -end; - -function TFreeBitmap.GetWidth: Integer; -begin - Result := FreeImage_GetWidth(FDib) -end; - -function TFreeBitmap.HasFileBkColor: Boolean; -begin - Result := FreeImage_HasBackgroundColor(FDib) -end; - -function TFreeBitmap.Invert: Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_Invert(FDib); - Change; - end - else - Result := False -end; - -function TFreeBitmap.IsGrayScale: Boolean; -begin - Result := (FreeImage_GetBPP(FDib) = 8) - and (FreeImage_GetColorType(FDib) = FIC_PALETTE); -end; - -function TFreeBitmap.IsTransparent: Boolean; -begin - Result := FreeImage_IsTransparent(FDib); -end; - -function TFreeBitmap.IsValid: Boolean; -begin - Result := FDib <> nil -end; - -function TFreeBitmap.Load(const FileName: AnsiString; Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - - // check the file signature and get its format - fif := FreeImage_GetFileType(PAnsiChar(Filename), 0); - if fif = FIF_UNKNOWN then - // no signature? - // try to guess the file format from the file extention - fif := FreeImage_GetFIFFromFilename(PAnsiChar(FileName)); - - // check that the plugin has reading capabilities ... - if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(FIF) then - begin - // free the previous dib - if FDib <> nil then - FreeImage_Unload(dib); - - // load the file - FDib := FreeImage_Load(fif, PAnsiChar(FileName), Flag); - - Change; - Result := IsValid; - end else - Result := False; -end; - -function TFreeBitmap.LoadFromHandle(IO: PFreeImageIO; Handle: fi_handle; - Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - // check the file signature and get its format - fif := FreeImage_GetFileTypeFromHandle(IO, Handle, 16); - if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(fif) then - begin - // free the previous dib - if FDib <> nil then - FreeImage_Unload(FDib); - - // load the file - FDib := FreeImage_LoadFromHandle(fif, IO, Handle, Flag); - - Change; - Result := IsValid; - end else - Result := False; -end; - -function TFreeBitmap.LoadFromMemory(MemIO: TFreeMemoryIO; - Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - - // check the file signature and get its format - fif := MemIO.GetFileType; - if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(fif) then - begin - // free the previous dib - if FDib <> nil then - FreeImage_Unload(FDib); - - // load the file - FDib := MemIO.Read(fif, Flag); - - Result := IsValid; - Change; - end else - Result := False; -end; - -function TFreeBitmap.LoadFromStream(Stream: TStream; - Flag: Integer): Boolean; -var - MemIO: TFreeMemoryIO; - Data: PByte; - MemStream: TMemoryStream; - Size: Cardinal; -begin - Size := Stream.Size; - - MemStream := TMemoryStream.Create; - try - MemStream.CopyFrom(Stream, Size); - Data := MemStream.Memory; - - MemIO := TFreeMemoryIO.Create(Data, Size); - try - Result := LoadFromMemory(MemIO); - finally - MemIO.Free; - end; - finally - MemStream.Free; - end; -end; - -function TFreeBitmap.LoadU(const FileName: {$IFDEF DELPHI2010}string{$ELSE}WideString{$ENDIF}; - Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - - // check the file signature and get its format - fif := FreeImage_GetFileTypeU(PWideChar(Filename), 0); - if fif = FIF_UNKNOWN then - // no signature? - // try to guess the file format from the file extention - fif := FreeImage_GetFIFFromFilenameU(PWideChar(FileName)); - - // check that the plugin has reading capabilities ... - if (fif <> FIF_UNKNOWN) and FreeImage_FIFSupportsReading(FIF) then - begin - // free the previous dib - if FDib <> nil then - FreeImage_Unload(dib); - - // load the file - FDib := FreeImage_LoadU(fif, PWideChar(FileName), Flag); - - Change; - Result := IsValid; - end else - Result := False; -end; - -procedure TFreeBitmap.MakeThumbnail(const Width, Height: Integer; - DestBitmap: TFreeBitmap); -type - PRGB24 = ^TRGB24; - TRGB24 = packed record - B: Byte; - G: Byte; - R: Byte; - end; -var - x, y, ix, iy: integer; - x1, x2, x3: integer; - - xscale, yscale: single; - iRed, iGrn, iBlu, iRatio: Longword; - p, c1, c2, c3, c4, c5: TRGB24; - pt, pt1: PRGB24; - iSrc, iDst, s1: integer; - i, j, r, g, b, tmpY: integer; - - RowDest, RowSource, RowSourceStart: integer; - w, h: Integer; - dxmin, dymin: integer; - ny1, ny2, ny3: integer; - dx, dy: integer; - lutX, lutY: array of integer; - - SrcBmp, DestBmp: PFIBITMAP; -begin - if not IsValid then Exit; - - if (GetWidth <= ThumbSize) and (GetHeight <= ThumbSize) then - begin - DestBitmap.Assign(Self); - Exit; - end; - - w := Width; - h := Height; - - // prepare bitmaps - if GetBitsPerPixel <> 24 then - SrcBmp := FreeImage_ConvertTo24Bits(FDib) - else - SrcBmp := FDib; - DestBmp := FreeImage_Allocate(w, h, 24); - Assert(DestBmp <> nil, 'TFreeBitmap.MakeThumbnail error'); - -{ iDst := (w * 24 + 31) and not 31; - iDst := iDst div 8; //BytesPerScanline - iSrc := (GetWidth * 24 + 31) and not 31; - iSrc := iSrc div 8; -} - // BytesPerScanline - iDst := FreeImage_GetPitch(DestBmp); - iSrc := FreeImage_GetPitch(SrcBmp); - - xscale := 1 / (w / FreeImage_GetWidth(SrcBmp)); - yscale := 1 / (h / FreeImage_GetHeight(SrcBmp)); - - // X lookup table - SetLength(lutX, w); - x1 := 0; - x2 := trunc(xscale); - for x := 0 to w - 1 do - begin - lutX[x] := x2 - x1; - x1 := x2; - x2 := trunc((x + 2) * xscale); - end; - - // Y lookup table - SetLength(lutY, h); - x1 := 0; - x2 := trunc(yscale); - for x := 0 to h - 1 do - begin - lutY[x] := x2 - x1; - x1 := x2; - x2 := trunc((x + 2) * yscale); - end; - - Dec(w); - Dec(h); - RowDest := integer(FreeImage_GetScanLine(DestBmp, 0)); - RowSourceStart := integer(FreeImage_GetScanLine(SrcBmp, 0)); - RowSource := RowSourceStart; - - for y := 0 to h do - // resampling - begin - dy := lutY[y]; - x1 := 0; - x3 := 0; - for x := 0 to w do // loop through row - begin - dx:= lutX[x]; - iRed:= 0; - iGrn:= 0; - iBlu:= 0; - RowSource := RowSourceStart; - for iy := 1 to dy do - begin - pt := PRGB24(RowSource + x1); - for ix := 1 to dx do - begin - iRed := iRed + pt.R; - iGrn := iGrn + pt.G; - iBlu := iBlu + pt.B; - inc(pt); - end; - RowSource := RowSource + iSrc; - end; - iRatio := 65535 div (dx * dy); - pt1 := PRGB24(RowDest + x3); - pt1.R := (iRed * iRatio) shr 16; - pt1.G := (iGrn * iRatio) shr 16; - pt1.B := (iBlu * iRatio) shr 16; - x1 := x1 + 3 * dx; - inc(x3,3); - end; - RowDest := RowDest + iDst; - RowSourceStart := RowSource; - end; // resampling - - if FreeImage_GetHeight(DestBmp) >= 3 then - // Sharpening... - begin - s1 := integer(FreeImage_GetScanLine(DestBmp, 0)); - iDst := integer(FreeImage_GetScanLine(DestBmp, 1)) - s1; - ny1 := Integer(s1); - ny2 := ny1 + iDst; - ny3 := ny2 + iDst; - for y := 1 to FreeImage_GetHeight(DestBmp) - 2 do - begin - for x := 0 to FreeImage_GetWidth(DestBmp) - 3 do - begin - x1 := x * 3; - x2 := x1 + 3; - x3 := x1 + 6; - - c1 := pRGB24(ny1 + x1)^; - c2 := pRGB24(ny1 + x3)^; - c3 := pRGB24(ny2 + x2)^; - c4 := pRGB24(ny3 + x1)^; - c5 := pRGB24(ny3 + x3)^; - - r := (c1.R + c2.R + (c3.R * -12) + c4.R + c5.R) div -8; - g := (c1.G + c2.G + (c3.G * -12) + c4.G + c5.G) div -8; - b := (c1.B + c2.B + (c3.B * -12) + c4.B + c5.B) div -8; - - if r < 0 then r := 0 else if r > 255 then r := 255; - if g < 0 then g := 0 else if g > 255 then g := 255; - if b < 0 then b := 0 else if b > 255 then b := 255; - - pt1 := pRGB24(ny2 + x2); - pt1.R := r; - pt1.G := g; - pt1.B := b; - end; - inc(ny1, iDst); - inc(ny2, iDst); - inc(ny3, iDst); - end; - end; // sharpening - - if SrcBmp <> FDib then - FreeImage_Unload(SrcBmp); - DestBitmap.Replace(DestBmp); -end; - -function TFreeBitmap.PasteSubImage(Src: TFreeBitmap; Left, Top, - Alpha: Integer): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_Paste(FDib, Src.Dib, Left, Top, Alpha); - Change; - end else - Result := False; -end; - -function TFreeBitmap.Replace(NewDib: PFIBITMAP): Boolean; -begin - Result := False; - if NewDib = nil then Exit; - - if not DoChanging(FDib, NewDib) and IsValid then - FreeImage_Unload(FDib); - - FDib := NewDib; - Result := True; - Change; -end; - -function TFreeBitmap.Rescale(NewWidth, NewHeight: Integer; - Filter: FREE_IMAGE_FILTER; Dest: TFreeBitmap): Boolean; -var - Bpp: Integer; - DstDib: PFIBITMAP; -begin - Result := False; - - if FDib <> nil then - begin - Bpp := FreeImage_GetBPP(FDib); - - if Bpp < 8 then - if not ConvertToGrayscale then Exit - else - if Bpp = 16 then - // convert to 24-bit - if not ConvertTo24Bits then Exit; - - // perform upsampling / downsampling - DstDib := FreeImage_Rescale(FDib, NewWidth, NewHeight, Filter); - if Dest = nil then - Result := Replace(DstDib) - else - Result := Dest.Replace(DstDib) - end -end; - -function TFreeBitmap.Rotate(Angle: Double): Boolean; -var - Bpp: Integer; - Rotated: PFIBITMAP; -begin - Result := False; - if IsValid then - begin - Bpp := FreeImage_GetBPP(FDib); - if Bpp in [1, 8, 24, 32] then - begin - Rotated := FreeImage_RotateClassic(FDib, Angle); - Result := Replace(Rotated); - end - end; -end; - -function TFreeBitmap.RotateEx(Angle, XShift, YShift, XOrigin, - YOrigin: Double; UseMask: Boolean): Boolean; -var - Rotated: PFIBITMAP; -begin - Result := False; - if FDib <> nil then - begin - if FreeImage_GetBPP(FDib) >= 8 then - begin - Rotated := FreeImage_RotateEx(FDib, Angle, XShift, YShift, XOrigin, YOrigin, UseMask); - Result := Replace(Rotated); - end - end; -end; - -function TFreeBitmap.Save(const FileName: AnsiString; Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := False; - - // try to guess the file format from the file extension - fif := FreeImage_GetFIFFromFilename(PAnsiChar(Filename)); - if CanSave(fif) then - Result := FreeImage_Save(fif, FDib, PAnsiChar(FileName), Flag); -end; - -function TFreeBitmap.SaveToHandle(fif: FREE_IMAGE_FORMAT; IO: PFreeImageIO; - Handle: fi_handle; Flag: Integer): Boolean; -begin - Result := False; - if CanSave(fif) then - Result := FreeImage_SaveToHandle(fif, FDib, IO, Handle, Flag) -end; - -function TFreeBitmap.SaveToMemory(fif: FREE_IMAGE_FORMAT; - MemIO: TFreeMemoryIO; Flag: Integer): Boolean; -begin - Result := False; - - if CanSave(fif) then - Result := MemIO.Write(fif, FDib, Flag) -end; - -function TFreeBitmap.SaveToStream(fif: FREE_IMAGE_FORMAT; Stream: TStream; - Flag: Integer): Boolean; -var - MemIO: TFreeMemoryIO; - Data: PByte; - Size: Cardinal; -begin - MemIO := TFreeMemoryIO.Create; - try - Result := SaveToMemory(fif, MemIO, Flag); - if Result then - begin - MemIO.Acquire(Data, Size); - Stream.WriteBuffer(Data^, Size); - end; - finally - MemIO.Free; - end; -end; - -function TFreeBitmap.SaveU(const FileName: {$IFDEF DELPHI2010}string{$ELSE}WideString{$ENDIF}; - Flag: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := False; - - // try to guess the file format from the file extension - fif := FreeImage_GetFIFFromFilenameU(PWideChar(Filename)); - if CanSave(fif) then - Result := FreeImage_SaveU(fif, FDib, PWideChar(FileName), Flag); -end; - -function TFreeBitmap.SetChannel(Bitmap: TFreeBitmap; - Channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; -begin - if FDib <> nil then - begin - Result := FreeImage_SetChannel(FDib, Bitmap.FDib, Channel); - Change; - end - else - Result := False -end; - -procedure TFreeBitmap.SetDib(Value: PFIBITMAP); -begin - Replace(Value); -end; - -function TFreeBitmap.SetFileBkColor(BkColor: PRGBQuad): Boolean; -begin - Result := FreeImage_SetBackgroundColor(FDib, BkColor); - Change; -end; - -procedure TFreeBitmap.SetHorizontalResolution(Value: Double); -begin - if IsValid then - begin - FreeImage_SetDotsPerMeterX(FDib, Trunc(Value * 100 + 0.5)); - Change; - end; -end; - -function TFreeBitmap.SetMetadata(Model: FREE_IMAGE_MDMODEL; - const Key: AnsiString; Tag: TFreeTag): Boolean; -begin - Result := FreeImage_SetMetadata(Model, FDib, PAnsiChar(Key), Tag.Tag); -end; - -function TFreeBitmap.SetPixelColor(X, Y: Cardinal; - var Value: RGBQUAD): Boolean; -begin - Result := FreeImage_SetPixelColor(FDib, X, Y, Value); - Change; -end; - -function TFreeBitmap.SetPixelIndex(X, Y: Cardinal; var Value: Byte): Boolean; -begin - Result := FreeImage_SetPixelIndex(FDib, X, Y, Value); - Change; -end; - -function TFreeBitmap.SetSize(ImageType: FREE_IMAGE_TYPE; Width, Height, - Bpp: Integer; RedMask, GreenMask, BlueMask: Cardinal): Boolean; -var - Pal: PRGBQuad; - I: Cardinal; -begin - Result := False; - - if FDib <> nil then - FreeImage_Unload(FDib); - - FDib := FreeImage_Allocate(Width, Height, Bpp, RedMask, GreenMask, BlueMask); - if FDib = nil then Exit; - - if ImageType = FIT_BITMAP then - case Bpp of - 1, 4, 8: - begin - Pal := FreeImage_GetPalette(FDib); - for I := 0 to FreeImage_GetColorsUsed(FDib) - 1 do - begin - Pal.rgbBlue := I; - Pal.rgbGreen := I; - Pal.rgbRed := I; - Inc(Pal, SizeOf(RGBQUAD)); - end; - end; - end; - - Result := True; - Change; -end; - -procedure TFreeBitmap.SetTransparencyTable(Table: PByte; Count: Integer); -begin - FreeImage_SetTransparencyTable(FDib, Table, Count); - Change; -end; - -procedure TFreeBitmap.SetVerticalResolution(Value: Double); -begin - if IsValid then - begin - FreeImage_SetDotsPerMeterY(FDib, Trunc(Value * 100 + 0.5)); - Change; - end; -end; - -function TFreeBitmap.SplitChannels(RedChannel, GreenChannel, - BlueChannel: TFreeBitmap): Boolean; -begin - if FDib <> nil then - begin - RedChannel.FDib := FreeImage_GetChannel(FDib, FICC_RED); - GreenChannel.FDib := FreeImage_GetChannel(FDib, FICC_GREEN); - BlueChannel.FDib := FreeImage_GetChannel(FDib, FICC_BLUE); - Result := RedChannel.IsValid and GreenChannel.IsValid and BlueChannel.IsValid; - end - else - Result := False -end; - -function TFreeBitmap.Threshold(T: Byte): Boolean; -var - dib1: PFIBITMAP; -begin - if FDib <> nil then - begin - dib1 := FreeImage_Threshold(FDib, T); - Result := Replace(dib1); - end - else - Result := False -end; - -function TFreeBitmap.ToneMapping(TMO: FREE_IMAGE_TMO; FirstParam, - SecondParam: Double): Boolean; -var - NewDib: PFIBITMAP; -begin - Result := False; - if not IsValid then Exit; - - NewDib := FreeImage_ToneMapping(Fdib, TMO, FirstParam, SecondParam); - Result := Replace(NewDib); -end; - -{ TFreeWinBitmap } - -function TFreeWinBitmap.CaptureWindow(ApplicationWindow, - SelectedWindow: HWND): Boolean; -var - XScreen, YScreen, XShift, YShift, Width, Height: Integer; - R: TRect; - dstDC, srcDC, memDC: HDC; - BM, oldBM: HBITMAP; -begin - Result := False; - - // get window size - GetWindowRect(SelectedWindow, R); - - // check if the window is out of screen or maximized - XShift := 0; - YShift := 0; - XScreen := GetSystemMetrics(SM_CXSCREEN); - YScreen := GetSystemMetrics(SM_CYSCREEN); - if R.Right > XScreen then - R.Right := XScreen; - if R.Bottom > YScreen then - R.Bottom := YScreen; - if R.Left < 0 then - begin - XShift := -R.Left; - R.Left := 0; - end; - if R.Top < 0 then - begin - YShift := -R.Top; - R.Top := 0; - end; - - Width := R.Right - R.Left; - Height := R.Bottom - R.Top; - - if (Width <= 0) or (Height <= 0) then Exit; - - // hide the application window - ShowWindow(ApplicationWindow, SW_HIDE); - - // bring the window at the top most level - SetWindowPos(SelectedWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE); - - // give enough time to refresh the window - Sleep(500); - - // prepare the DCs - dstDc := GetDC(0); - srcDC := GetWindowDC(SelectedWindow); //full window (GetDC(SelectedWindow) = clientarea) - memDC := CreateCompatibleDC(dstDC); - - // copy the screen to the bitmap - BM := CreateCompatibleBitmap(dstDC, Width, Height); - oldBM := HBITMAP(SelectObject(memDC, BM)); - BitBlt(memDC, 0, 0, Width, Height, srcDC, XShift, YShift, SRCCOPY); - - // redraw the application window - ShowWindow(ApplicationWindow, SW_SHOW); - - // restore the position - SetWindowPos(SelectedWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE); - SetWindowPos(ApplicationWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE or SWP_NOSIZE); - - // convert the HBITMAP to FIBITMAP - CopyFromBitmap(BM); - - // free objects - DeleteObject(SelectObject(memDC, oldBM)); - DeleteObject(memDC); - - if GetBitsPerPixel = 32 then ConvertTo24Bits; - - Result := True; -end; - -procedure TFreeWinBitmap.Clear; -begin - if FDeleteMe then FreeImage_Unload(FDisplayDib); - inherited; -end; - -function TFreeWinBitmap.CopyFromBitmap(HBmp: HBITMAP): Boolean; -var - bm: BITMAP; - DC: HDC; - Success: Integer; -begin - Result := False; - - if HBmp <> 0 then - begin - // get information about the bitmap - GetObject(HBmp, SizeOf(BITMAP), @bm); - - // create the image - SetSize(FIT_BITMAP, bm.bmWidth, bm.bmHeight, bm.bmBitsPixel); - - // create the device context for the bitmap - DC := GetDC(0); - - // copy the pixels - Success := GetDIBits(DC, // handle to DC - HBmp, // handle to Bitmap - 0, // first scan line - FreeImage_GetHeight(Dib), // number of scan lines to copy - FreeImage_GetBits(Dib), // array for bitmap bits - FreeImage_GetInfo(Dib)^, // bitmap data buffer - DIB_RGB_COLORS // RGB - ); - - ReleaseDC(0, DC); - - if Success = 0 then - raise Exception.Create('Error: GetDIBits failed') - else - Result := True; - end; -end; - -function TFreeWinBitmap.CopyFromHandle(HMem: THandle): Boolean; -var - Data: PByte; - bmih: PBitmapInfoHeader; - Palette: PRGBQuad; - Bits: PByte; - BitFields: array [0..2] of DWORD; - MaskSize: Longint; - image_type: FREE_IMAGE_TYPE; -begin - Result := False; - Palette := nil; - BitFields[0] := 0; BitFields[1] := 0; BitFields[2] := 0; - - // get a pointer to the bitmap - Data := GlobalLock(HMem); - - // get a pointer to the bitmap header - bmih := PBitmapInfoHeader(Data); - - // get a pointer to the palette - if bmih.biBitCount < 16 then - begin - Palette := PRGBQUAD(bmih); - Inc(PByte(Palette), SizeOf(BITMAPINFOHEADER)); - end; - - // get a pointer to the pixels - Bits := PByte(bmih); - Inc(Bits, SizeOf(BITMAPINFOHEADER) + SizeOF(RGBQUAD) * bmih.biClrUsed); - - if bmih.biCompression = BI_BITFIELDS then - begin - // take into account the color masks that specify the red, green and blue - // components (16- and 32-bit) - MaskSize := 3 * SizeOf(DWORD); - CopyMemory(@BitFields[0], Bits, MaskSize); - Inc(Bits, MaskSize); - end; - - if Data <> nil then - begin - image_type := FIT_BITMAP; - - case GetFreeImageMarker(bmih) of - FIT_UINT16..FIT_RGBAF: image_type := GetFreeImageMarker(bmih); - end; - - // allocate a new FIBITMAP - if not SetSize(image_type, bmih.biWidth, bmih.biHeight, bmih.biBitCount, - BitFields[2], BitFields[1], BitFields[0]) then - begin - GlobalUnlock(HMem); - Exit; - end; - - // copy the bitmap header - CopyMemory(FreeImage_GetInfoHeader(Dib), bmih, SizeOf(BITMAPINFOHEADER)); - - // copy the palette - CopyMemory(FreeImage_GetPalette(Dib), Palette, bmih.biClrUsed * SizeOf(RGBQUAD)); - - // copy the bitmap - CopyMemory(FreeImage_GetBits(Dib), Bits, FreeImage_GetPitch(Dib) * FreeImage_GetHeight(Dib)); - - GlobalUnlock(HMem); - end; -end; - -function TFreeWinBitmap.CopyToBitmapH: HBITMAP; -var DC : HDC; -begin - Result:=0; - if IsValid then - begin - DC:=GetDC(0); - Result:=CreateDIBitmap(DC, - FreeImage_GetInfoHeader(Dib)^, - CBM_INIT, - PAnsiChar(FreeImage_GetBits(Dib)), - FreeImage_GetInfo(Dib)^, - DIB_RGB_COLORS); - ReleaseDC(0,DC); - end; -end; - -function TFreeWinBitmap.CopyToClipBoard(NewOwner: HWND): Boolean; -var - HDib: THandle; -begin - Result := False; - HDib := CopyToHandle; - - if OpenClipboard(NewOwner) and EmptyClipboard then - begin - if SetClipboardData(CF_DIB, HDib) = 0 then - begin - MessageBox(NewOwner, 'Unable to set clipboard data', 'FreeImage', MB_ICONERROR); - CloseClipboard; - Exit; - end; - end; - CloseClipboard; - Result := True; -end; - -function TFreeWinBitmap.CopyToHandle: THandle; -var - DibSize: Longint; - ADib, pdib: PByte; - bmih: PBITMAPINFOHEADER; - Pal: PRGBQuad; - Bits: PByte; -begin - Result := 0; - if IsValid then - begin - // get equivalent DIB size - DibSize := SizeOf(BITMAPINFOHEADER); - Inc(DibSize, FreeImage_GetColorsUsed(Dib) * SizeOf(RGBQUAD)); - Inc(DibSize, FreeImage_GetPitch(Dib) * FreeImage_GetHeight(Dib)); - - // allocate a DIB - Result := GlobalAlloc(GHND, DibSize); - ADib := GlobalLock(Result); - - pdib := ADib; - - // copy the BITMAPINFOHEADER - bmih := FreeImage_GetInfoHeader(Dib); - CopyMemory(pdib, bmih, SizeOf(BITMAPINFOHEADER)); - Inc(pdib, SizeOf(BITMAPINFOHEADER)); - if FreeImage_GetImageType(Dib) <> FIT_BITMAP then - SetFreeImageMarker(bmih, FDib); - - // copy the palette - Pal := FreeImage_GetPalette(Dib); - CopyMemory(pdib, Pal, FreeImage_GetColorsUsed(Dib) * SizeOf(RGBQUAD)); - Inc(pdib, FreeImage_GetColorsUsed(Dib) * SizeOf(RGBQUAD)); - - // copy the bitmap - Bits := FreeImage_GetBits(Dib); - CopyMemory(pdib, Bits, FreeImage_GetPitch(Dib) * FreeImage_GetHeight(Dib)); - - GlobalUnlock(Result); - end; -end; - -constructor TFreeWinBitmap.Create(ImageType: FREE_IMAGE_TYPE; Width, - Height, Bpp: Integer); -begin - inherited Create(ImageType, Width, Height, Bpp); - - FDisplayDib := nil; - FDeleteMe := False; -end; - -destructor TFreeWinBitmap.Destroy; -begin - if FDeleteMe then - FreeImage_Unload(FDisplayDib); - inherited; -end; - -procedure TFreeWinBitmap.Draw(DC: HDC; Rect: TRect); -begin - DrawEx(DC, Rect); -end; - -procedure TFreeWinBitmap.DrawEx(DC: HDC; Rect: TRect; UseFileBkg: Boolean; - AppBkColor: PRGBQuad; Bg: PFIBITMAP); -var - ImageType: FREE_IMAGE_TYPE; - HasBackground, Transparent: Boolean; - DibDouble: PFIBITMAP; -begin - if not IsValid then Exit; - - // convert to standard bitmap if needed - if FDeleteMe then - begin - FreeImage_Unload(FDisplayDib); - FDisplayDib := nil; - FDeleteMe := False; - end; - - ImageType := FreeImage_GetImageType(FDib); - if ImageType = FIT_BITMAP then - begin - HasBackground := FreeImage_HasBackgroundColor(Dib); - Transparent := FreeImage_IsTransparent(Dib); - - if not Transparent and not HasBackground then - // copy pointer - FDisplayDib := Dib - else - begin - // create the transparent / alpha blended image - FDisplayDib := FreeImage_Composite(Dib, UseFileBkg, AppBkColor, Bg); - // remember to delete FDisplayDib - FDeleteMe := True; - end - end - else - begin - // convert to standard dib for display - if ImageType <> FIT_COMPLEX then - FDisplayDib := FreeImage_ConvertToStandardType(Dib, True) - else - begin - // convert to type FIT_DOUBLE - DibDouble := FreeImage_GetComplexChannel(Dib, FICC_MAG); - FDisplayDib := FreeImage_ConvertToStandardType(DibDouble, True); - // free image of type FIT_DOUBLE - FreeImage_Unload(DibDouble); - end; - // remember to delete FDisplayDib - FDeleteMe := True; - end; - - // Draw the DIB - SetStretchBltMode(DC, COLORONCOLOR); - StretchDIBits(DC, Rect.Left, Rect.Top, - Rect.Right - Rect.Left, Rect.Bottom - Rect.Top, - 0, 0, FreeImage_GetWidth(FDisplayDib), FreeImage_GetHeight(FDisplayDib), - FreeImage_GetBits(FDisplayDib), FreeImage_GetInfo(FDisplayDib)^, DIB_RGB_COLORS, SRCCOPY); -end; - -function TFreeWinBitmap.PasteFromClipBoard: Boolean; -var - HDib: THandle; -begin - Result := False; - if not IsClipboardFormatAvailable(CF_DIB) then Exit; - - if OpenClipboard(0) then - begin - HDib := GetClipboardData(CF_DIB); - CopyFromHandle(HDib); - Result := True; - end; - CloseClipboard; -end; - -{ TFreeMultiBitmap } - -procedure TFreeMultiBitmap.AppendPage(Bitmap: TFreeBitmap); -begin - if IsValid then - FreeImage_AppendPage(FMPage, Bitmap.FDib); -end; - -function TFreeMultiBitmap.Close(Flags: Integer): Boolean; -begin - Result := FreeImage_CloseMultiBitmap(FMPage, Flags); - FMPage := nil; -end; - -constructor TFreeMultiBitmap.Create(KeepCacheInMemory: Boolean); -begin - inherited Create; - FMemoryCache := KeepCacheInMemory; -end; - -procedure TFreeMultiBitmap.DeletePage(Page: Integer); -begin - if IsValid then - FreeImage_DeletePage(FMPage, Page); -end; - -destructor TFreeMultiBitmap.Destroy; -begin - if FMPage <> nil then Close; - inherited; -end; - -function TFreeMultiBitmap.GetLockedPageNumbers(var Pages, - Count: Integer): Boolean; -begin - Result := False; - if not IsValid then Exit; - Result := FreeImage_GetLockedPageNumbers(FMPage, Pages, Count) -end; - -function TFreeMultiBitmap.GetPageCount: Integer; -begin - Result := 0; - if IsValid then - Result := FreeImage_GetPageCount(FMPage) -end; - -procedure TFreeMultiBitmap.InsertPage(Page: Integer; Bitmap: TFreeBitmap); -begin - if IsValid then - FreeImage_InsertPage(FMPage, Page, Bitmap.FDib); -end; - -function TFreeMultiBitmap.IsValid: Boolean; -begin - Result := FMPage <> nil -end; - -procedure TFreeMultiBitmap.LockPage(Page: Integer; DestBitmap: TFreeBitmap); -begin - if not IsValid then Exit; - - if Assigned(DestBitmap) then - begin - DestBitmap.Replace(FreeImage_LockPage(FMPage, Page)); - end; -end; - -function TFreeMultiBitmap.MovePage(Target, Source: Integer): Boolean; -begin - Result := False; - if not IsValid then Exit; - Result := FreeImage_MovePage(FMPage, Target, Source); -end; - -function TFreeMultiBitmap.Open(const FileName: AnsiString; CreateNew, - ReadOnly: Boolean; Flags: Integer): Boolean; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := False; - - // try to guess the file format from the filename - fif := FreeImage_GetFIFFromFilename(PAnsiChar(FileName)); - - // check for supported file types - if (fif <> FIF_UNKNOWN) and (not fif in [FIF_TIFF, FIF_ICO, FIF_GIF]) then - Exit; - - // open the stream - FMPage := FreeImage_OpenMultiBitmap(fif, PAnsiChar(FileName), CreateNew, ReadOnly, FMemoryCache, Flags); - - Result := FMPage <> nil; -end; - -procedure TFreeMultiBitmap.UnlockPage(Bitmap: TFreeBitmap; - Changed: Boolean); -begin - if IsValid then - begin - FreeImage_UnlockPage(FMPage, Bitmap.FDib, Changed); - // clear the image so that it becomes invalid. - // don't use Bitmap.Clear method because it calls FreeImage_Unload - // just clear the pointer - Bitmap.FDib := nil; - Bitmap.Change; - end; -end; - -{ TFreeMemoryIO } - -function TFreeMemoryIO.Acquire(var Data: PByte; - var SizeInBytes: DWORD): Boolean; -begin - Result := FreeImage_AcquireMemory(FHMem, Data, SizeInBytes); -end; - -constructor TFreeMemoryIO.Create(Data: PByte; SizeInBytes: DWORD); -begin - inherited Create; - FHMem := FreeImage_OpenMemory(Data, SizeInBytes); -end; - -destructor TFreeMemoryIO.Destroy; -begin - FreeImage_CloseMemory(FHMem); - inherited; -end; - -function TFreeMemoryIO.GetFileType: FREE_IMAGE_FORMAT; -begin - Result := FreeImage_GetFileTypeFromMemory(FHMem); -end; - -function TFreeMemoryIO.IsValid: Boolean; -begin - Result := FHMem <> nil -end; - -function TFreeMemoryIO.Read(fif: FREE_IMAGE_FORMAT; - Flag: Integer): PFIBITMAP; -begin - Result := FreeImage_LoadFromMemory(fif, FHMem, Flag) -end; - -function TFreeMemoryIO.Seek(Offset: Longint; Origin: Word): Boolean; -begin - Result := FreeImage_SeekMemory(FHMem, Offset, Origin) -end; - -function TFreeMemoryIO.Tell: Longint; -begin - Result := FreeImage_TellMemory(FHMem) -end; - -function TFreeMemoryIO.Write(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; - Flag: Integer): Boolean; -begin - Result := FreeImage_SaveToMemory(fif, dib, FHMem, Flag) -end; - -{ TFreeTag } - -function TFreeTag.Clone: TFreeTag; -var - CloneTag: PFITAG; -begin - Result := nil; - if not IsValid then Exit; - - CloneTag := FreeImage_CloneTag(FTag); - Result := TFreeTag.Create(CloneTag); -end; - -constructor TFreeTag.Create(ATag: PFITAG); -begin - inherited Create; - - if ATag <> nil then - FTag := ATag - else - FTag := FreeImage_CreateTag; -end; - -destructor TFreeTag.Destroy; -begin - if IsValid then - FreeImage_DeleteTag(FTag); - - inherited; -end; - -function TFreeTag.GetCount: Cardinal; -begin - Result := 0; - if not IsValid then Exit; - - Result := FreeImage_GetTagCount(FTag); -end; - -function TFreeTag.GetDescription: AnsiString; -begin - Result := ''; - if not IsValid then Exit; - - Result := FreeImage_GetTagDescription(FTag); -end; - -function TFreeTag.GetID: Word; -begin - Result := 0; - if not IsValid then Exit; - - Result := FreeImage_GetTagID(FTag); -end; - -function TFreeTag.GetKey: AnsiString; -begin - Result := ''; - if not IsValid then Exit; - - Result := FreeImage_GetTagKey(FTag); -end; - -function TFreeTag.GetLength: Cardinal; -begin - Result := 0; - if not IsValid then Exit; - - Result := FreeImage_GetTagLength(FTag); -end; - -function TFreeTag.GetTagType: FREE_IMAGE_MDTYPE; -begin - Result := FIDT_NOTYPE; - if not IsValid then Exit; - - Result := FreeImage_GetTagType(FTag); -end; - -function TFreeTag.GetValue: Pointer; -begin - Result := nil; - if not IsValid then Exit; - - Result := FreeImage_GetTagValue(FTag); -end; - -function TFreeTag.IsValid: Boolean; -begin - Result := FTag <> nil; -end; - -procedure TFreeTag.SetCount(const Value: Cardinal); -begin - if IsValid then - FreeImage_SetTagCount(FTag, Value); -end; - -procedure TFreeTag.SetDescription(const Value: AnsiString); -begin - if IsValid then - FreeImage_SetTagDescription(FTag, PAnsiChar(Value)); -end; - -procedure TFreeTag.SetID(const Value: Word); -begin - if IsValid then - FreeImage_SetTagID(FTag, Value); -end; - -procedure TFreeTag.SetKey(const Value: AnsiString); -begin - if IsValid then - FreeImage_SetTagKey(FTag, PAnsiChar(Value)); -end; - -procedure TFreeTag.SetLength(const Value: Cardinal); -begin - if IsValid then - FreeImage_SetTagLength(FTag, Value); -end; - -procedure TFreeTag.SetTagType(const Value: FREE_IMAGE_MDTYPE); -begin - if IsValid then - FreeImage_SetTagType(FTag, Value); -end; - -procedure TFreeTag.SetValue(const Value: Pointer); -begin - if IsValid then - FreeImage_SetTagValue(FTag, Value); -end; - -function TFreeTag.ToString(Model: FREE_IMAGE_MDMODEL; Make: PAnsiChar): AnsiString; -begin - Result := FreeImage_TagToString(Model, FTag, Make); -end; - -end. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/src/FreeImage.pas b/DSTexCompress/FreeImage/Wrapper/Delphi/src/FreeImage.pas deleted file mode 100644 index ff38703..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/src/FreeImage.pas +++ /dev/null @@ -1,1398 +0,0 @@ -unit FreeImage; - -// ========================================================== -// Delphi wrapper for FreeImage 3 -// -// Design and implementation by -// - Simon Beavis -// - Peter Bystrm -// - Anatoliy Pulyaevskiy (xvel84@rambler.ru) -// -// Contributors: -// - Lorenzo Monti (LM) lomo74@gmail.com -// -// Revision history -// When Who What -// ----------- ----- ----------------------------------------------------------- -// 2010-07-14 LM Fixed some C->Delphi translation errors, -// updated to 3.13.1, made RAD2010 compliant (unicode) -// 2010-07-29 LM Added Free Pascal / Lazarus 32 bit support -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -interface - -{$MINENUMSIZE 4} // Make sure enums are stored as an integer to be compatible with C/C++ - -{$I 'Version.inc'} - -{$IFDEF MSWINDOWS} -uses Windows; -{$ELSE} -type - LONG = LongInt; - DWORD = Cardinal; - - BITMAPINFOHEADER = record - biSize : DWORD; - biWidth : LONG; - biHeight : LONG; - biPlanes : WORD; - biBitCount : WORD; - biCompression : DWORD; - biSizeImage : DWORD; - biXPelsPerMeter : LONG; - biYPelsPerMeter : LONG; - biClrUsed : DWORD; - biClrImportant : DWORD; - end; - LPBITMAPINFOHEADER = ^BITMAPINFOHEADER; - TBITMAPINFOHEADER = BITMAPINFOHEADER; - PBITMAPINFOHEADER = ^BITMAPINFOHEADER; - - RGBQUAD = record - rgbBlue : BYTE; - rgbGreen : BYTE; - rgbRed : BYTE; - rgbReserved : BYTE; - end; - tagRGBQUAD = RGBQUAD; - TRGBQUAD = RGBQUAD; - PRGBQUAD = ^RGBQUAD; - - BITMAPINFO = record - bmiHeader : BITMAPINFOHEADER; - bmiColors : array[0..0] of RGBQUAD; - end; - LPBITMAPINFO = ^BITMAPINFO; - PBITMAPINFO = ^BITMAPINFO; - TBITMAPINFO = BITMAPINFO; -{$ENDIF} - -const - FIDLL = {$IFDEF MSWINDOWS}'FreeImage.dll';{$ENDIF} - {$IFDEF LINUX}'libfreeimage.so';{$ENDIF} - -const - // Version information - FREEIMAGE_MAJOR_VERSION = 3; - FREEIMAGE_MINOR_VERSION = 13; - FREEIMAGE_RELEASE_SERIAL = 1; - // This really only affects 24 and 32 bit formats, the rest are always RGB order. - FREEIMAGE_COLORORDER_BGR = 0; - FREEIMAGE_COLORORDER_RGB = 1; - FREEIMAGE_COLORORDER = FREEIMAGE_COLORORDER_BGR; - -// -------------------------------------------------------------------------- -// Bitmap types ------------------------------------------------------------- -// -------------------------------------------------------------------------- - -type - FIBITMAP = record - data: Pointer; - end; - PFIBITMAP = ^FIBITMAP; - - FIMULTIBITMAP = record - data: Pointer; - end; - PFIMULTIBITMAP = ^FIMULTIBITMAP; - -// -------------------------------------------------------------------------- -// Types used in the library (specific to FreeImage) ------------------------ -// -------------------------------------------------------------------------- - -type - {* 48-bit RGB } - tagFIRGB16 = packed record - red: WORD; - green: WORD; - blue: WORD; - end; - FIRGB16 = tagFIRGB16; - - {* 64-bit RGBA } - tagFIRGBA16 = packed record - red: WORD; - green: WORD; - blue: WORD; - alpha: WORD; - end; - FIRGBA16 = tagFIRGBA16; - - {* 96-bit RGB Float } - tagFIRGBF = packed record - red: Single; - green: Single; - blue: Single; - end; - FIRGBF = tagFIRGBF; - - {* 128-bit RGBA Float } - tagFIRGBAF = packed record - red: Single; - green: Single; - blue: Single; - alpha: Single; - end; - FIRGBAF = tagFIRGBAF; - - {* Data structure for COMPLEX type (complex number) } - tagFICOMPLEX = packed record - /// real part - r: Double; - /// imaginary part - i: Double; - end; - FICOMPLEX = tagFICOMPLEX; - -// -------------------------------------------------------------------------- -// Indexes for byte arrays, masks and shifts for treating pixels as words --- -// These coincide with the order of RGBQUAD and RGBTRIPLE ------------------- -// Little Endian (x86 / MS Windows, Linux) : BGR(A) order ------------------- -// -------------------------------------------------------------------------- - -const - FI_RGBA_RED = 2; - FI_RGBA_GREEN = 1; - FI_RGBA_BLUE = 0; - FI_RGBA_ALPHA = 3; - FI_RGBA_RED_MASK = $00FF0000; - FI_RGBA_GREEN_MASK = $0000FF00; - FI_RGBA_BLUE_MASK = $000000FF; - FI_RGBA_ALPHA_MASK = $FF000000; - FI_RGBA_RED_SHIFT = 16; - FI_RGBA_GREEN_SHIFT = 8; - FI_RGBA_BLUE_SHIFT = 0; - FI_RGBA_ALPHA_SHIFT = 24; - - FI_RGBA_RGB_MASK = FI_RGBA_RED_MASK or FI_RGBA_GREEN_MASK or FI_RGBA_BLUE_MASK; - -// -------------------------------------------------------------------------- -// The 16bit macros only include masks and shifts, -------------------------- -// since each color element is not byte aligned ----------------------------- -// -------------------------------------------------------------------------- - -const - FI16_555_RED_MASK = $7C00; - FI16_555_GREEN_MASK = $03E0; - FI16_555_BLUE_MASK = $001F; - FI16_555_RED_SHIFT = 10; - FI16_555_GREEN_SHIFT = 5; - FI16_555_BLUE_SHIFT = 0; - FI16_565_RED_MASK = $F800; - FI16_565_GREEN_MASK = $07E0; - FI16_565_BLUE_MASK = $001F; - FI16_565_RED_SHIFT = 11; - FI16_565_GREEN_SHIFT = 5; - FI16_565_BLUE_SHIFT = 0; - -// -------------------------------------------------------------------------- -// ICC profile support ------------------------------------------------------ -// -------------------------------------------------------------------------- - -const - FIICC_DEFAULT = $0; - FIICC_COLOR_IS_CMYK = $1; - -type - FIICCPROFILE = record - flags: WORD; // info flag - size: DWORD; // profile's size measured in bytes - data: Pointer; // points to a block of contiguous memory containing the profile - end; - PFIICCPROFILE = ^FIICCPROFILE; - -// -------------------------------------------------------------------------- -// Important enums ---------------------------------------------------------- -// -------------------------------------------------------------------------- - -type - FREE_IMAGE_FORMAT = type Integer; - FREE_IMAGE_TYPE = type Integer; - FREE_IMAGE_COLOR_TYPE = type Integer; - FREE_IMAGE_QUANTIZE = type Integer; - FREE_IMAGE_DITHER = type Integer; - FREE_IMAGE_FILTER = type Integer; - FREE_IMAGE_COLOR_CHANNEL = type Integer; - FREE_IMAGE_MDTYPE = type Integer; - FREE_IMAGE_MDMODEL = type Integer; - FREE_IMAGE_JPEG_OPERATION = type Integer; - FREE_IMAGE_TMO = type Integer; - -const - // I/O image format identifiers. - FIF_UNKNOWN = FREE_IMAGE_FORMAT(-1); - FIF_BMP = FREE_IMAGE_FORMAT(0); - FIF_ICO = FREE_IMAGE_FORMAT(1); - FIF_JPEG = FREE_IMAGE_FORMAT(2); - FIF_JNG = FREE_IMAGE_FORMAT(3); - FIF_KOALA = FREE_IMAGE_FORMAT(4); - FIF_LBM = FREE_IMAGE_FORMAT(5); - FIF_IFF = FIF_LBM; - FIF_MNG = FREE_IMAGE_FORMAT(6); - FIF_PBM = FREE_IMAGE_FORMAT(7); - FIF_PBMRAW = FREE_IMAGE_FORMAT(8); - FIF_PCD = FREE_IMAGE_FORMAT(9); - FIF_PCX = FREE_IMAGE_FORMAT(10); - FIF_PGM = FREE_IMAGE_FORMAT(11); - FIF_PGMRAW = FREE_IMAGE_FORMAT(12); - FIF_PNG = FREE_IMAGE_FORMAT(13); - FIF_PPM = FREE_IMAGE_FORMAT(14); - FIF_PPMRAW = FREE_IMAGE_FORMAT(15); - FIF_RAS = FREE_IMAGE_FORMAT(16); - FIF_TARGA = FREE_IMAGE_FORMAT(17); - FIF_TIFF = FREE_IMAGE_FORMAT(18); - FIF_WBMP = FREE_IMAGE_FORMAT(19); - FIF_PSD = FREE_IMAGE_FORMAT(20); - FIF_CUT = FREE_IMAGE_FORMAT(21); - FIF_XBM = FREE_IMAGE_FORMAT(22); - FIF_XPM = FREE_IMAGE_FORMAT(23); - FIF_DDS = FREE_IMAGE_FORMAT(24); - FIF_GIF = FREE_IMAGE_FORMAT(25); - FIF_HDR = FREE_IMAGE_FORMAT(26); - FIF_FAXG3 = FREE_IMAGE_FORMAT(27); - FIF_SGI = FREE_IMAGE_FORMAT(28); - FIF_EXR = FREE_IMAGE_FORMAT(29); - FIF_J2K = FREE_IMAGE_FORMAT(30); - FIF_JP2 = FREE_IMAGE_FORMAT(31); - FIF_PFM = FREE_IMAGE_FORMAT(32); - FIF_PICT = FREE_IMAGE_FORMAT(33); - FIF_RAW = FREE_IMAGE_FORMAT(34); - - // Image type used in FreeImage. - FIT_UNKNOWN = FREE_IMAGE_TYPE(0); // unknown type - FIT_BITMAP = FREE_IMAGE_TYPE(1); // standard image: 1-, 4-, 8-, 16-, 24-, 32-bit - FIT_UINT16 = FREE_IMAGE_TYPE(2); // array of unsigned short: unsigned 16-bit - FIT_INT16 = FREE_IMAGE_TYPE(3); // array of short: signed 16-bit - FIT_UINT32 = FREE_IMAGE_TYPE(4); // array of unsigned long: unsigned 32-bit - FIT_INT32 = FREE_IMAGE_TYPE(5); // array of long: signed 32-bit - FIT_FLOAT = FREE_IMAGE_TYPE(6); // array of float: 32-bit IEEE floating point - FIT_DOUBLE = FREE_IMAGE_TYPE(7); // array of double: 64-bit IEEE floating point - FIT_COMPLEX = FREE_IMAGE_TYPE(8); // array of FICOMPLEX: 2 x 64-bit IEEE floating point - FIT_RGB16 = FREE_IMAGE_TYPE(9); // 48-bit RGB image: 3 x 16-bit - FIT_RGBA16 = FREE_IMAGE_TYPE(10); // 64-bit RGBA image: 4 x 16-bit - FIT_RGBF = FREE_IMAGE_TYPE(11); // 96-bit RGB float image: 3 x 32-bit IEEE floating point - FIT_RGBAF = FREE_IMAGE_TYPE(12); // 128-bit RGBA float image: 4 x 32-bit IEEE floating point - - // Image color type used in FreeImage. - FIC_MINISWHITE = FREE_IMAGE_COLOR_TYPE(0); // min value is white - FIC_MINISBLACK = FREE_IMAGE_COLOR_TYPE(1); // min value is black - FIC_RGB = FREE_IMAGE_COLOR_TYPE(2); // RGB color model - FIC_PALETTE = FREE_IMAGE_COLOR_TYPE(3); // color map indexed - FIC_RGBALPHA = FREE_IMAGE_COLOR_TYPE(4); // RGB color model with alpha channel - FIC_CMYK = FREE_IMAGE_COLOR_TYPE(5); // CMYK color model - - // Color quantization algorithms. Constants used in FreeImage_ColorQuantize. - FIQ_WUQUANT = FREE_IMAGE_QUANTIZE(0); // Xiaolin Wu color quantization algorithm - FIQ_NNQUANT = FREE_IMAGE_QUANTIZE(1); // NeuQuant neural-net quantization algorithm by Anthony Dekker - - // Dithering algorithms. Constants used FreeImage_Dither. - FID_FS = FREE_IMAGE_DITHER(0); // Floyd & Steinberg error diffusion - FID_BAYER4x4 = FREE_IMAGE_DITHER(1); // Bayer ordered dispersed dot dithering (order 2 dithering matrix) - FID_BAYER8x8 = FREE_IMAGE_DITHER(2); // Bayer ordered dispersed dot dithering (order 3 dithering matrix) - FID_CLUSTER6x6 = FREE_IMAGE_DITHER(3); // Ordered clustered dot dithering (order 3 - 6x6 matrix) - FID_CLUSTER8x8 = FREE_IMAGE_DITHER(4); // Ordered clustered dot dithering (order 4 - 8x8 matrix) - FID_CLUSTER16x16 = FREE_IMAGE_DITHER(5); // Ordered clustered dot dithering (order 8 - 16x16 matrix) - FID_BAYER16x16 = FREE_IMAGE_DITHER(6); // Bayer ordered dispersed dot dithering (order 4 dithering matrix) - - // Lossless JPEG transformations Constants used in FreeImage_JPEGTransform - FIJPEG_OP_NONE = FREE_IMAGE_JPEG_OPERATION(0); // no transformation - FIJPEG_OP_FLIP_H = FREE_IMAGE_JPEG_OPERATION(1); // horizontal flip - FIJPEG_OP_FLIP_V = FREE_IMAGE_JPEG_OPERATION(2); // vertical flip - FIJPEG_OP_TRANSPOSE = FREE_IMAGE_JPEG_OPERATION(3); // transpose across UL-to-LR axis - FIJPEG_OP_TRANSVERSE = FREE_IMAGE_JPEG_OPERATION(4); // transpose across UR-to-LL axis - FIJPEG_OP_ROTATE_90 = FREE_IMAGE_JPEG_OPERATION(5); // 90-degree clockwise rotation - FIJPEG_OP_ROTATE_180 = FREE_IMAGE_JPEG_OPERATION(6); // 180-degree rotation - FIJPEG_OP_ROTATE_270 = FREE_IMAGE_JPEG_OPERATION(7); // 270-degree clockwise (or 90 ccw) - - // Tone mapping operators. Constants used in FreeImage_ToneMapping. - FITMO_DRAGO03 = FREE_IMAGE_TMO(0); // Adaptive logarithmic mapping (F. Drago, 2003) - FITMO_REINHARD05 = FREE_IMAGE_TMO(1); // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - FITMO_FATTAL02 = FREE_IMAGE_TMO(2); // Gradient domain high dynamic range compression (R. Fattal, 2002) - - // Upsampling / downsampling filters. Constants used in FreeImage_Rescale. - FILTER_BOX = FREE_IMAGE_FILTER(0); // Box, pulse, Fourier window, 1st order (constant) b-spline - FILTER_BICUBIC = FREE_IMAGE_FILTER(1); // Mitchell & Netravali's two-param cubic filter - FILTER_BILINEAR = FREE_IMAGE_FILTER(2); // Bilinear filter - FILTER_BSPLINE = FREE_IMAGE_FILTER(3); // 4th order (cubic) b-spline - FILTER_CATMULLROM = FREE_IMAGE_FILTER(4); // Catmull-Rom spline, Overhauser spline - FILTER_LANCZOS3 = FREE_IMAGE_FILTER(5); // Lanczos3 filter - - // Color channels. Constants used in color manipulation routines. - FICC_RGB = FREE_IMAGE_COLOR_CHANNEL(0); // Use red, green and blue channels - FICC_RED = FREE_IMAGE_COLOR_CHANNEL(1); // Use red channel - FICC_GREEN = FREE_IMAGE_COLOR_CHANNEL(2); // Use green channel - FICC_BLUE = FREE_IMAGE_COLOR_CHANNEL(3); // Use blue channel - FICC_ALPHA = FREE_IMAGE_COLOR_CHANNEL(4); // Use alpha channel - FICC_BLACK = FREE_IMAGE_COLOR_CHANNEL(5); // Use black channel - FICC_REAL = FREE_IMAGE_COLOR_CHANNEL(6); // Complex images: use real part - FICC_IMAG = FREE_IMAGE_COLOR_CHANNEL(7); // Complex images: use imaginary part - FICC_MAG = FREE_IMAGE_COLOR_CHANNEL(8); // Complex images: use magnitude - FICC_PHASE = FREE_IMAGE_COLOR_CHANNEL(9); // Complex images: use phase - - // Tag data type information (based on TIFF specifications) - FIDT_NOTYPE = FREE_IMAGE_MDTYPE(0); // placeholder - FIDT_BYTE = FREE_IMAGE_MDTYPE(1); // 8-bit unsigned integer - FIDT_ASCII = FREE_IMAGE_MDTYPE(2); // 8-bit bytes w/ last byte null - FIDT_SHORT = FREE_IMAGE_MDTYPE(3); // 16-bit unsigned integer - FIDT_LONG = FREE_IMAGE_MDTYPE(4); // 32-bit unsigned integer - FIDT_RATIONAL = FREE_IMAGE_MDTYPE(5); // 64-bit unsigned fraction - FIDT_SBYTE = FREE_IMAGE_MDTYPE(6); // 8-bit signed integer - FIDT_UNDEFINED = FREE_IMAGE_MDTYPE(7); // 8-bit untyped data - FIDT_SSHORT = FREE_IMAGE_MDTYPE(8); // 16-bit signed integer - FIDT_SLONG = FREE_IMAGE_MDTYPE(9); // 32-bit signed integer - FIDT_SRATIONAL = FREE_IMAGE_MDTYPE(10); // 64-bit signed fraction - FIDT_FLOAT = FREE_IMAGE_MDTYPE(11); // 32-bit IEEE floating point - FIDT_DOUBLE = FREE_IMAGE_MDTYPE(12); // 64-bit IEEE floating point - FIDT_IFD = FREE_IMAGE_MDTYPE(13); // 32-bit unsigned integer (offset) - FIDT_PALETTE = FREE_IMAGE_MDTYPE(14); // 32-bit RGBQUAD - - // Metadata models supported by FreeImage - FIMD_NODATA = FREE_IMAGE_MDMODEL(-1); - FIMD_COMMENTS = FREE_IMAGE_MDMODEL(0); // single comment or keywords - FIMD_EXIF_MAIN = FREE_IMAGE_MDMODEL(1); // Exif-TIFF metadata - FIMD_EXIF_EXIF = FREE_IMAGE_MDMODEL(2); // Exif-specific metadata - FIMD_EXIF_GPS = FREE_IMAGE_MDMODEL(3); // Exif GPS metadata - FIMD_EXIF_MAKERNOTE = FREE_IMAGE_MDMODEL(4); // Exif maker note metadata - FIMD_EXIF_INTEROP = FREE_IMAGE_MDMODEL(5); // Exif interoperability metadata - FIMD_IPTC = FREE_IMAGE_MDMODEL(6); // IPTC/NAA metadata - FIMD_XMP = FREE_IMAGE_MDMODEL(7); // Abobe XMP metadata - FIMD_GEOTIFF = FREE_IMAGE_MDMODEL(8); // GeoTIFF metadata (to be implemented) - FIMD_ANIMATION = FREE_IMAGE_MDMODEL(9); // Animation metadata - FIMD_CUSTOM = FREE_IMAGE_MDMODEL(10); // Used to attach other metadata types to a dib - -type - // Handle to a metadata model - FIMETADATA = record - data: Pointer; - end; - PFIMETADATA = ^FIMETADATA; - - // Handle to a metadata tag - FITAG = record - data: Pointer; - end; - PFITAG = ^FITAG; - -// -------------------------------------------------------------------------- -// File IO routines --------------------------------------------------------- -// -------------------------------------------------------------------------- - -type - fi_handle = Pointer; - - FI_ReadProc = function(buffer: Pointer; size, count: Cardinal; - handle: fi_handle): Cardinal; stdcall; - FI_WriteProc = function(buffer: Pointer; size, count: Cardinal; - handle: fi_handle): Cardinal; stdcall; - FI_SeekProc = function(handle: fi_handle; offset: LongInt; - origin: Integer): Integer; stdcall; - FI_TellProc = function(handle: fi_handle): LongInt; stdcall; - - FreeImageIO = packed record - read_proc : FI_ReadProc; // pointer to the function used to read data - write_proc: FI_WriteProc; // pointer to the function used to write data - seek_proc : FI_SeekProc; // pointer to the function used to seek - tell_proc : FI_TellProc; // pointer to the function used to aquire the current position - end; - PFreeImageIO = ^FreeImageIO; - - // Handle to a memory I/O stream - FIMEMORY = record - data: Pointer; - end; - PFIMEMORY = ^FIMEMORY; - -const - // constants used in FreeImage_Seek for Origin parameter - SEEK_SET = 0; - SEEK_CUR = 1; - SEEK_END = 2; - -// -------------------------------------------------------------------------- -// Plugin routines ---------------------------------------------------------- -// -------------------------------------------------------------------------- - -type - PPlugin = ^Plugin; - - FI_FormatProc = function: PAnsiChar; stdcall; - FI_DescriptionProc = function: PAnsiChar; stdcall; - FI_ExtensionListProc = function: PAnsiChar; stdcall; - FI_RegExprProc = function: PAnsiChar; stdcall; - FI_OpenProc = function(io: PFreeImageIO; handle: fi_handle; - read: Boolean): Pointer; stdcall; - FI_CloseProc = procedure(io: PFreeImageIO; handle: fi_handle; - data: Pointer); stdcall; - FI_PageCountProc = function(io: PFreeImageIO; handle: fi_handle; - data: Pointer): Integer; stdcall; - FI_PageCapabilityProc = function(io: PFreeImageIO; handle: fi_handle; - data: Pointer): Integer; stdcall; - FI_LoadProc = function(io: PFreeImageIO; handle: fi_handle; page, flags: Integer; - data: Pointer): PFIBITMAP; stdcall; - FI_SaveProc = function(io: PFreeImageIO; dib: PFIBITMAP; handle: fi_handle; - page, flags: Integer; data: Pointer): Boolean; stdcall; - FI_ValidateProc = function(io: PFreeImageIO; handle: fi_handle): Boolean; stdcall; - FI_MimeProc = function: PAnsiChar; stdcall; - FI_SupportsExportBPPProc = function(bpp: integer): Boolean; stdcall; - FI_SupportsExportTypeProc = function(atype: FREE_IMAGE_TYPE): Boolean; stdcall; - FI_SupportsICCProfilesProc = function: Boolean; stdcall; - - Plugin = record - format_proc: FI_FormatProc; - description_proc: FI_DescriptionProc; - extension_proc: FI_ExtensionListProc; - regexpr_proc: FI_RegExprProc; - open_proc: FI_OpenProc; - close_proc: FI_CloseProc; - pagecount_proc: FI_PageCountProc; - pagecapability_proc: FI_PageCapabilityProc; - load_proc: FI_LoadProc; - save_proc: FI_SaveProc; - validate_proc: FI_ValidateProc; - mime_proc: FI_MimeProc; - supports_export_bpp_proc: FI_SupportsExportBPPProc; - supports_export_type_proc: FI_SupportsExportTypeProc; - supports_icc_profiles_proc: FI_SupportsICCProfilesProc; - end; - - FI_InitProc = procedure(aplugin: PPlugin; format_id: Integer); stdcall; - -// -------------------------------------------------------------------------- -// Load/Save flag constants ------------------------------------------------- -// -------------------------------------------------------------------------- - -const - BMP_DEFAULT = 0; - BMP_SAVE_RLE = 1; - CUT_DEFAULT = 0; - DDS_DEFAULT = 0; - EXR_DEFAULT = 0; // save data as half with piz-based wavelet compression - EXR_FLOAT = $0001; // save data as float instead of as half (not recommended) - EXR_NONE = $0002; // save with no compression - EXR_ZIP = $0004; // save with zlib compression, in blocks of 16 scan lines - EXR_PIZ = $0008; // save with piz-based wavelet compression - EXR_PXR24 = $0010; // save with lossy 24-bit float compression - EXR_B44 = $0020; // save with lossy 44% float compression - goes to 22% when combined with EXR_LC - EXR_LC = $0040; // save images with one luminance and two chroma channels, rather than as RGB (lossy compression) - FAXG3_DEFAULT = 0; - GIF_DEFAULT = 0; - GIF_LOAD256 = 1; // Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color - GIF_PLAYBACK = 2; // 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading - HDR_DEFAULT = 0; - ICO_DEFAULT = 0; - ICO_MAKEALPHA = 1; // convert to 32bpp and create an alpha channel from the AND-mask when loading - IFF_DEFAULT = 0; - J2K_DEFAULT = 0; // save with a 16:1 rate - JP2_DEFAULT = 0; // save with a 16:1 rate - JPEG_DEFAULT = 0; - JPEG_FAST = 1; - JPEG_ACCURATE = 2; - JPEG_CMYK = $0004; // load separated CMYK "as is" (use | to combine with other flags) - JPEG_EXIFROTATE = $0008; // load and rotate according to Exif 'Orientation' tag if available - JPEG_QUALITYSUPERB = $0080; // save with superb quality (100:1) - JPEG_QUALITYGOOD = $0100; // save with good quality (75:1) - JPEG_QUALITYNORMAL = $0200; // save with normal quality (50:1) - JPEG_QUALITYAVERAGE = $0400; // save with average quality (25:1) - JPEG_QUALITYBAD = $0800; // save with bad quality (10:1) - JPEG_PROGRESSIVE = $2000; // save as a progressive-JPEG (use | to combine with other save flags) - JPEG_SUBSAMPLING_411 = $1000; // save with high 4x1 chroma subsampling (4:1:1) - JPEG_SUBSAMPLING_420 = $4000; // save with medium 2x2 medium chroma subsampling (4:2:0) - default value - JPEG_SUBSAMPLING_422 = $8000; // save with low 2x1 chroma subsampling (4:2:2) - JPEG_SUBSAMPLING_444 = $10000; // save with no chroma subsampling (4:4:4) - KOALA_DEFAULT = 0; - LBM_DEFAULT = 0; - MNG_DEFAULT = 0; - PCD_DEFAULT = 0; - PCD_BASE = 1; // load the bitmap sized 768 x 512 - PCD_BASEDIV4 = 2; // load the bitmap sized 384 x 256 - PCD_BASEDIV16 = 3; // load the bitmap sized 192 x 128 - PCX_DEFAULT = 0; - PFM_DEFAULT = 0; - PICT_DEFAULT = 0; - PNG_DEFAULT = 0; - PNG_IGNOREGAMMA = 1; // avoid gamma correction - PNG_Z_BEST_SPEED = $0001; // save using ZLib level 1 compression flag (default value is 6) - PNG_Z_DEFAULT_COMPRESSION = $0006; // save using ZLib level 6 compression flag (default recommended value) - PNG_Z_BEST_COMPRESSION = $0009; // save using ZLib level 9 compression flag (default value is 6) - PNG_Z_NO_COMPRESSION = $0100; // save without ZLib compression - PNG_INTERLACED = $0200; // save using Adam7 interlacing (use | to combine with other save flags) - PNM_DEFAULT = 0; - PNM_SAVE_RAW = 0; // If set the writer saves in RAW format (i.e. P4, P5 or P6) - PNM_SAVE_ASCII = 1; // If set the writer saves in ASCII format (i.e. P1, P2 or P3) - PSD_DEFAULT = 0; - RAS_DEFAULT = 0; - RAW_DEFAULT = 0; // load the file as linear RGB 48-bit - RAW_PREVIEW = 1; // try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit - RAW_DISPLAY = 2; // load the file as RGB 24-bit - SGI_DEFAULT = 0; - TARGA_DEFAULT = 0; - TARGA_LOAD_RGB888 = 1; // If set the loader converts RGB555 and ARGB8888 -> RGB888. - TIFF_DEFAULT = 0; - TIFF_CMYK = $0001; // reads/stores tags for separated CMYK (use | to combine with compression flags) - TIFF_PACKBITS = $0100; // save using PACKBITS compression - TIFF_DEFLATE = $0200; // save using DEFLATE compression - TIFF_ADOBE_DEFLATE = $0400; // save using ADOBE DEFLATE compression - TIFF_NONE = $0800; // save without any compression - TIFF_CCITTFAX3 = $1000; // save using CCITT Group 3 fax encoding - TIFF_CCITTFAX4 = $2000; // save using CCITT Group 4 fax encoding - TIFF_LZW = $4000; // save using LZW compression - TIFF_JPEG = $8000; // save using JPEG compression - WBMP_DEFAULT = 0; - XBM_DEFAULT = 0; - XPM_DEFAULT = 0; - -// -------------------------------------------------------------------------- -// Background filling options ----------------------------------------------- -// Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas -// -------------------------------------------------------------------------- - -const - FI_COLOR_IS_RGB_COLOR = $00; // RGBQUAD color is a RGB color (contains no valid alpha channel) - FI_COLOR_IS_RGBA_COLOR = $01; // RGBQUAD color is a RGBA color (contains a valid alpha channel) - FI_COLOR_FIND_EQUAL_COLOR = $02; // For palettized images: lookup equal RGB color from palette - FI_COLOR_ALPHA_IS_INDEX = $04; // The color's rgbReserved member (alpha) contains the palette index to be used - FI_COLOR_PALETTE_SEARCH_MASK = FI_COLOR_FIND_EQUAL_COLOR or FI_COLOR_ALPHA_IS_INDEX; // No color lookup is performed - -// -------------------------------------------------------------------------- -// Init/Error routines ------------------------------------------------------ -// -------------------------------------------------------------------------- - -procedure FreeImage_Initialise(load_local_plugins_only: Boolean = False); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Initialise@4'{$ENDIF}; -procedure FreeImage_DeInitialise; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_DeInitialise@0'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Version routines --------------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_GetVersion: PAnsiChar; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetVersion@0'{$ENDIF}; -function FreeImage_GetCopyrightMessage: PAnsiChar; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetCopyrightMessage@0'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Message output functions ------------------------------------------------- -// -------------------------------------------------------------------------- - -type - FreeImage_OutputMessageFunction = procedure(fif: FREE_IMAGE_FORMAT; - msg: PAnsiChar); cdecl; - FreeImage_OutputMessageFunctionStdCall = procedure(fif: FREE_IMAGE_FORMAT; - msg: PAnsiChar); stdcall; - -procedure FreeImage_SetOutputMessageStdCall(omf: FreeImage_OutputMessageFunctionStdCall); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetOutputMessageStdCall@4'{$ENDIF}; -procedure FreeImage_SetOutputMessage(omf: FreeImage_OutputMessageFunction); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetOutputMessage@4'{$ENDIF}; -{$IFDEF DELPHI6} -//this is declared stdcall in the C header but it is actually cdecl. -//with varargs functions, clearing the stack is caller's responsibility -//(since the callee doesn't know how many parameters were passed). -//cdecl is the right convention here, not stdcall -procedure FreeImage_OutputMessageProc(fif: Integer; fmt: PAnsiChar); cdecl; varargs; - external FIDLL {$IFDEF MSWINDOWS}name 'FreeImage_OutputMessageProc'{$ENDIF}; -{$ELSE} -//older Delphi versions (<6) do not support varargs. -//we provide a wrapper that uses open arrays instead -procedure FreeImage_OutputMessageProc(fif: Integer; fmt: PAnsiChar; args: array of const); -{$ENDIF} - -// -------------------------------------------------------------------------- -// Allocate/Unload routines ------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_Allocate(width, height, bpp: Integer; red_mask: Cardinal = 0; - green_mask: Cardinal = 0; blue_mask: Cardinal = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Allocate@24'{$ENDIF}; -function FreeImage_AllocateT(atype: FREE_IMAGE_TYPE; width, height: Integer; - bpp: Integer = 8; red_mask: Cardinal = 0; green_mask: Cardinal = 0; - blue_mask: Cardinal = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_AllocateT@28'{$ENDIF}; -function FreeImage_Clone(dib: PFIBITMAP): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Clone@4'{$ENDIF}; -procedure FreeImage_Unload(dib: PFIBITMAP); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Unload@4'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Load / Save routines ----------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_Load(fif: FREE_IMAGE_FORMAT; filename: PAnsiChar; - flags: Integer = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Load@12'{$ENDIF}; -function FreeImage_LoadU(fif: FREE_IMAGE_FORMAT; filename: PWideChar; - flags: Integer = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_LoadU@12'{$ENDIF}; -function FreeImage_LoadFromHandle(fif: FREE_IMAGE_FORMAT; io: PFreeImageIO; - handle: fi_handle; flags: Integer = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_LoadFromHandle@16'{$ENDIF}; -function FreeImage_Save(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; filename: PAnsiChar; - flags: Integer = 0): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Save@16'{$ENDIF}; -function FreeImage_SaveU(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; filename: PWideChar; - flags: Integer = 0): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SaveU@16'{$ENDIF}; -function FreeImage_SaveToHandle(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; - io: PFreeImageIO; handle: fi_handle; flags: Integer = 0): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SaveToHandle@20'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Memory I/O stream routines ----------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_OpenMemory(data: PByte = nil; size_in_bytes: DWORD = 0): PFIMEMORY; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_OpenMemory@8'{$ENDIF}; -procedure FreeImage_CloseMemory(stream: PFIMEMORY); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_CloseMemory@4'{$ENDIF}; -function FreeImage_LoadFromMemory(fif: FREE_IMAGE_FORMAT; stream: PFIMEMORY; - flags: Integer = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_LoadFromMemory@12'{$ENDIF}; -function FreeImage_SaveToMemory(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; - stream: PFIMEMORY; flags: Integer = 0): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SaveToMemory@16'{$ENDIF}; -function FreeImage_TellMemory(stream: PFIMEMORY): LongInt; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_TellMemory@4'{$ENDIF}; -function FreeImage_SeekMemory(stream: PFIMEMORY; offset: LongInt; - origin: Integer): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SeekMemory@12'{$ENDIF}; -function FreeImage_AcquireMemory(stream: PFIMEMORY; var data: PByte; - var size_in_bytes: DWORD): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_AcquireMemory@12'{$ENDIF}; -function FreeImage_ReadMemory(buffer: Pointer; size, count: Cardinal; - stream: PFIMEMORY): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ReadMemory@16'{$ENDIF}; -function FreeImage_WriteMemory(buffer: Pointer; size, count: Cardinal; - stream: PFIMEMORY): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_WriteMemory@16'{$ENDIF}; -function FreeImage_LoadMultiBitmapFromMemory(fif: FREE_IMAGE_FORMAT; stream: PFIMEMORY; - flags: Integer = 0): PFIMULTIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_LoadMultiBitmapFromMemory@12'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Plugin Interface --------------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_RegisterLocalPlugin(proc_address: FI_InitProc; format: PAnsiChar = nil; - description: PAnsiChar = nil; extension: PAnsiChar = nil; - regexpr: PAnsiChar = nil): FREE_IMAGE_FORMAT; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_RegisterLocalPlugin@20'{$ENDIF}; -function FreeImage_RegisterExternalPlugin(path: PAnsiChar; format: PAnsiChar = nil; - description: PAnsiChar = nil; extension: PAnsiChar = nil; - regexpr: PAnsiChar = nil): FREE_IMAGE_FORMAT; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_RegisterExternalPlugin@20'{$ENDIF}; -function FreeImage_GetFIFCount: Integer; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFIFCount@0'{$ENDIF}; -procedure FreeImage_SetPluginEnabled(fif: FREE_IMAGE_FORMAT; enable: Boolean); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetPluginEnabled@8'{$ENDIF}; -function FreeImage_IsPluginEnabled(fif: FREE_IMAGE_FORMAT): Integer; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_IsPluginEnabled@4'{$ENDIF}; -function FreeImage_GetFIFFromFormat(format: PAnsiChar): FREE_IMAGE_FORMAT; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFIFFromFormat@4'{$ENDIF}; -function FreeImage_GetFIFFromMime(mime: PAnsiChar): FREE_IMAGE_FORMAT; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFIFFromMime@4'{$ENDIF}; -function FreeImage_GetFormatFromFIF(fif: FREE_IMAGE_FORMAT): PAnsiChar; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFormatFromFIF@4'{$ENDIF}; -function FreeImage_GetFIFExtensionList(fif: FREE_IMAGE_FORMAT): PAnsiChar; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFIFExtensionList@4'{$ENDIF}; -function FreeImage_GetFIFDescription(fif: FREE_IMAGE_FORMAT): PAnsiChar; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFIFDescription@4'{$ENDIF}; -function FreeImage_GetFIFRegExpr(fif: FREE_IMAGE_FORMAT): PAnsiChar; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFIFRegExpr@4'{$ENDIF}; -function FreeImage_GetFIFMimeType(fif: FREE_IMAGE_FORMAT): PAnsiChar; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFIFMimeType@4'{$ENDIF}; -function FreeImage_GetFIFFromFilename(filename: PAnsiChar): FREE_IMAGE_FORMAT; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFIFFromFilename@4'{$ENDIF}; -function FreeImage_GetFIFFromFilenameU(filename: PWideChar): FREE_IMAGE_FORMAT; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFIFFromFilenameU@4'{$ENDIF}; -function FreeImage_FIFSupportsReading(fif: FREE_IMAGE_FORMAT): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FIFSupportsReading@4'{$ENDIF}; -function FreeImage_FIFSupportsWriting(fif: FREE_IMAGE_FORMAT): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FIFSupportsWriting@4'{$ENDIF}; -function FreeImage_FIFSupportsExportBPP(fif: FREE_IMAGE_FORMAT; - bpp: Integer): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FIFSupportsExportBPP@8'{$ENDIF}; -function FreeImage_FIFSupportsExportType(fif: FREE_IMAGE_FORMAT; - atype: FREE_IMAGE_TYPE): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FIFSupportsExportType@8'{$ENDIF}; -function FreeImage_FIFSupportsICCProfiles(fif: FREE_IMAGE_FORMAT): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FIFSupportsICCProfiles@4'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Multipaging interface ---------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_OpenMultiBitmap(fif: FREE_IMAGE_FORMAT; filename: PAnsiChar; - create_new, read_only: Boolean; keep_cache_in_memory: Boolean = False; - flags: Integer = 0): PFIMULTIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_OpenMultiBitmap@24'{$ENDIF}; -function FreeImage_OpenMultiBitmapFromHandle(fif: FREE_IMAGE_FORMAT; io: PFreeImageIO; - handle: fi_handle; flags: Integer = 0): PFIMULTIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_OpenMultiBitmapFromHandle@16'{$ENDIF}; -function FreeImage_CloseMultiBitmap(bitmap: PFIMULTIBITMAP; - flags: Integer = 0): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_CloseMultiBitmap@8'{$ENDIF}; -function FreeImage_GetPageCount(bitmap: PFIMULTIBITMAP): Integer; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetPageCount@4'{$ENDIF}; -procedure FreeImage_AppendPage(bitmap: PFIMULTIBITMAP; data: PFIBITMAP); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_AppendPage@8'{$ENDIF}; -procedure FreeImage_InsertPage(bitmap: PFIMULTIBITMAP; page: Integer; - data: PFIBITMAP); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_InsertPage@12'{$ENDIF}; -procedure FreeImage_DeletePage(bitmap: PFIMULTIBITMAP; page: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_DeletePage@8'{$ENDIF}; -function FreeImage_LockPage(bitmap: PFIMULTIBITMAP; page: Integer): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_LockPage@8'{$ENDIF}; -procedure FreeImage_UnlockPage(bitmap: PFIMULTIBITMAP; data: PFIBITMAP; - changed: Boolean); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_UnlockPage@12'{$ENDIF}; -function FreeImage_MovePage(bitmap: PFIMULTIBITMAP; target, source: Integer): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_MovePage@12'{$ENDIF}; -function FreeImage_GetLockedPageNumbers(bitmap: PFIMULTIBITMAP; var pages: Integer; - var count: Integer): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetLockedPageNumbers@12'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Filetype request routines ------------------------------------------------ -// -------------------------------------------------------------------------- - -function FreeImage_GetFileType(filename: PAnsiChar; - size: Integer = 0): FREE_IMAGE_FORMAT; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFileType@8'{$ENDIF}; -function FreeImage_GetFileTypeU(filename: PWideChar; - size: Integer = 0): FREE_IMAGE_FORMAT; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFileTypeU@8'{$ENDIF}; -function FreeImage_GetFileTypeFromHandle(io: PFreeImageIO; handle: FI_Handle; - size: Integer = 0): FREE_IMAGE_FORMAT; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFileTypeFromHandle@12'{$ENDIF}; -function FreeImage_GetFileTypeFromMemory(stream: PFIMEMORY; - size: Integer = 0): FREE_IMAGE_FORMAT; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetFileTypeFromMemory@8'{$ENDIF}; - -// -------------------------------------------------------------------------- -// ImageType request routine ------------------------------------------------ -// -------------------------------------------------------------------------- - -function FreeImage_GetImageType(dib: PFIBITMAP): FREE_IMAGE_TYPE; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetImageType@4'{$ENDIF}; - -// -------------------------------------------------------------------------- -// FreeImage helper routines ------------------------------------------------ -// -------------------------------------------------------------------------- - -function FreeImage_IsLittleEndian: Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_IsLittleEndian@0'{$ENDIF}; -function FreeImage_LookupX11Color(szColor: PAnsiChar; var nRed, nGreen, nBlue: Byte): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_LookupX11Color@16'{$ENDIF}; -function FreeImage_LookupSVGColor(szColor: PAnsiChar; var nRed, nGreen, nBlue: Byte): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_LookupSVGColor@16'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Pixels access routines --------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_GetBits(dib: PFIBITMAP): PByte; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetBits@4'{$ENDIF}; -function FreeImage_GetScanLine(dib: PFIBITMAP; scanline: Integer): PByte; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetScanLine@8'{$ENDIF}; - -function FreeImage_GetPixelIndex(dib: PFIBITMAP; x, y: Cardinal; var value: Byte): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetPixelIndex@16'{$ENDIF}; -function FreeImage_GetPixelColor(dib: PFIBITMAP; x, y: Cardinal; var value: RGBQUAD): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetPixelColor@16'{$ENDIF}; -function FreeImage_SetPixelIndex(dib: PFIBITMAP; x, y: Cardinal; var value: Byte): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetPixelIndex@16'{$ENDIF}; -function FreeImage_SetPixelColor(dib: PFIBITMAP; x, y: Cardinal; var value: RGBQUAD): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetPixelColor@16'{$ENDIF}; - -// -------------------------------------------------------------------------- -// DIB info routines -------------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_GetColorsUsed(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetColorsUsed@4'{$ENDIF}; -function FreeImage_GetBPP(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetBPP@4'{$ENDIF}; -function FreeImage_GetWidth(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetWidth@4'{$ENDIF}; -function FreeImage_GetHeight(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetHeight@4'{$ENDIF}; -function FreeImage_GetLine(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetLine@4'{$ENDIF}; -function FreeImage_GetPitch(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetPitch@4'{$ENDIF}; -function FreeImage_GetDIBSize(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetDIBSize@4'{$ENDIF}; -function FreeImage_GetPalette(dib: PFIBITMAP): PRGBQuad; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetPalette@4'{$ENDIF}; - -function FreeImage_GetDotsPerMeterX(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetDotsPerMeterX@4'{$ENDIF}; -function FreeImage_GetDotsPerMeterY(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetDotsPerMeterY@4'{$ENDIF}; -procedure FreeImage_SetDotsPerMeterX(dib: PFIBITMAP; res: Cardinal); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetDotsPerMeterX@8'{$ENDIF}; -procedure FreeImage_SetDotsPerMeterY(dib: PFIBITMAP; res: Cardinal); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetDotsPerMeterY@8'{$ENDIF}; - -function FreeImage_GetInfoHeader(dib: PFIBITMAP): PBITMAPINFOHEADER; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetInfoHeader@4'{$ENDIF}; -function FreeImage_GetInfo(dib: PFIBITMAP): PBITMAPINFO; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetInfo@4'{$ENDIF}; -function FreeImage_GetColorType(dib: PFIBITMAP): FREE_IMAGE_COLOR_TYPE; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetColorType@4'{$ENDIF}; - -function FreeImage_GetRedMask(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetRedMask@4'{$ENDIF}; -function FreeImage_GetGreenMask(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetGreenMask@4'{$ENDIF}; -function FreeImage_GetBlueMask(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetBlueMask@4'{$ENDIF}; - -function FreeImage_GetTransparencyCount(dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetTransparencyCount@4'{$ENDIF}; -function FreeImage_GetTransparencyTable(dib: PFIBITMAP): PByte; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetTransparencyTable@4'{$ENDIF}; -procedure FreeImage_SetTransparent(dib: PFIBITMAP; enabled: Boolean); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetTransparent@8'{$ENDIF}; -procedure FreeImage_SetTransparencyTable(dib: PFIBITMAP; table: PByte; - count: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetTransparencyTable@12'{$ENDIF}; -function FreeImage_IsTransparent(dib: PFIBITMAP): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_IsTransparent@4'{$ENDIF}; -procedure FreeImage_SetTransparentIndex(dib: PFIBITMAP; index: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetTransparentIndex@8'{$ENDIF}; -function FreeImage_GetTransparentIndex(dib: PFIBITMAP): Integer; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetTransparentIndex@4'{$ENDIF}; - -function FreeImage_HasBackgroundColor(dib: PFIBITMAP): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_HasBackgroundColor@4'{$ENDIF}; -function FreeImage_GetBackgroundColor(dib: PFIBITMAP; var bkcolor: RGBQUAD): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetBackgroundColor@8'{$ENDIF}; -function FreeImage_SetBackgroundColor(dib: PFIBITMAP; bkcolor: PRGBQuad): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetBackgroundColor@8'{$ENDIF}; - -// -------------------------------------------------------------------------- -// ICC profile routines ----------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_GetICCProfile(dib: PFIBITMAP): PFIICCPROFILE; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetICCProfile@4'{$ENDIF}; -function FreeImage_CreateICCProfile(dib: PFIBITMAP; data: Pointer; - size: LongInt): PFIICCPROFILE; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name 'FreeImage_CreateICCProfile@12'{$ENDIF}; -procedure FreeImage_DestroyICCProfile(dib: PFIBITMAP); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name 'FreeImage_DestroyICCProfile@4'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Line conversion routines ------------------------------------------------- -// -------------------------------------------------------------------------- - -procedure FreeImage_ConvertLine1To4(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine1To4@12'{$ENDIF}; -procedure FreeImage_ConvertLine8To4(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine8To4@16'{$ENDIF}; -procedure FreeImage_ConvertLine16To4_555(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine16To4_555@12'{$ENDIF}; -procedure FreeImage_ConvertLine16To4_565(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine16To4_565@12'{$ENDIF}; -procedure FreeImage_ConvertLine24To4(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine24To4@12'{$ENDIF}; -procedure FreeImage_ConvertLine32To4(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine32To4@12'{$ENDIF}; - -procedure FreeImage_ConvertLine1To8(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine1To8@12'{$ENDIF}; -procedure FreeImage_ConvertLine4To8(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine4To8@12'{$ENDIF}; -procedure FreeImage_ConvertLine16To8_555(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine16To8_555@12'{$ENDIF}; -procedure FreeImage_ConvertLine16To8_565(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine16To8_565@12'{$ENDIF}; -procedure FreeImage_ConvertLine24To8(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine24To8@12'{$ENDIF}; -procedure FreeImage_ConvertLine32To8(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine32To8@12'{$ENDIF}; - -procedure FreeImage_ConvertLine1To16_555(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine1To16_555@16'{$ENDIF}; -procedure FreeImage_ConvertLine4To16_555(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine4To16_555@16'{$ENDIF}; -procedure FreeImage_ConvertLine8To16_555(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine8To16_555@16'{$ENDIF}; -procedure FreeImage_ConvertLine16_565_To16_555(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine16_565_To16_555@12'{$ENDIF}; -procedure FreeImage_ConvertLine24To16_555(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine24To16_555@12'{$ENDIF}; -procedure FreeImage_ConvertLine32To16_555(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine32To16_555@12'{$ENDIF}; - -procedure FreeImage_ConvertLine1To16_565(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine1To16_565@16'{$ENDIF}; -procedure FreeImage_ConvertLine4To16_565(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine4To16_565@16'{$ENDIF}; -procedure FreeImage_ConvertLine8To16_565(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine8To16_565@16'{$ENDIF}; -procedure FreeImage_ConvertLine16_555_To16_565(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine16_555_To16_565@12'{$ENDIF}; -procedure FreeImage_ConvertLine24To16_565(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine24To16_565@12'{$ENDIF}; -procedure FreeImage_ConvertLine32To16_565(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine32To16_565@12'{$ENDIF}; - -procedure FreeImage_ConvertLine1To24(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine1To24@16'{$ENDIF}; -procedure FreeImage_ConvertLine4To24(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine4To24@16'{$ENDIF}; -procedure FreeImage_ConvertLine8To24(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine8To24@16'{$ENDIF}; -procedure FreeImage_ConvertLine16To24_555(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine16To24_555@12'{$ENDIF}; -procedure FreeImage_ConvertLine16To24_565(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine16To24_565@12'{$ENDIF}; -procedure FreeImage_ConvertLine32To24(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine32To24@12'{$ENDIF}; - -procedure FreeImage_ConvertLine1To32(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine1To32@16'{$ENDIF}; -procedure FreeImage_ConvertLine4To32(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine4To32@16'{$ENDIF}; -procedure FreeImage_ConvertLine8To32(target, source: PByte; width_in_pixels: Integer; - palette: PRGBQuad); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine8To32@16'{$ENDIF}; -procedure FreeImage_ConvertLine16To32_555(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine16To32_555@12'{$ENDIF}; -procedure FreeImage_ConvertLine16To32_565(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine16To32_565@12'{$ENDIF}; -procedure FreeImage_ConvertLine24To32(target, source: PByte; width_in_pixels: Integer); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertLine24To32@12'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Smart conversion routines ------------------------------------------------ -// -------------------------------------------------------------------------- - -function FreeImage_ConvertTo4Bits(dib: PFIBITMAP): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertTo4Bits@4'{$ENDIF}; -function FreeImage_ConvertTo8Bits(dib: PFIBITMAP): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertTo8Bits@4'{$ENDIF}; -function FreeImage_ConvertToGreyscale(dib: PFIBITMAP): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertToGreyscale@4'{$ENDIF}; -function FreeImage_ConvertTo16Bits555(dib: PFIBITMAP): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertTo16Bits555@4'{$ENDIF}; -function FreeImage_ConvertTo16Bits565(dib: PFIBITMAP): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertTo16Bits565@4'{$ENDIF}; -function FreeImage_ConvertTo24Bits(dib: PFIBITMAP): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertTo24Bits@4'{$ENDIF}; -function FreeImage_ConvertTo32Bits(dib: PFIBITMAP): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertTo32Bits@4'{$ENDIF}; -function FreeImage_ColorQuantize(dib: PFIBITMAP; quantize: FREE_IMAGE_QUANTIZE): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ColorQuantize@8'{$ENDIF}; -function FreeImage_ColorQuantizeEx(dib: PFIBITMAP; quantize: FREE_IMAGE_QUANTIZE = FIQ_WUQUANT; - PaletteSize: Integer = 256; ReserveSize: Integer = 0; - ReservePalette: PRGBQuad = nil): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ColorQuantizeEx@20'{$ENDIF}; -function FreeImage_Threshold(dib: PFIBITMAP; T: Byte): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Threshold@8'{$ENDIF}; -function FreeImage_Dither(dib: PFIBITMAP; algorithm: FREE_IMAGE_DITHER): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Dither@8'{$ENDIF}; - -function FreeImage_ConvertFromRawBits(bits: PByte; width, height, pitch: Integer; - bpp, red_mask, green_mask, blue_mask: Cardinal; topdown: Boolean = False): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertFromRawBits@36'{$ENDIF}; -procedure FreeImage_ConvertToRawBits(bits: PByte; dib: PFIBITMAP; pitch: Integer; - bpp, red_mask, green_mask, blue_mask: Cardinal; topdown: Boolean = False); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertToRawBits@32'{$ENDIF}; - -function FreeImage_ConvertToRGBF(dib: PFIBITMAP): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertToRGBF@4'{$ENDIF}; - -function FreeImage_ConvertToStandardType(src: PFIBITMAP; - scale_linear: Boolean = True): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertToStandardType@8'{$ENDIF}; -function FreeImage_ConvertToType(src: PFIBITMAP; dst_type: FREE_IMAGE_TYPE; - scale_linear: Boolean = True): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ConvertToType@12'{$ENDIF}; - -// tone mapping operators -function FreeImage_ToneMapping(dib: PFIBITMAP; tmo: FREE_IMAGE_TMO; - first_param: Double = 0; second_param: Double = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ToneMapping@24'{$ENDIF}; -function FreeImage_TmoDrago03(src: PFIBITMAP; gamma: Double = 2.2; - exposure: Double = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_TmoDrago03@20'{$ENDIF}; -function FreeImage_TmoReinhard05(src: PFIBITMAP; intensity: Double = 0; - contrast: Double = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_TmoReinhard05@20'{$ENDIF}; -function FreeImage_TmoReinhard05Ex(src: PFIBITMAP; intensity: Double = 0; - contrast: Double = 0; adaptation: Double = 1; color_correction: Double = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_TmoReinhard05Ex@36'{$ENDIF}; - -function FreeImage_TmoFattal02(src: PFIBITMAP; color_saturation: Double = 0.5; - attenuation: Double = 0.85): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_TmoFattal02@20'{$ENDIF}; - -// -------------------------------------------------------------------------- -// ZLib interface ----------------------------------------------------------- -// -------------------------------------------------------------------------- - -function FreeImage_ZLibCompress(target: PByte; target_size: DWORD; source: PByte; source_size: DWORD): DWORD; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ZLibCompress@16'{$ENDIF}; -function FreeImage_ZLibUncompress(target: PByte; target_size: DWORD; source: PByte; source_size: DWORD): DWORD; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ZLibUncompress@16'{$ENDIF}; -function FreeImage_ZLibGZip(target: PByte; target_size: DWORD; source: PByte; source_size: DWORD): DWORD; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ZLibGZip@16'{$ENDIF}; -function FreeImage_ZLibGUnzip(target: PByte; target_size: DWORD; source: PByte; source_size: DWORD): DWORD; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ZLibGUnzip@16'{$ENDIF}; -function FreeImage_ZLibCRC32(crc: DWORD; source: PByte; source_size: DWORD): DWORD; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ZLibCRC32@12'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Metadata routines -------------------------------------------------------- -// -------------------------------------------------------------------------- - -// tag creation / destruction -function FreeImage_CreateTag: PFITAG; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_CreateTag@0'{$ENDIF}; -procedure FreeImage_DeleteTag(tag: PFITAG); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_DeleteTag@4'{$ENDIF}; -function FreeImage_CloneTag(tag: PFITAG): PFITAG; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_CloneTag@4'{$ENDIF}; - -// tag getters and setters -function FreeImage_GetTagKey(tag: PFITAG): PAnsiChar; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetTagKey@4'{$ENDIF}; -function FreeImage_GetTagDescription(tag: PFITAG): PAnsiChar; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetTagDescription@4'{$ENDIF}; -function FreeImage_GetTagID(tag: PFITAG): Word; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetTagID@4'{$ENDIF}; -function FreeImage_GetTagType(tag: PFITAG): FREE_IMAGE_MDTYPE; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetTagType@4'{$ENDIF}; -function FreeImage_GetTagCount(tag: PFITAG): DWORD; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetTagCount@4'{$ENDIF}; -function FreeImage_GetTagLength(tag: PFITAG): DWORD; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetTagLength@4'{$ENDIF}; -function FreeImage_GetTagValue(tag: PFITAG): Pointer; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetTagValue@4'{$ENDIF}; - -function FreeImage_SetTagKey(tag: PFITAG; key: PAnsiChar): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetTagKey@8'{$ENDIF}; -function FreeImage_SetTagDescription(tag: PFITAG; description: PAnsiChar): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetTagDescription@8'{$ENDIF}; -function FreeImage_SetTagID(tag: PFITAG; id: Word): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetTagID@8'{$ENDIF}; -function FreeImage_SetTagType(tag: PFITAG; atype: FREE_IMAGE_MDTYPE): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetTagType@8'{$ENDIF}; -function FreeImage_SetTagCount(tag: PFITAG; count: DWORD): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetTagCount@8'{$ENDIF}; -function FreeImage_SetTagLength(tag: PFITAG; length: DWORD): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetTagLength@8'{$ENDIF}; -function FreeImage_SetTagValue(tag: PFITAG; value: Pointer): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetTagValue@8'{$ENDIF}; - -// iterator -function FreeImage_FindFirstMetadata(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; - var tag: PFITAG): PFIMETADATA; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FindFirstMetadata@12'{$ENDIF}; -function FreeImage_FindNextMetadata(mdhandle: PFIMETADATA; var tag: PFITAG): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FindNextMetadata@8'{$ENDIF}; -procedure FreeImage_FindCloseMetadata(mdhandle: PFIMETADATA); stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FindCloseMetadata@4'{$ENDIF}; - -// metadata setter and getter -function FreeImage_SetMetadata(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; - key: PAnsiChar; tag: PFITAG): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetMetadata@16'{$ENDIF}; -function FreeImage_GetMetaData(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; - key: PAnsiChar; var tag: PFITAG): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetMetadata@16'{$ENDIF}; - -// helpers -function FreeImage_GetMetadataCount(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetMetadataCount@8'{$ENDIF}; -function FreeImage_CloneMetadata(dst, src: PFIBITMAP): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_CloneMetadata@8'{$ENDIF}; - -// tag to C string conversion -function FreeImage_TagToString(model: FREE_IMAGE_MDMODEL; tag: PFITAG; - Make: PAnsiChar = nil): PAnsiChar; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_TagToString@12'{$ENDIF}; - -// -------------------------------------------------------------------------- -// Image manipulation toolkit ----------------------------------------------- -// -------------------------------------------------------------------------- - -// rotation and flipping -function FreeImage_RotateClassic(dib: PFIBITMAP; angle: Double): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_RotateClassic@12'{$ENDIF}; -function FreeImage_Rotate(dib: PFIBITMAP; angle: Double; bkcolor: Pointer = nil): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Rotate@16'{$ENDIF}; -function FreeImage_RotateEx(dib: PFIBITMAP; angle, x_shift, y_shift, x_origin, y_origin: Double; - use_mask: Boolean): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_RotateEx@48'{$ENDIF}; -function FreeImage_FlipHorizontal(dib: PFIBITMAP): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FlipHorizontal@4'{$ENDIF}; -function FreeImage_FlipVertical(dib: PFIBITMAP): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FlipVertical@4'{$ENDIF}; -function FreeImage_JPEGTransform(src_file, dst_file: PAnsiChar; operation: FREE_IMAGE_JPEG_OPERATION; - perfect: Boolean = False): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_JPEGTransform@16'{$ENDIF}; -function FreeImage_JPEGTransformU(src_file, dst_file: PWideChar; operation: FREE_IMAGE_JPEG_OPERATION; - perfect: Boolean = False): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_JPEGTransformU@16'{$ENDIF}; - -// upsampling / downsampling -function FreeImage_Rescale(dib: PFIBITMAP; dst_width, dst_height: Integer; filter: FREE_IMAGE_FILTER): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Rescale@16'{$ENDIF}; -function FreeImage_MakeThumbnail(dib: PFIBITMAP; max_pixel_size: Integer; convert: Boolean = True): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_MakeThumbnail@12'{$ENDIF}; - -// color manipulation routines (point operations) -function FreeImage_AdjustCurve(dib: PFIBITMAP; LUT: PByte; - channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_AdjustCurve@12'{$ENDIF}; -function FreeImage_AdjustGamma(dib: PFIBITMAP; gamma: Double): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_AdjustGamma@12'{$ENDIF}; -function FreeImage_AdjustBrightness(dib: PFIBITMAP; percentage: Double): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_AdjustBrightness@12'{$ENDIF}; -function FreeImage_AdjustContrast(dib: PFIBITMAP; percentage: Double): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_AdjustContrast@12'{$ENDIF}; -function FreeImage_Invert(dib: PFIBITMAP): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Invert@4'{$ENDIF}; -function FreeImage_GetHistogram(dib: PFIBITMAP; histo: PDWORD; - channel: FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetHistogram@12'{$ENDIF}; -function FreeImage_GetAdjustColorsLookupTable(LUT: PByte; brightness, contrast, gamma: Double; - invert: Boolean): Integer; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetAdjustColorsLookupTable@32'{$ENDIF}; -function FreeImage_AdjustColors(dib: PFIBITMAP; brightness, contrast, gamma: Double; - invert: Boolean = False): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_AdjustColors@32'{$ENDIF}; -function FreeImage_ApplyColorMapping(dib: PFIBITMAP; srccolors, dstcolors: PRGBQuad; - count: Cardinal; ignore_alpha, swap: Boolean): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ApplyColorMapping@24'{$ENDIF}; -function FreeImage_SwapColors(dib: PFIBITMAP; color_a, color_b: PRGBQuad; - ignore_alpha: Boolean): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SwapColors@16'{$ENDIF}; -function FreeImage_ApplyPaletteIndexMapping(dib: PFIBITMAP; srcindices, dstindices: PByte; - count: Cardinal; swap: Boolean): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_ApplyPaletteIndexMapping@20'{$ENDIF}; -function FreeImage_SwapPaletteIndices(dib: PFIBITMAP; index_a, index_b: PByte): Cardinal; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SwapPaletteIndices@12'{$ENDIF}; - -// channel processing routines -function FreeImage_GetChannel(dib: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetChannel@8'{$ENDIF}; -function FreeImage_SetChannel(dib, dib8: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetChannel@12'{$ENDIF}; -function FreeImage_GetComplexChannel(src: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_GetComplexChannel@8'{$ENDIF}; -function FreeImage_SetComplexChannel(dst, src: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_SetComplexChannel@12'{$ENDIF}; - -// copy / paste / composite routines - -function FreeImage_Copy(dib: PFIBITMAP; left, top, right, bottom: Integer): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Copy@20'{$ENDIF}; -function FreeImage_Paste(dst, src: PFIBITMAP; left, top, alpha: Integer): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Paste@20'{$ENDIF}; -function FreeImage_Composite(fg: PFIBITMAP; useFileBkg: Boolean = False; - appBkColor: PRGBQuad = nil; bg: PFIBITMAP = nil): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_Composite@16'{$ENDIF}; -function FreeImage_JPEGCrop(src_file, dst_file: PAnsiChar; - left, top, right, bottom: Integer): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_JPEGCrop@24'{$ENDIF}; -function FreeImage_JPEGCropU(src_file, dst_file: PWideChar; - left, top, right, bottom: Integer): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_JPEGCropU@24'{$ENDIF}; -function FreeImage_PreMultiplyWithAlpha(dib: PFIBITMAP): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_PreMultiplyWithAlpha@4'{$ENDIF}; - -// background filling routines -function FreeImage_FillBackground(dib: PFIBITMAP; color: Pointer; - options: Integer = 0): Boolean; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_FillBackground@12'{$ENDIF}; -function FreeImage_EnlargeCanvas(src: PFIBITMAP; left, top, right, bottom: Integer; - color: Pointer; options: Integer = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_EnlargeCanvas@28'{$ENDIF}; -function FreeImage_AllocateEx(width, height, bpp: Integer; color: PRGBQuad; - options: Integer = 0; palette: PRGBQuad = nil; red_mask: Cardinal = 0; - green_mask: Cardinal = 0; blue_mask: Cardinal = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_AllocateEx@36'{$ENDIF}; -function FreeImage_AllocateExT(atype: FREE_IMAGE_TYPE; width, height, bpp: Integer; - color: Pointer; options: Integer = 0; palette: PRGBQuad = nil; red_mask: Cardinal = 0; - green_mask: Cardinal = 0; blue_mask: Cardinal = 0): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_AllocateExT@40'{$ENDIF}; - -// miscellaneous algorithms -function FreeImage_MultigridPoissonSolver(Laplacian: PFIBITMAP; - ncycle: Integer = 3): PFIBITMAP; stdcall; - external FIDLL {$IFDEF MSWINDOWS}name '_FreeImage_MultigridPoissonSolver@8'{$ENDIF}; - - -implementation - -{$IFNDEF DELPHI6} -uses SysUtils; - -//we provide a wrapper since we haven't varargs in older versions of Delphi -procedure __FreeImage_OutputMessageProc; - external FIDLL name 'FreeImage_OutputMessageProc'; -procedure FreeImage_OutputMessageProc(fif: Integer; fmt: PAnsiChar; args: array of const); - function ArrayToBuffer(Args: array of const; - var Argv: Pointer; Buffer: Pointer; Size: Cardinal): Integer; - var - i: Integer; - temp: AnsiString; - parg: Pointer; - psrc, pbuf: PAnsiChar; - len: Cardinal; - begin - Result := High(Args) + 1; - if Result = 0 then - Exit; - //array of pointers to push on stack - GetMem(Argv, Result * SizeOf(Pointer)); - //pointer to current string in buffer - pbuf := Buffer; - //pointer to current arg - parg := Argv; - //for each const... - for i := 0 to Result - 1 do begin - case Args[i].VType of - vtInteger: begin - //integer - psrc := nil; - len := 0; - Integer(parg^) := Args[i].VInteger; - end; - vtString: begin - //short string - psrc := PAnsiChar(Cardinal(Args[i].VString) + SizeOf(Byte)); - len := PByte(Args[i].VString)^; - PAnsiChar(parg^) := pbuf; - end; - vtPChar: begin - //NULL terminated MBCS string - psrc := nil; - len := 0; - PAnsiChar(parg^) := Args[i].VPChar; - end; - vtPWideChar: begin - //NULL terminated Unicode string - temp := AnsiString(Args[i].VPWideChar); - psrc := PAnsiChar(temp); - len := Length(temp); - PAnsiChar(parg^) := pbuf; - end; - vtAnsiString: begin - //ANSI string - psrc := PAnsiChar(Args[i].VAnsiString); - len := StrLen(psrc); - PAnsiChar(parg^) := pbuf; - end; - vtWideString: begin - //Wide string (OLE) - temp := AnsiString(PWideChar(Args[i].VWideString)); - psrc := PAnsiChar(temp); - len := Length(temp); - PAnsiChar(parg^) := pbuf; - end; - else raise Exception.Create('Unsupported argument type'); - end; - if (psrc <> nil) and (len <> 0) then begin - //enough space to hold string? - if Size < (len + 1) then - raise Exception.Create('Buffer overflow'); - //copy string - Move(psrc^, pbuf^, len); - //NULL terminator - PAnsiChar(Cardinal(pbuf) + len)^ := #0; - //shift pointer... - Inc(pbuf, len + 1); - //...and decrease space left - Dec(Size, len + 1); - end; - Cardinal(parg) := Cardinal(parg) + SizeOf(Pointer); - end; - end; - - procedure DoVarargsCall(fif: Integer; fmt: PAnsiChar; Argv: Pointer; Argc: Integer); - { - fif -> EAX - fmt -> EDX - Argv -> ECX - Argc -> [EBP+$08] - } - asm - PUSH EAX //remember fif - PUSH ECX //make room for ESP backup - - MOV DWORD PTR [EBP-$08], ESP //backup stack pointer - - MOV EAX, DWORD PTR [EBP+$08] //store Argc - - TEST EAX, EAX //Argc <= 0? - JLE @Call - - @Loop: - PUSH DWORD PTR [ECX+EAX*$04-$04] //push Argv in right to left order - DEC EAX - JNZ @Loop - - @Call: - PUSH EDX //push fmt - PUSH DWORD PTR [EBP-$04] //push fif - CALL __FreeImage_OutputMessageProc - - MOV ESP, DWORD PTR [EBP-$08] //restore stack pointer - - POP ECX //clean stack - POP EAX - end; -var - Argc: Integer; - Argv: Pointer; - //buffer to hold strings - FreeImage allocates 512 bytes, we needn't more... - Buffer: array[1..512] of Byte; -begin - Argv := nil; - //build array of pointers from array of const - Argc := ArrayToBuffer(args, Argv, @Buffer, SizeOf(Buffer)); - try - //mimic cdecl call with varargs - DoVarargsCall(fif, fmt, Argv, Argc); - finally - //cleanup - FreeMem(Argv); - end; -end; -{$ENDIF} - -end. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/src/FreeUtils.pas b/DSTexCompress/FreeImage/Wrapper/Delphi/src/FreeUtils.pas deleted file mode 100644 index 126ab64..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/src/FreeUtils.pas +++ /dev/null @@ -1,186 +0,0 @@ -unit FreeUtils; - -// ========================================================== -// -// Delphi wrapper for FreeImage 3 -// -// Design and implementation by -// - Anatoliy Pulyaevskiy (xvel84@rambler.ru) -// -// Contributors: -// - Enzo Costantini (enzocostantini@libero.it) -// - Armindo (tech1.yxendis@wanadoo.fr) -// - Lorenzo Monti (LM) lomo74@gmail.com -// -// Revision history -// When Who What -// ----------- ----- ----------------------------------------------------------- -// 2010-07-14 LM made RAD2010 compliant (unicode) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// -// ========================================================== - -interface - -{$I 'Version.inc'} - -uses - {$IFDEF DELPHI2010}AnsiStrings,{$ENDIF} SysUtils, Classes, FreeImage; - -function FIU_GetFIFType(filename: AnsiString): FREE_IMAGE_FORMAT; - -// returns FIF (plugin) description string -function FIU_GetFIFDescription(fif: FREE_IMAGE_FORMAT): AnsiString; - -procedure FIU_GetAllDescriptions(var Descriptions: TStringList); - -// returns file extentions for FIF (e.g. '*.tif;*.tiff) -function FIU_GetFIFExtList(fif: FREE_IMAGE_FORMAT): AnsiString; - -// returns file extentions for all plugins -function FIU_GetFullExtList: AnsiString; - -// returns "Description + | + ExtList" for specified FIF -function FIU_GetFIFFilter(fif: FREE_IMAGE_FORMAT): AnsiString; - -// All supported formats + Full filter list for FIFs -function FIU_GetAllFilters: AnsiString; - -//Filter for OpenDialogs -function FIU_GetAllOpenFilters: AnsiString; - -//Filter for SaveDialogs -function FIU_GetAllSaveFilters: AnsiString; - -implementation - -const - FIF_START = FIF_UNKNOWN; - FIF_END = FIF_XPM; - -function FIU_GetFIFType(filename: AnsiString): FREE_IMAGE_FORMAT; -begin - Result := FreeImage_GetFileType(PAnsiChar(filename), 0); -end; - -function FIU_GetFIFDescription(fif: FREE_IMAGE_FORMAT): AnsiString; -begin - Result := FreeImage_GetFIFDescription(fif) -end; - -procedure FIU_GetAllDescriptions(var Descriptions: TStringList); -var - fif: FREE_IMAGE_FORMAT; -begin - Descriptions.Clear; - for fif := FIF_START to FIF_END do - Descriptions.Add(string(FreeImage_GetFIFDescription(fif)) + ' (' + - string(FIu_GetFIFExtList(fif)) + ')'); -end; - -function FIU_GetFIFExtList(fif: FREE_IMAGE_FORMAT): AnsiString; -var - ExtList: AnsiString; - I: Smallint; - C: AnsiChar; -begin - Result := '*.'; - ExtList := FreeImage_GetFIFExtensionList(fif); - for I := 1 to Length(ExtList) do - begin - C := ExtList[i]; - if C <> ',' then - Result := Result + C - else - Result := Result + ';*.'; - end -end; - -function FIU_GetFullExtList: AnsiString; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := FIU_GetFIFExtList(FIF_START); - for fif := FIF_START to FIF_END do - Result := Result + ';' + FIU_GetFIFExtList(fif) -end; - -function FIU_GetFIFFilter(fif: FREE_IMAGE_FORMAT): AnsiString; -var - Text, ExtList: AnsiString; -begin - Result := ''; - if fif <> FIF_UNKNOWN then - begin - Text := {$IFDEF DELPHI2010}AnsiStrings.{$ENDIF}Trim(FreeImage_GetFIFDescription(fif)); - ExtList := FIU_GetFIFExtList(fif); - Result := Text + '(' + ExtList + ')' + '|' + ExtList - end -end; - -function FIU_GetAllFilters: AnsiString; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := 'All supported formats|' + FIU_GetFullExtList; - for fif := FIF_START to FIF_END do - begin - Result := Result + '|' + FIU_GetFIFFilter(fif) - end; -end; - -function FIU_GetAllOpenFilters: AnsiString; -var - fif: FREE_IMAGE_FORMAT; -begin - Result := 'All supported formats|' + FIU_GetFullExtList; - for fif := FIF_START to FIF_END do - if FreeImage_FIFSupportsReading(fif) then - begin - Result := Result + '|' + FIU_GetFIFFilter(fif) - end; -end; - -function FIU_GetAllSaveFilters: AnsiString; -var - ExtList: AnsiString; - I: Smallint; - C: AnsiChar; - fif: FREE_IMAGE_FORMAT; - s: AnsiString; -begin - result := ''; - for fif := FIF_START to FIF_END do - if FreeImage_FIFSupportsWriting(fif) then - begin - ExtList := FreeImage_GetFIFExtensionList(fif); - s := ''; - for I := 1 to Length(ExtList) do - begin - C := ExtList[i]; - if C <> ',' then - S := S + C - else - begin - result := Result + FreeImage_GetFIFDescription(fif) + ' (' + UpperCase(s) + ')|*.' + s + '|'; - s := ''; - end; - end; - result := Result + FreeImage_GetFIFDescription(fif) + ' (' + UpperCase(s) + ')|*.' + s + '|'; - end; -end; - -end. diff --git a/DSTexCompress/FreeImage/Wrapper/Delphi/src/Version.inc b/DSTexCompress/FreeImage/Wrapper/Delphi/src/Version.inc deleted file mode 100644 index 120b287..0000000 --- a/DSTexCompress/FreeImage/Wrapper/Delphi/src/Version.inc +++ /dev/null @@ -1,186 +0,0 @@ -// ========================================================== -// Delphi wrapper for FreeImage 3 -// -// Design and implementation by -// - Simon Beavis -// - Peter Bystrm -// - 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 -// -// 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} -{$ENDIF} diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/AssemblyInfo.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/AssemblyInfo.cpp deleted file mode 100644 index e550a32..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/AssemblyInfo.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "stdafx.h" - -using namespace System::Reflection; -using namespace System::Runtime::CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly:AssemblyTitleAttribute("")]; -[assembly:AssemblyDescriptionAttribute("")]; -[assembly:AssemblyConfigurationAttribute("")]; -[assembly:AssemblyCompanyAttribute("")]; -[assembly:AssemblyProductAttribute("")]; -[assembly:AssemblyCopyrightAttribute("")]; -[assembly:AssemblyTrademarkAttribute("")]; -[assembly:AssemblyCultureAttribute("")]; - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the value or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly:AssemblyVersionAttribute("1.0.*")]; - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project directory. -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly:AssemblyDelaySignAttribute(false)]; -[assembly:AssemblyKeyFileAttribute("")]; -[assembly:AssemblyKeyNameAttribute("")]; - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.cpp deleted file mode 100644 index c60ee8a..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// ========================================================== -// FreeImageIO.Net -// -// Design and implementation by -// - Marcos Pernambuco Motta (marcos.pernambuco@gmail.com) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "stdafx.h" -#include "FreeImageIO.Net.h" - - -extern "C" static unsigned __stdcall ReadProc (void *buffer, unsigned size, unsigned count, fi_handle handle) -{ - int total_read = 0; - struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle; - gcroot mbuffer = new unsigned char __gc[size]; - try - { - total_read = puh->_stream->Read(mbuffer,0,size); - Marshal::Copy(mbuffer,0,buffer,total_read); - } __finally { - mbuffer=NULL; - } - return (unsigned)total_read; -} - -extern "C" static unsigned __stdcall WriteProc (void *buffer, unsigned size, unsigned count, fi_handle handle) -{ - struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle; - gcroot mbuffer = new unsigned char __gc[size*count]; - try - { - - unsigned char __pin* pbuffer = &mbuffer[0]; - memcpy(pbuffer,buffer,size*count); - puh->_stream->Write(mbuffer,0,size); - } __finally { - mbuffer=NULL; - } - return count; -} - -extern "C" static int __stdcall SeekProc (fi_handle handle, long offset, int origin) -{ - struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle; - return (int)puh->_stream->Seek(offset,(SeekOrigin) origin); - -} - -extern "C" static long __stdcall TellProc(fi_handle handle) -{ - struct UNMANAGED_HANDLER* puh = (struct UNMANAGED_HANDLER*)handle; - return (long)puh->_stream->Position; -} - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.h b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.h deleted file mode 100644 index 358e871..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.h +++ /dev/null @@ -1,83 +0,0 @@ -// ========================================================== -// FreeImageIO.Net -// -// Design and implementation by -// - Marcos Pernambuco Motta (marcos.pernambuco@gmail.com) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#pragma once -#include -#include "FreeImage.h" - -using namespace System; -using namespace System::IO; -using namespace System::Runtime::InteropServices; - -extern "C" { - // forward decls - unsigned __stdcall ReadProc (void *buffer, unsigned size, unsigned count, fi_handle handle); - unsigned __stdcall WriteProc (void *buffer, unsigned size, unsigned count, fi_handle handle); - int __stdcall SeekProc (fi_handle handle, long offset, int origin); - long __stdcall TellProc(fi_handle handle); - - #pragma pack(push, 1) - __nogc struct UNMANAGED_HANDLER { - UNMANAGED_HANDLER() { - read_proc = &ReadProc; - write_proc = WriteProc; - seek_proc = SeekProc; - tell_proc = TellProc; - } - FI_ReadProc read_proc; // pointer to the function used to read data - FI_WriteProc write_proc; // pointer to the function used to write data - FI_SeekProc seek_proc; // pointer to the function used to seek - FI_TellProc tell_proc; // pointer to the function used to aquire the current position - gcroot _stream; - }; - #pragma pack(pop) -} - -#define FREEIMAGE_DLL "freeimaged.dll" - -namespace FreeImageIODotNet -{ - __gc public class FreeImageStream - { - private: - struct UNMANAGED_HANDLER* _pUnmanaged; - public: - FreeImageStream(System::IO::Stream* stream) - { - FreeImage_SaveToHandle((FREE_IMAGE_FORMAT) 1,0,0,0,0); - _pUnmanaged = new struct UNMANAGED_HANDLER; - _pUnmanaged->_stream = stream; - } - ~FreeImageStream() - { - _pUnmanaged->_stream = NULL; - delete _pUnmanaged; - } - - bool SaveImage(FREE_IMAGE_FORMAT fif, unsigned int dib, int flags) { - return (bool)FreeImage_SaveToHandle(fif,(FIBITMAP*) dib,(FreeImageIO*)_pUnmanaged,(fi_handle)_pUnmanaged,flags); - } - - unsigned int LoadImage(FREE_IMAGE_FORMAT fif, int flags) { - return (unsigned int)FreeImage_LoadFromHandle(fif,(FreeImageIO*)_pUnmanaged,(fi_handle)_pUnmanaged,flags); - } - }; -} diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.vcproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.vcproj deleted file mode 100644 index cc071da..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.Net.vcproj +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.sln b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.sln deleted file mode 100644 index 6026cc7..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/FreeImageIO.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImageIO.Net", "FreeImageIO.Net.vcproj", "{E87923FF-1FBD-450D-9287-539A90DE9776}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {E87923FF-1FBD-450D-9287-539A90DE9776}.Debug.ActiveCfg = Debug|Win32 - {E87923FF-1FBD-450D-9287-539A90DE9776}.Debug.Build.0 = Debug|Win32 - {E87923FF-1FBD-450D-9287-539A90DE9776}.Release.ActiveCfg = Release|Win32 - {E87923FF-1FBD-450D-9287-539A90DE9776}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/ReadMe.txt b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/ReadMe.txt deleted file mode 100644 index f0d15f3..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/ReadMe.txt +++ /dev/null @@ -1,27 +0,0 @@ -======================================================================== -FreeImageIO.Net - -Author: Marcos Pernambuco Motta (marcos.pernambuco@gmail.com) -======================================================================== - -This library allows programs that use FreeImage.Net to save images to or -to load images from .Net Streams. - -The class FreeImageStream implements a FreeImageIO handler and routes -IO calls (read,write,tell and seek) to a wrapped System.IO.Stream. - -Example: - -using FreeImageAPI; -using FreeImageIODotNet; - -uint dib = FreeImageAPI.FreeImage.Allocate(width,height,32,0,0,0); - -// ... Image handling code goes here - -System.IO.FileStream stream = new System.IO.FileStream(@"c:\sample.png",System.IO.FileMode.Create); -FreeImageStream imageStream = new FreeImageStream(stream); -imageStream.SaveImage((int)FREE_IMAGE_FORMAT.FIF_PNG,dib,0); -stream.Close(); - -Compile with VS2003. diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.cpp deleted file mode 100644 index 0260fa9..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// FreeImageIO.Net.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.h b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.h deleted file mode 100644 index 07ec3fb..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/Stdafx.h +++ /dev/null @@ -1,6 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, -// but are changed infrequently - -#pragma once - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.ico b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.ico deleted file mode 100644 index 3a5525f..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.ico and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.rc b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.rc deleted file mode 100644 index 6be44ad..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/app.rc +++ /dev/null @@ -1,52 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon placed first or with lowest ID value becomes application icon - -LANGUAGE 9, 1 -#pragma code_page(1252) -1 ICON "app.ico" - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" - "\0" -END - -#endif // APSTUDIO_INVOKED - -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/resource.h b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/resource.h deleted file mode 100644 index d5ac7c4..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cpp/FreeImageIO/resource.h +++ /dev/null @@ -1,3 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by app.rc diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Bin/FreeImageNET.XML b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Bin/FreeImageNET.XML deleted file mode 100644 index cfb6d94..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Bin/FreeImageNET.XML +++ /dev/null @@ -1,17586 +0,0 @@ - - - - FreeImageNET - - - - - Encapsulates a FreeImage-bitmap. - - - - - Indicates whether this instance is disposed. - - - - - Tab object. - - - - - Object used to syncronize lock methods. - - - - - Holds information used by SaveAdd() methods. - - - - - The stream that this instance was loaded from or - null if it has been cloned or deserialized. - - - - - True if the stream must be disposed with this - instance. - - - - - The number of frames contained by a mutlipage bitmap. - Default value is 1 and only changed if needed. - - - - - The index of the loaded frame. - Default value is 0 and only changed if needed. - - - - - Format of the sourceimage. - - - - - Handle to the encapsulated FreeImage-bitmap. - - - - - Initializes a new instance of the class. - - - - - Initializes a new instance of the class. - For internal use only. - - The operation failed. - - - - Initializes a new instance of the class - bases on the specified image. - - The original to clone from. - The operation failed. - is a null reference. - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - The Size structure that represent the - size of the new . - The operation failed. - is a null reference. - - or are less or equal zero. - - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - Width of the new . - Height of the new . - The operation failed. - is a null reference. - - or are less or equal zero. - - - - Initializes a new instance of the class - bases on the specified image. - - The original to clone from. - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - The Size structure that represent the - size of the new . - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is a null reference. - - or are less or equal zero. - - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - The width, in pixels, of the new . - The height, in pixels, of the new . - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is a null reference. - - or are less or equal zero. - - - - Initializes a new instance of the class - bases on the specified image. - - The original to clone from. - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - is a null reference. - The operation failed. - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - The Size structure that represent the - size of the new . - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is a null reference. - - or are less or equal zero. - - - - - Initializes a new instance of the class - bases on the specified image with the specified size. - - The original to clone from. - The width, in pixels, of the new . - The height, in pixels, of the new . - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is a null reference. - - or are less or equal zero. - - - - Initializes a new instance of the class - bases on the specified stream. - - Stream to read from. - Ignored. - The operation failed. - is a null reference. - - You must keep the stream open for the lifetime of the . - - - - - Initializes a new instance of the class - bases on the specified stream. - - Stream to read from. - The operation failed. - is a null reference. - - You must keep the stream open for the lifetime of the . - - - - - Initializes a new instance of the class - bases on the specified stream in the specified format. - - Stream to read from. - Format of the image. - The operation failed. - is a null reference. - - You must keep the stream open for the lifetime of the . - - - - - Initializes a new instance of the class - bases on the specified stream with the specified loading flags. - - Stream to read from. - Flags to enable or disable plugin-features. - The operation failed. - is a null reference. - - You must keep the stream open for the lifetime of the . - - - - - Initializes a new instance of the class - bases on the specified stream in the specified format - with the specified loading flags. - - Stream to read from. - Format of the image. - Flags to enable or disable plugin-features. - The operation failed. - is a null reference. - - You must keep the stream open for the lifetime of the . - - - - - Initializes a new instance of the class bases on the specified file. - - The complete name of the file to load. - The operation failed. - is a null reference. - does not exist. - - - - Initializes a new instance of the class bases on the specified file. - - The complete name of the file to load. - Ignored. - The operation failed. - is a null reference. - does not exist. - - - - Initializes a new instance of the class bases on the specified file - with the specified loading flags. - - The complete name of the file to load. - Flags to enable or disable plugin-features. - The operation failed. - is a null reference. - does not exist. - - - - Initializes a new instance of the class bases on the specified file - in the specified format. - - The complete name of the file to load. - Format of the image. - The operation failed. - is a null reference. - does not exist. - - - - Initializes a new instance of the class bases on the specified file - in the specified format with the specified loading flags. - - The complete name of the file to load. - Format of the image. - Flags to enable or disable plugin-features. - The operation failed. - is a null reference. - does not exist. - - - - Initializes a new instance of the class - bases on the specified size. - - The width, in pixels, of the new . - The height, in pixels, of the new . - The operation failed. - - - - Initializes a new instance of the class bases on the specified resource. - - The class used to extract the resource. - The name of the resource. - The operation failed. - - - - Initializes a new instance of the class bases on the specified size - and with the resolution of the specified object. - - The width, in pixels, of the new . - The height, in pixels, of the new . - The Graphics object that specifies the resolution for the new . - The operation failed. - is a null reference. - - - - Initializes a new instance of the class bases on the specified size and format. - - The width, in pixels, of the new . - The height, in pixels, of the new . - The PixelFormat enumeration for the new . - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is invalid. - - or are less or equal zero. - - - - Initializes a new instance of the class bases on the specified size and type. - Only non standard bitmaps are supported. - - The width, in pixels, of the new . - The height, in pixels, of the new . - The type of the bitmap. - The operation failed. - - is FIT_BITMAP or FIT_UNKNOWN. - is invalid. - - or are less or equal zero. - - - - Initializes a new instance of the class bases on the specified size, - pixel format and pixel data. - - The width, in pixels, of the new . - The height, in pixels, of the new . - Integer that specifies the byte offset between the beginning - of one scan line and the next. This is usually (but not necessarily) - the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - multiplied by the width of the bitmap. The value passed to this parameter must - be a multiple of four.. - The PixelFormat enumeration for the new . - Pointer to an array of bytes that contains the pixel data. - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is invalid. - - or are less or equal zero. - - - - Initializes a new instance of the class bases on the specified size, - pixel format and pixel data. - - The width, in pixels, of the new . - The height, in pixels, of the new . - Integer that specifies the byte offset between the beginning - of one scan line and the next. This is usually (but not necessarily) - the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - multiplied by the width of the bitmap. The value passed to this parameter must - be a multiple of four.. - The PixelFormat enumeration for the new . - Array of bytes containing the bitmap data. - - Although this constructor supports creating images in both formats - - and , bitmaps - created in these formats are treated like any normal 32-bit RGBA and 64-bit RGBA - images respectively. Currently, there is no support for automatic premultiplying images in - . - - The operation failed. - is invalid. - - or are less or equal zero. - is null - - - - Initializes a new instance of the class bases on the specified size, - pixel format and pixel data. - - The width, in pixels, of the new . - The height, in pixels, of the new . - Integer that specifies the byte offset between the beginning - of one scan line and the next. This is usually (but not necessarily) - the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - multiplied by the width of the bitmap. The value passed to this parameter must - be a multiple of four.. - The color depth of the new - The type for the new . - Pointer to an array of bytes that contains the pixel data. - The operation failed. - is invalid. - - or are less or equal zero. - - - - Initializes a new instance of the class bases on the specified size, - pixel format and pixel data. - - The width, in pixels, of the new . - The height, in pixels, of the new . - Integer that specifies the byte offset between the beginning - of one scan line and the next. This is usually (but not necessarily) - the number of bytes in the pixel format (for example, 2 for 16 bits per pixel) - multiplied by the width of the bitmap. The value passed to this parameter must - be a multiple of four.. - The color depth of the new - The type for the new . - Array of bytes containing the bitmap data. - The operation failed. - is invalid. - - or are less or equal zero. - is null - - - - Initializes a new instance of the class. - - The operation failed. - The operation failed. - - - - Frees all managed and unmanaged ressources. - - - - - Converts a instance to a instance. - - A instance. - A new instance of initialized to . - - The explicit conversion from into Bitmap - allows to create an instance on the fly and use it as if - was a Bitmap. This way it can be directly used with a - PixtureBox for example without having to call any - conversion operations. - - - - - Converts a instance to a instance. - - A instance. - A new instance of initialized to . - - The explicit conversion from into - allows to create an instance on the fly to perform - image processing operations and converting it back. - - - - - Determines whether two specified objects have the same value. - - A or a null reference (Nothing in Visual Basic). - A or a null reference (Nothing in Visual Basic). - - true if the value of left is the same as the value of right; otherwise, false. - - - - - Determines whether two specified objects have different values. - - A or a null reference (Nothing in Visual Basic). - A or a null reference (Nothing in Visual Basic). - - true if the value of left is different from the value of right; otherwise, false. - - - - - Gets the bounds of this in the specified unit. - - One of the values indicating - the unit of measure for the bounding rectangle. - The that represents the bounds of this - , in the specified unit. - - - - Gets the specified property item from this . - - The ID of the property item to get. - The this method gets. - - - - Returns a thumbnail for this . - - The width, in pixels, of the requested thumbnail image. - The height, in pixels, of the requested thumbnail image. - Ignored. - Ignored. - A that represents the thumbnail. - - - - Returns a thumbnail for this , keeping aspect ratio. - defines the maximum width or height - of the thumbnail. - - Thumbnail square size. - When true HDR images are transperantly - converted to standard images. - The thumbnail in a new instance. - - - - Converts this instance to a instance. - - A new instance of initialized this instance. - - - - Returns an instance of , representing the scanline - specified by of this . - Since FreeImage bitmaps are always bottum up aligned, keep in mind that scanline 0 is the - bottom-most line of the image. - - Number of the scanline to retrieve. - An instance of representing the - th scanline. - - List of return-types of T: - - Color Depth / TypeResult Type - 1 () - 4 () - 8 () - 16 () - 16 - 555 () - 16 - 565 () - 24 () - 32 () - - - - - - - - - - - - - - - - FreeImageBitmap bitmap = new FreeImageBitmap(@"C:\Pictures\picture.bmp"); - if (bitmap.ColorDepth == 32) - { - Scanline<RGBQUAD> scanline = bitmap.GetScanline<RGBQUAD>(0); - foreach (RGBQUAD pixel in scanline) - { - Console.WriteLine(pixel); - } - } - - - - The bitmap's type or color depth are not supported. - - - is no valid value. - - - - - Returns an instance of , representing the scanline - specified by of this . - Since FreeImage bitmaps are always bottum up aligned, keep in mind that scanline 0 is the - bottom-most line of the image. - - Number of the scanline to retrieve. - An instance of representing the - th scanline. - - List of return-types of T: - - Color Depth / TypeResult Type - 1 () - 4 () - 8 () - 16 () - 16 - 555 () - 16 - 565 () - 24 () - 32 () - - - - - - - - - - - - - - - - FreeImageBitmap bitmap = new FreeImageBitmap(@"C:\Pictures\picture.bmp"); - if (bitmap.ColorDepth == 32) - { - Scanline<RGBQUAD> scanline = (Scanline<RGBQUAD>)bitmap.GetScanline(0); - foreach (RGBQUAD pixel in scanline) - { - Console.WriteLine(pixel); - } - } - - - - The type of the bitmap or color depth are not supported. - - - is no valid value. - - - - - Returns a pointer to the specified scanline. - Due to FreeImage bitmaps are bottum up, - scanline 0 is the most bottom line of the image. - - Number of the scanline. - Pointer to the scanline. - - - - Returns a list of structures, representing the scanlines of this . - Due to FreeImage bitmaps are bottum up, scanline 0 is the - bottom-most line of the image. - Each color depth has a different representing structure due to different memory layouts. - - - List of return-types of T: - - Color Depth / TypeResult Type of IEnmuerable<Scanline<T>> - 1 () - 4 () - 8 () - 16 () - 16 - 555 () - 16 - 565 () - 24 () - 32 () - - - - - - - - - - - - - - - - - Removes the specified property item from this . - - The ID of the property item to remove. - - - - This method rotates, flips, or rotates and flips this . - - A RotateFlipType member - that specifies the type of rotation and flip to apply to this . - - - - Copies the metadata from another . - - The bitmap to read the metadata from. - - is a null reference. - - - - - Copies the metadata from another using - the provided options. - - The bitmap to read the metadata from. - Specifies the way the metadata is copied. - - is a null reference. - - - - - Saves this to the specified file. - - A string that contains the name of the file to which - to save this . - is null or empty. - Saving the image failed. - - - - Saves this to the specified file in the specified format. - - A string that contains the name of the file to which - to save this . - An that specifies the format of the saved image. - is null or empty. - Saving the image failed. - - - - Saves this to the specified file in the specified format - using the specified saving flags. - - A string that contains the name of the file to which - to save this . - An that specifies the format of the saved image. - Flags to enable or disable plugin-features. - is null or empty. - Saving the image failed. - - - - Saves this to the specified stream in the specified format. - - The stream where this will be saved. - An that specifies the format of the saved image. - is a null reference. - Saving the image failed. - - - - Saves this to the specified stream in the specified format - using the specified saving flags. - - The stream where this will be saved. - An that specifies the format of the saved image. - Flags to enable or disable plugin-features. - is a null reference. - Saving the image failed. - - - - Adds a frame to the file specified in a previous call to the - method. - - - This instance has not been saved to a file using Save(...) before. - - - - Adds a frame to the file specified in a previous call to the method. - - The position at which the frame should be inserted. - - This instance has not yet been saved to a file using the Save(...) method. - is out of range. - - - - Adds a frame to the file specified in a previous call to the method. - - A that contains the frame to add. - - This instance has not yet been saved to a file using the Save(...) method. - - - - Adds a frame to the file specified in a previous call to the method. - - A that contains the frame to add. - The position at which the frame should be inserted. - - This instance has not yet been saved to a file using the Save(...) method. - is out of range. - - - - Adds a frame to the file specified. - - File to add this frame to. - is a null reference. - does not exist. - Saving the image has failed. - - - - Adds a frame to the file specified. - - File to add this frame to. - The position at which the frame should be inserted. - is a null reference. - does not exist. - Saving the image has failed. - is out of range. - - - - Adds a frame to the file specified using the specified parameters. - - File to add this frame to. - Format of the image. - Flags to enable or disable plugin-features. - Flags to enable or disable plugin-features. - is a null reference. - does not exist. - Saving the image has failed. - - - - Adds a frame to the file specified using the specified parameters. - - File to add this frame to. - The position at which the frame should be inserted. - Format of the image. - Flags to enable or disable plugin-features. - Flags to enable or disable plugin-features. - is a null reference. - does not exist. - Saving the image has failed. - is out of range. - - - - Selects the frame specified by the index. - - The index of the active frame. - - is out of range. - The operation failed. - The source of the bitmap is not available. - - - - - Creates a GDI bitmap object from this . - - A handle to the GDI bitmap object that this method creates. - - - - Creates a GDI bitmap object from this . - - A structure that specifies the background color. - This parameter is ignored if the bitmap is totally opaque. - A handle to the GDI bitmap object that this method creates. - - - - Returns the handle to an icon. - - A Windows handle to an icon with the same image as this . - - - - Creates a GDI bitmap object from this with the same - color depth as the primary device. - - A handle to the GDI bitmap object that this method creates. - - - - Gets the of the specified pixel in this . - - The x-coordinate of the pixel to retrieve. - The y-coordinate of the pixel to retrieve. - A structure that represents the color of the specified pixel. - The operation failed. - The type of this bitmap is not supported. - - - - Makes the default transparent color transparent for this . - - - - - Makes the specified color transparent for this . - - The structure that represents - the color to make transparent. - - This method is not implemented. - - - - Sets the of the specified pixel in this . - - The x-coordinate of the pixel to set. - The y-coordinate of the pixel to set. - A structure that represents the color - to assign to the specified pixel. - The operation failed. - The type of this bitmap is not supported. - - - - Sets the resolution for this . - - The horizontal resolution, in dots per inch, of this . - The vertical resolution, in dots per inch, of this . - - - - This function is not yet implemented. - - - This method is not implemented. - - - - This function is not yet implemented. - - - This method is not implemented. - - - - This function is not yet implemented. - - - This method is not implemented. - - - - Converts this into a different color depth. - The parameter specifies color depth, greyscale conversion - and palette reorder. - Adding the flag - will first perform a convesion to greyscale. This can be done with any target - color depth. - Adding the flag - will allow the algorithm to reorder the palette. This operation will not be performed to - non-greyscale images to prevent data loss by mistake. - - A bitfield containing information about the conversion - to perform. - Returns true on success, false on failure. - - - - Converts this to - initializing a new instance. - In case source and destination type are the same, the operation fails. - An error message can be catched using the 'Message' event. - - Destination type. - True to scale linear, else false. - Returns true on success, false on failure. - - - - Converts this to . - In case source and destination type are the same, the operation fails. - An error message can be catched using the 'Message' event. - - Destination type. - True to scale linear, else false. - The converted instance. - - - - Converts this into a different color depth initializing - a new instance. - The parameter specifies color depth, greyscale conversion - and palette reorder. - Adding the flag will - first perform a convesion to greyscale. This can be done with any target color depth. - Adding the flag will - allow the algorithm to reorder the palette. This operation will not be performed to - non-greyscale images to prevent data loss by mistake. - - A bitfield containing information about the conversion - to perform. - The converted instance. - - - - Rescales this to the specified size using the - specified filter. - - The Size structure that represent the - size of the new . - Filter to use for resizing. - Returns true on success, false on failure. - - - - Rescales this to the specified size using the - specified filter. - - Width of the new . - Height of the new . - Filter to use for resizing. - Returns true on success, false on failure. - - - - Rescales this to the specified size using the - specified filter initializing a new instance. - - The Size structure that represent the - size of the new . - Filter to use for resizing. - The rescaled instance. - - - - Rescales this to the specified size using the - specified filter initializing a new instance. - - Width of the new . - Height of the new . - Filter to use for resizing. - The rescaled instance. - - - - Enlarges or shrinks this selectively per side and fills - newly added areas with the specified background color. - See for further details. - - The type of the specified color. - The number of pixels, the image should be enlarged on its left side. - Negative values shrink the image on its left side. - The number of pixels, the image should be enlarged on its top side. - Negative values shrink the image on its top side. - The number of pixels, the image should be enlarged on its right side. - Negative values shrink the image on its right side. - The number of pixels, the image should be enlarged on its bottom side. - Negative values shrink the image on its bottom side. - The color, the enlarged sides of the image should be filled with. - true on success, false on failure. - - - - Enlarges or shrinks this selectively per side and fills - newly added areas with the specified background color. - See for further details. - - The type of the specified color. - The number of pixels, the image should be enlarged on its left side. - Negative values shrink the image on its left side. - The number of pixels, the image should be enlarged on its top side. - Negative values shrink the image on its top side. - The number of pixels, the image should be enlarged on its right side. - Negative values shrink the image on its right side. - The number of pixels, the image should be enlarged on its bottom side. - Negative values shrink the image on its bottom side. - The color, the enlarged sides of the image should be filled with. - Options that affect the color search process for palletized images. - true on success, false on failure. - - - - Enlarges or shrinks this selectively per side and fills - newly added areas with the specified background color returning a new instance. - See for further details. - - The type of the specified color. - The number of pixels, the image should be enlarged on its left side. - Negative values shrink the image on its left side. - The number of pixels, the image should be enlarged on its top side. - Negative values shrink the image on its top side. - The number of pixels, the image should be enlarged on its right side. - Negative values shrink the image on its right side. - The number of pixels, the image should be enlarged on its bottom side. - Negative values shrink the image on its bottom side. - The color, the enlarged sides of the image should be filled with. - The enlarged instance. - - - - Enlarges or shrinks this selectively per side and fills - newly added areas with the specified background color returning a new instance. - See for further details. - - The type of the specified color. - The number of pixels, the image should be enlarged on its left side. - Negative values shrink the image on its left side. - The number of pixels, the image should be enlarged on its top side. - Negative values shrink the image on its top side. - The number of pixels, the image should be enlarged on its right side. - Negative values shrink the image on its right side. - The number of pixels, the image should be enlarged on its bottom side. - Negative values shrink the image on its bottom side. - The color, the enlarged sides of the image should be filled with. - Options that affect the color search process for palletized images. - The enlarged instance. - - - - Quantizes this from 24 bit to 8bit creating a new - palette with the specified using the specified - . - - The color reduction algorithm to be used. - Size of the desired output palette. - Returns true on success, false on failure. - - - - Quantizes this from 24 bit to 8bit creating a new - palette with the specified using the specified - and the specified - palette up to the - specified length. - - The color reduction algorithm to be used. - Size of the desired output palette. - The provided palette. - Returns true on success, false on failure. - - - - Quantizes this from 24 bit to 8bit creating a new - palette with the specified using the specified - and the specified - palette up to the - specified length. - - The color reduction algorithm to be used. - Size of the desired output palette. - Size of the provided palette of ReservePalette. - The provided palette. - Returns true on success, false on failure. - - - - Quantizes this from 24 bit to 8bit creating a new - palette with the specified using the specified - and the specified - palette up to the - specified length. - - The color reduction algorithm to be used. - Size of the desired output palette. - Size of the provided palette of ReservePalette. - The provided palette. - Returns true on success, false on failure. - - - - Quantizes this from 24 bit, using the specified - initializing a new 8 bit instance with the - specified . - - The color reduction algorithm to be used. - Size of the desired output palette. - The quantized instance. - - - - Quantizes this from 24 bit, using the specified - and palette - initializing a new 8 bit instance with the specified . - - The color reduction algorithm to be used. - Size of the desired output palette. - The provided palette. - The quantized instance. - - - - Quantizes this from 24 bit, using the specified - and up to - entries from palette initializing - a new 8 bit instance with the specified . - - The color reduction algorithm to be used. - Size of the desired output palette. - Size of the provided palette. - The provided palette. - The quantized instance. - - - - Quantizes this from 24 bit, using the specified - and up to - entries from palette initializing - a new 8 bit instance with the specified . - - The color reduction algorithm to be used. - Size of the desired output palette. - Size of the provided palette. - The provided palette. - The quantized instance. - - - - Converts a High Dynamic Range image to a 24-bit RGB image using a global - operator based on logarithmic compression of luminance values, imitating - the human response to light. - - A gamma correction that is applied after the tone mapping. - A value of 1 means no correction. - Scale factor allowing to adjust the brightness of the output image. - Returns true on success, false on failure. - - - - Converts a High Dynamic Range image to a 24-bit RGB image using a global operator inspired - by photoreceptor physiology of the human visual system. - - Controls the overall image intensity in the range [-8, 8]. - Controls the overall image contrast in the range [0.3, 1.0[. - Returns true on success, false on failure. - - - - Apply the Gradient Domain High Dynamic Range Compression to a RGBF image and convert to 24-bit RGB. - - Color saturation (s parameter in the paper) in [0.4..0.6] - Atenuation factor (beta parameter in the paper) in [0.8..0.9] - Returns true on success, false on failure. - - - - This method rotates a 1-, 4-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - For 1- and 4-bit images, rotation is limited to angles whose value is an integer - multiple of 90. - - The angle of rotation. - Returns true on success, false on failure. - - - - This method rotates a 1-, 4-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - For 1- and 4-bit images, rotation is limited to angles whose value is an integer - multiple of 90. - - The type of the color to use as background. - The angle of rotation. - The color used used to fill the bitmap's background. - Returns true on success, false on failure. - - - - Rotates this by the specified angle initializing a new instance. - For 1- and 4-bit images, rotation is limited to angles whose value is an integer - multiple of 90. - - The type of the color to use as background. - The angle of rotation. - The color used used to fill the bitmap's background. - The rotated instance. - - - - Rotates this by the specified angle initializing a new instance. - For 1- and 4-bit images, rotation is limited to angles whose value is an integer - multiple of 90. - - The angle of rotation. - The rotated instance. - - - - This method performs a rotation and / or translation of an 8-bit greyscale, - 24- or 32-bit image, using a 3rd order (cubic) B-Spline. - - The angle of rotation. - Horizontal image translation. - Vertical image translation. - Rotation center x-coordinate. - Rotation center y-coordinate. - When true the irrelevant part of the image is set to a black color, - otherwise, a mirroring technique is used to fill irrelevant pixels. - Returns true on success, false on failure. - - - - This method performs a rotation and / or translation of an 8-bit greyscale, - 24- or 32-bit image, using a 3rd order (cubic) B-Spline initializing a new instance. - - The angle of rotation. - Horizontal image translation. - Vertical image translation. - Rotation center x-coordinate. - Rotation center y-coordinate. - When true the irrelevant part of the image is set to a black color, - otherwise, a mirroring technique is used to fill irrelevant pixels. - The rotated instance. - - - - Perfoms an histogram transformation on a 8-, 24- or 32-bit image. - - The lookup table (LUT). - It's size is assumed to be 256 in length. - The color channel to be transformed. - Returns true on success, false on failure. - - - - Performs gamma correction on a 8-, 24- or 32-bit image. - - The parameter represents the gamma value to use (gamma > 0). - A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it. - Returns true on success, false on failure. - - - - Adjusts the brightness of a 8-, 24- or 32-bit image by a certain amount. - - A value 0 means no change, - less than 0 will make the image darker and greater than 0 will make the image brighter. - Returns true on success, false on failure. - - - - Adjusts the contrast of a 8-, 24- or 32-bit image by a certain amount. - - A value 0 means no change, - less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image. - Returns true on success, false on failure. - - - - Inverts each pixel data. - - Returns true on success, false on failure. - - - - Computes the image histogram. - - Channel to compute from. - Array of integers containing the histogram. - Returns true on success, false on failure. - - - - Retrieves the red, green, blue or alpha channel of a 24- or 32-bit image. - - The color channel to extract. - The color channel in a new instance. - - - - Insert a 8-bit dib into a 24- or 32-bit image. - Both images must have to same width and height. - - The to insert. - The color channel to replace. - Returns true on success, false on failure. - - - - Retrieves the real part, imaginary part, magnitude or phase of a complex image. - - The color channel to extract. - The color channel in a new instance. - - - - Set the real or imaginary part of a complex image. - Both images must have to same width and height. - - The to insert. - The color channel to replace. - Returns true on success, false on failure. - - - - Copy a sub part of this . - - The subpart to copy. - The sub part in a new instance. - - - - Copy a sub part of this . - - Specifies the left position of the cropped rectangle. - Specifies the top position of the cropped rectangle. - Specifies the right position of the cropped rectangle. - Specifies the bottom position of the cropped rectangle. - The sub part in a new instance. - - - - Alpha blend or combine a sub part image with this . - The bit depth of must be greater than or equal to the bit depth this instance. - - The to paste into this instance. - Specifies the left position of the sub image. - Specifies the top position of the sub image. - alpha blend factor. - The source and destination images are alpha blended if alpha=0..255. - If alpha > 255, then the source image is combined to the destination image. - Returns true on success, false on failure. - - - - Alpha blend or combine a sub part image with tthis . - The bit depth of must be greater than or equal to the bit depth this instance. - - The to paste into this instance. - Specifies the position of the sub image. - alpha blend factor. - The source and destination images are alpha blended if alpha=0..255. - If alpha > 255, then the source image is combined to the destination image. - Returns true on success, false on failure. - - - - This method composite a transparent foreground image against a single background color or - against a background image. - In case is false and - and - are null, a checkerboard will be used as background. - - When true the background of this instance is used - if it contains one. - Backgroundcolor used in case is false - and is not null. - Background used in case - is false and is a null reference. - Returns true on success, false on failure. - - - - Applies the alpha value of each pixel to its color components. - The aplha value stays unchanged. - Only works with 32-bits color depth. - - Returns true on success, false on failure. - - - - Solves a Poisson equation, remap result pixels to [0..1] and returns the solution. - - Number of cycles in the multigrid algorithm (usually 2 or 3) - Returns true on success, false on failure. - - - - Adjusts an image's brightness, contrast and gamma as well as it may - optionally invert the image within a single operation. - - Percentage brightness value where -100 <= brightness <= 100. - A value of 0 means no change, less than 0 will make the image darker and greater - than 0 will make the image brighter. - Percentage contrast value where -100 <= contrast <= 100. - A value of 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - Gamma value to be used for gamma correction. - A value of 1.0 leaves the image alone, less than one darkens it, - and greater than one lightens it. - This parameter must not be zero or smaller than zero. - If so, it will be ignored and no gamma correction will be performed on the image. - If set to true, the image will be inverted. - Returns true on success, false on failure. - - - - Applies color mapping for one or several colors on a 1-, 4- or 8-bit - palletized or a 16-, 24- or 32-bit high color image. - - Array of colors to be used as the mapping source. - Array of colors to be used as the mapping destination. - If true, 32-bit images and colors are treated as 24-bit. - If true, source and destination colors are swapped, that is, - each destination color is also mapped to the corresponding source color. - The total number of pixels changed. - - or is a null reference. - - - has a different length than . - - - - - Swaps two specified colors on a 1-, 4- or 8-bit palletized - or a 16-, 24- or 32-bit high color image. - - One of the two colors to be swapped. - The other of the two colors to be swapped. - If true, 32-bit images and colors are treated as 24-bit. - The total number of pixels changed. - - - - Applies palette index mapping for one or several indices - on a 1-, 4- or 8-bit palletized image. - - Array of palette indices to be used as the mapping source. - Array of palette indices to be used as the mapping destination. - The number of palette indices to be mapped. This is the size of both - srcindices and dstindices - If true, source and destination palette indices are swapped, that is, - each destination index is also mapped to the corresponding source index. - The total number of pixels changed. - - or is a null reference. - - - has a different length than . - - - - - Swaps two specified palette indices on a 1-, 4- or 8-bit palletized image. - - One of the two palette indices to be swapped. - The other of the two palette indices to be swapped. - The total number of pixels changed. - - - - Sets all pixels of this to the specified color. - See for further details. - - The type of the specified color. - The color to fill this with. - true on success, false on failure. - - - - Sets all pixels of this to the specified color. - See for further details. - - The type of the specified color. - The color to fill this with. - Options that affect the color search process for palletized images. - true on success, false on failure. - - - - Creates a new ICC-Profile. - - The data of the new ICC-Profile. - The new ICC-Profile of the bitmap. - is a null reference. - - - - Creates a new ICC-Profile. - - The data of the new ICC-Profile. - The number of bytes of to use. - The new ICC-Profile of the bitmap. - is null. - - - - Determines whether this and the specified instances are the same. - - The object to test. - true if this instance is the same - or if both are null references; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Returns a value that indicates whether the pixel format for this contains alpha information. - - The to test. - true if pixfmt contains alpha information; otherwise, false. - - - - Returns a value that indicates whether the pixel format is 32 bits per pixel. - - The to test. - true if pixfmt is canonical; otherwise, false. - - - - Returns a value that indicates whether the pixel format is 64 bits per pixel. - - The enumeration to test. - true if pixfmt is extended; otherwise, false. - - - - Creates a from a Windows handle to an icon. - - A handle to an icon. - The that this method creates. - - - - Creates a from the specified Windows resource. - - A handle to an instance of the executable - file that contains the resource. - A string containing the name of the resource bitmap. - The that this method creates. - - - - Creates a from the specified file. - - A string that contains the name of the file - from which to create the . - The this method creates. - - - - Creates a from the specified file - using embedded color management information in that file. - - A string that contains the - name of the file from which to create the . - Ignored. - The this method creates. - - - - Creates a from a handle to a GDI bitmap. - - The GDI bitmap handle from which to create the . - The this method creates. - - - - Creates a from a handle to a GDI bitmap and a handle to a GDI palette. - - The GDI bitmap handle from which to create the . - Ignored. - The this method creates. - - - - Frees a bitmap handle. - - Handle to a bitmap. - true on success, false on failure. - - - - Creates a from the specified data stream. - - A that contains the data for this . - The this method creates. - - - - Creates a from the specified data stream. - - A that contains the data for this . - Ignored. - The this method creates. - - - - Creates a from the specified data stream. - - A that contains the data for this . - Ignored. - Ignored. - The this method creates. - - - - Returns the color depth, in number of bits per pixel, - of the specified pixel format. - - The member that specifies - the format for which to find the size. - The color depth of the specified pixel format. - - - - Performs a lossless rotation or flipping on a JPEG file. - - Source file. - Destination file; can be the source file; will be overwritten. - The operation to apply. - To avoid lossy transformation, you can set the perfect parameter to true. - Returns true on success, false on failure. - - - - Performs a lossless crop on a JPEG file. - - Source filename. - Destination filename. - Specifies the cropped rectangle. - Returns true on success, false on failure. - - or is null. - - - does not exist. - - - - - Performs a lossless crop on a JPEG file. - - Source filename. - Destination filename. - Specifies the left position of the cropped rectangle. - Specifies the top position of the cropped rectangle. - Specifies the right position of the cropped rectangle. - Specifies the bottom position of the cropped rectangle. - Returns true on success, false on failure. - - or is null. - - - does not exist. - - - - - Converts a X11 color name into a corresponding RGB value. - - Name of the color to convert. - Red component. - Green component. - Blue component. - Returns true on success, false on failure. - is null. - - - - Converts a SVG color name into a corresponding RGB value. - - Name of the color to convert. - Red component. - Green component. - Blue component. - Returns true on success, false on failure. - is null. - - - - Creates a lookup table to be used with AdjustCurve() which - may adjusts brightness and contrast, correct gamma and invert the image with a - single call to AdjustCurve(). - - Output lookup table to be used with AdjustCurve(). - The size of is assumed to be 256. - Percentage brightness value where -100 <= brightness <= 100. - A value of 0 means no change, less than 0 will make the image darker and greater - than 0 will make the image brighter. - Percentage contrast value where -100 <= contrast <= 100. - A value of 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - Gamma value to be used for gamma correction. - A value of 1.0 leaves the image alone, less than one darkens it, - and greater than one lightens it. - If set to true, the image will be inverted. - The number of adjustments applied to the resulting lookup table - compared to a blind lookup table. - is null. - is not 256. - - - - Adds a specified frame to the file specified using the specified parameters. - Use this method to save selected frames from an to a multiple-frame image. - - File to add this frame to. - A that contains the frame to add. - Format of the image. - Flags to enable or disable plugin-features. - Flags to enable or disable plugin-features. - - or is null. - - does not exist. - Saving the image failed. - - - - Adds a specified frame to the file specified using the specified parameters. - Use this method to save selected frames from an image to a multiple-frame image. - - File to add this frame to. - A that contains the frame to add. - The position of the inserted frame. - Format of the image. - Flags to enable or disable plugin-features. - Flags to enable or disable plugin-features. - - or is null. - - does not exist. - Saving the image failed. - is out of range. - - - - Returns a new instance of the class which - has no public accessible constructor. - - A new instace of . - - - - Throws an exception in case the instance has already been disposed. - - - - - Tries to replace the wrapped with a new one. - In case the new dib is null or the same as the already - wrapped one, nothing will be changed and the result will - be false. - Otherwise the wrapped will be unloaded and replaced. - - The new dib. - Returns true on success, false on failure. - - - - Unloads currently wrapped or unlocks the locked page - in case it came from a multipaged bitmap. - - - - - Informs the runtime about unmanaged allocoted memory. - - - - - Opens the stream and reads the number of available pages. - Then loads the first page to this instance. - - - - - Creates a deep copy of this . - - A deep copy of this . - - - - Performs application-defined tasks associated with freeing, - releasing, or resetting unmanaged resources. - - - - - Performs application-defined tasks associated with freeing, - releasing, or resetting unmanaged resources. - - If true managed ressources are released. - - - - Retrieves an object that can iterate through the individual scanlines in this . - - An for the . - The bitmaps's type is not supported. - - - - Type of the bitmap. - - - - - Number of palette entries. - - - - - The number of unique colors actually used by the bitmap. This might be different from - what ColorsUsed returns, which actually returns the palette size for palletised images. - Works for FIT_BITMAP type bitmaps only. - - - - - The size of one pixel in the bitmap in bits. - - - - - Width of the bitmap in pixel units. - - - - - Height of the bitmap in pixel units. - - - - - Returns the width of the bitmap in bytes, rounded to the next 32-bit boundary. - - - - - Size of the bitmap in memory. - - - - - Returns a structure that represents the palette of a FreeImage bitmap. - - is false. - - - - Gets whether the bitmap is RGB 555. - - - - - Gets whether the bitmap is RGB 565. - - - - - Gets the horizontal resolution, in pixels per inch, of this . - - - - - Gets the vertical resolution, in pixels per inch, of this . - - - - - Returns the structure of this . - - - - - Returns the structure of a this . - - - - - Investigates the color type of this - by reading the bitmaps pixel bits and analysing them. - - - - - Bit pattern describing the red color component of a pixel in this . - - - - - Bit pattern describing the green color component of a pixel in this . - - - - - Bit pattern describing the blue color component of a pixel in this . - - - - - Number of transparent colors in a palletised . - - - - - Get or sets transparency table of this . - - - - - Gets or sets whether this is transparent. - - - - - Gets whether this has a file background color. - - - - - Gets or sets the background color of this . - In case the value is null, the background color is removed. - - Get: There is no background color available. - Set: Setting background color failed. - - - - Pointer to the data-bits of this . - - - - - Width, in bytes, of this . - - - - - Pointer to the scanline of the top most pixel row of this . - - - - - Width, in bytes, of this . - In case this is top down Stride will be positive, else negative. - - - - - Gets attribute flags for the pixel data of this . - - - - - Gets the width and height of this . - - - - - Gets the pixel format for this . - - - - - Gets IDs of the property items stored in this . - - - - - Gets all the property items (pieces of metadata) stored in this . - - - - - Gets the format of this . - - - - - Gets the width and height, in pixels, of this . - - - - - Gets or sets an object that provides additional data about the . - - - - - Gets whether this has been disposed. - - - - - Gets a new instance of a metadata representing class. - - - - - Gets or sets the comment of this . - Supported formats are JPEG, PNG and GIF. - - - - - Returns whether this has a palette. - - - - - Gets or sets the entry used as transparent color in this . - Only works for 1-, 4- and 8-bpp. - - - - - Gets the number of frames in this . - - - - - Gets the ICCProfile structure of this . - - - - - Gets the format of the original image in case - this was loaded from a file or stream. - - - - - Gets the encapsulated FIBITMAP. - - - - - Helper class to store informations for . - - - - - Class handling non-bitmap related functions. - - - - - Internal callback - - - - - Gets a value indicating if the FreeImage DLL is available or not. - - - - - Internal errors in FreeImage generate a logstring that can be - captured by this event. - - - - - Gets a string containing the current version of the library. - - - - - Gets a string containing a standard copyright message. - - - - - Gets whether the platform is using Little Endian. - - - - - Class representing a FreeImage format. - - - - - Initializes a new instance of this class. - - The FreeImage format to wrap. - - - - Checks whether this plugin can save a bitmap in the desired data type. - - The desired image type. - True if this plugin can save bitmaps as the desired type, else false. - - - - Checks whether this plugin can save bitmaps in the desired bit depth. - - The desired bit depth. - True if this plugin can save bitmaps in the desired bit depth, else false. - - - - Checks whether an extension is valid for this format. - - The desired extension. - True if the extension is valid for this format, false otherwise. - - - - Checks whether an extension is valid for this format. - - The desired extension. - The string comparison type. - True if the extension is valid for this format, false otherwise. - - - - Checks whether a filename is valid for this format. - - The desired filename. - True if the filename is valid for this format, false otherwise. - - - - Checks whether a filename is valid for this format. - - The desired filename. - The string comparison type. - True if the filename is valid for this format, false otherwise. - - - - Gets a descriptive string that describes the bitmap formats - this plugin can read and/or write. - - A descriptive string that describes the bitmap formats. - - - - Gets the format of this instance. - - - - - Gets or sets whether this plugin is enabled. - - - - - Gets a string describing the format. - - - - - Gets a comma-delimited file extension list describing the bitmap formats - this plugin can read and/or write. - - - - - Gets a descriptive string that describes the bitmap formats - this plugin can read and/or write. - - - - - Returns a regular expression string that can be used by - a regular expression engine to identify the bitmap. - FreeImageQt makes use of this function. - - - - - Gets whether this plugin can load bitmaps. - - - - - Gets whether this plugin can save bitmaps. - - - - - Gets whether this plugin can load or save an ICC profile. - - - - - Internal class wrapping stream io functions. - - - FreeImage can read files from a disk or a network drive but also allows the user to - implement their own loading or saving functions to load them directly from an ftp or web - server for example. - - In .NET streams are a common way to handle data. The FreeImageStreamIO class handles - the loading and saving from and to streams. It implements the funtions FreeImage needs - to load data from an an arbitrary source. - - The class is for internal use only. - - - - - structure that can be used to read from streams via - . - - - - - Initializes a new instances which can be used to - create a FreeImage compatible structure. - - - - - Reads the requested data from the stream and writes it to the given address. - - - - - Reads the given data and writes it into the stream. - - - - - Moves the streams position. - - - - - Returns the streams current position - - - - - Provides additional information specific for GIF files. This class cannot be inherited. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Base class that represents a collection of all tags contained in a metadata model. - - - The MetedataModel class is an abstract base class, which is inherited by - several derived classes, one for each existing metadata model. - - - - - Handle to the encapsulated FreeImage-bitmap. - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - is null. - - - - Adds new tag to the bitmap or updates its value in case it already exists. - will be used as key. - - The tag to add or update. - Returns true on success, false on failure. - - is null. - - The tags model differs from this instances model. - - - - Adds a list of tags to the bitmap or updates their values in case they already exist. - will be used as key. - - A list of tags to add or update. - Returns the number of successfully added tags. - - is null. - - - - Removes the specified tag from the bitmap. - - The key of the tag. - Returns true on success, false on failure. - - is null. - - - - Destroys the metadata model - which will remove all tags of this model from the bitmap. - - Returns true on success, false on failure. - - - - Returns the specified metadata tag. - - The key of the tag. - The metadata tag. - - is null. - - - - Returns whether the specified tag exists. - - The key of the tag. - True in case the tag exists, else false. - - is null. - - - - Returns the tag at the given index. - - Index of the tag to return. - The tag at the given index. - - - - Retrieves an object that can iterate through the individual MetadataTags in this MetadataModel. - - An for the - . - - - - Searches for a pattern in each metadata tag and returns the result as a list. - - The regular expression to use for the search. - A bitfield that controls which fields should be searched in. - A list containing all found metadata tags. - - is null. - - is empty. - - - - Returns the value of the specified tag. - - Type of the tag's data. - The key of the tag. - The value of the specified tag. - - - - Returns an array containing the data of the specified tag. - - The type of the tag's data. - The key of the tag. - An array containing the data of the specified tag. - - - - Returns the string contained by the specified tag. - - The key of the tag. - The string contained by the specified tag. - - - - Returns an array containg the data of the specified tag - as unsigned 32bit integer. - - The key of the tag. - An array containg the data of the specified tag - as unsigned 32bit integer. - - - - Returns the value of the tag as unsigned 32bit integer. - - The key of the tag. - The value of the tag as unsigned 32bit integer. - - - - Sets the value of the specified tag. - - The type of the tag's data. - The key of the tag. - The new value of the specified tag or null. - - - - Sets the value of the specified tag. - - The key of the tag. - The new value of the specified tag or null. - - - - Sets the value of the specified tag as undefined. - - The key of the tag. - The new value of the specified tag or null. - - - - Returns the equivalent for the - specified . - - The string containing the . - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The to convert. - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The string containing the . - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The to convert. - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The string containing the . - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The to convert. - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The string containing the . - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The to convert. - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The string containing the . - The equivalent for the - specified . - - - - Returns the equivalent for the - specified . - - The to convert. - The equivalent for the - specified . - - - - Converts the model of the MetadataModel object to its equivalent string representation. - - The string representation of the value of this instance. - - - - Retrieves the datamodel that this instance represents. - - - - - Returns a list of all metadata tags this instance represents. - - - - - Returns the metadata tag at the given index. This operation is slow when accessing all tags. - - Index of the tag. - The metadata tag. - - is greater or equal Count - or index is less than zero. - - - - Returns the number of metadata tags this instance represents. - - - - - Returns whether this model exists in the bitmaps metadata structure. - - - - - Specified different unit types. - - - - - No or unknown type. - - - - - Kilometers per hour. - - - - - Miles per hour. - - - - - Knots. - - - - - Specifies different direction types. - - - - - No or unknown direction type. - - - - - True direction. - - - - - Magnatic direction. - - - - - Specifies the type of a latitude value. - - - - - No or unknown type. - - - - - North. - - - - - South. - - - - - Specifies the type of a longitude value. - - - - - No or unknown type. - - - - - East. - - - - - West. - - - - - Specifies different altitude types. - - - - - No or unknown type. - - - - - East. - - - - - West. - - - - - Specifies interoperability types. - - - - - No or unknown type. - - - - - 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. - - - - - Indicates a file conforming to DCF thumbnail file stipulated by Design - rule for Camera File System. - - - - - Specifies orientation of images. - - - - - Undefinied orientation. - - - - - TopLeft. - - - - - TopRight. - - - - - BottomRight. - - - - - BottomLeft. - - - - - LeftTop. - - - - - RightTop. - - - - - RightBottom. - - - - - LeftBottom. - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the width of the entire canvas area, that each page is displayed in. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the height of the entire canvas area, that each page is displayed in. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the global palette of the GIF image. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of replays for the animation. - Use 0 (zero) to specify an infinte number of replays. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the horizontal offset within the logical canvas area, this frame is to be displayed at. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the vertical offset within the logical canvas area, this frame is to be displayed at. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a flag to supress saving the dib's attached palette - (making it use the global palette). The local palette is the palette used by a page. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating whether the image is interlaced. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the amout of time in milliseconds this frame is to be displayed. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets this frame's disposal method. Generally, this method defines, how to - remove or replace a frame when the next frame has to be drawn. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Initializes a new instance of the class - with the specified . - - A reference to a instance. - - - - Creates a global palette for the GIF image, intialized with all entries of the - current local palette. - The property will be set to true when - invoking this method. This effectively enables the newly created global palette. - - - The image does not have a palette. - - - - - Creates a global palette for the GIF image with the specified size, intialized - with the first entries of the current local palette. - The property will be set to true when - invoking this method. This effectively enables the newly created global palette. - - The size of the newly created global palette. - - is a null reference. - - - - Creates a global palette for the GIF image, intialized with the entries - of the specified palette. - The property will be set to true when - invoking this method. This effectively enables the newly created global palette. - - The palette that contains the initial values for - the newly created global palette. - - is a null reference. - - - - Creates a global palette for the GIF image with the specified size, intialized - with the first entries of the specified palette. - The property will be set to true when - invoking this method. This effectively enables the newly created global palette. - - The palette that contains the initial values for - the newly created global palette. - The size of the newly created global palette. - - is a null reference. - - - - Gets or sets a value indicating whether this frame uses the - GIF image's global palette. If set to false, this - frame uses its local palette. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Class handling metadata of a FreeImage bitmap. - - - - - Initializes a new instance based on the specified , - showing all known models. - - Handle to a FreeImage bitmap. - - - - Initializes a new instance based on the specified , - showing or hiding empry models. - - Handle to a FreeImage bitmap. - When true, empty metadata models - will be hidden until a tag to this model is added. - - - - Adds new tag to the bitmap or updates its value in case it already exists. - will be used as key. - - The tag to add or update. - Returns true on success, false on failure. - - is null. - - - - Retrieves an object that can iterate through the individual - MetadataModels - in this . - - An for this . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Gets or sets the of the specified type. - In case the getter returns null the model is not contained - by the list. - null can be used calling the setter to destroy the model. - - Type of the model. - The object of the specified type. - - - - Gets or sets the at the specified index. - In case the getter returns null the model is not contained - by the list. - null can be used calling the setter to destroy the model. - - Index of the within - this instance. - The - object at the specified index. - - - - Returns a list of all visible - MetadataModels. - - - - - Returns the number of visible - MetadataModels. - - - - - Gets or sets whether empty - MetadataModels are hidden. - - - - - Class representing own FreeImage-Plugins. - - - FreeImages itself is plugin based. Each supported format is integrated by a seperat plugin, - that handles loading, saving, descriptions, identifing ect. - And of course the user can create own plugins and use them in FreeImage. - To do that the above mentioned predefined methodes need to be implemented. - - The class below handles the creation of such a plugin. The class itself is abstract - as well as some core functions that need to be implemented. - The class can be used to enable or disable the plugin in FreeImage after regististration or - retrieve the formatid, assigned by FreeImage. - The class handles the callback functions, garbage collector and pointer operation to make - the implementation as user friendly as possible. - - How to: - There are two functions that need to be implemented: - and - . - is used by the constructor - of the abstract class. FreeImage wants a list of the implemented functions. Each function is - represented by a function pointer (a .NET ). In case a function - is not implemented FreeImage receives an empty delegate). To tell the constructor - which functions have been implemented the information is represented by a disjunction of - . - - For example: - return MethodFlags.LoadProc | MethodFlags.SaveProc; - - The above statement means that LoadProc and SaveProc have been implemented by the user. - Keep in mind, that each function has a standard implementation that has static return - values that may cause errors if listed in - without a real implementation. - - is used by some checks of FreeImage and - must be implemented. for example can be - implemented if the plugin supports reading, but it doesn't have to, the plugin could only - be used to save an already loaded bitmap in a special format. - - - - - Struct containing function pointers. - - - - - Delegate for register callback by FreeImage. - - - - - The format id assiged to the plugin. - - - - - When true the plugin was registered successfully else false. - - - - - A copy of the functions used to register. - - - - - Function that returns a bitfield containing the - implemented methods. - - Bitfield of the implemented methods. - - - - Implementation of FormatProc - - A string containing the plugins format. - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - Function that can be implemented. - - - - - 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. - - - - - Reads from an unmanaged stream. - - - - - Reads a single byte from an unmanaged stream. - - - - - Writes to an unmanaged stream. - - - - - Writes a single byte to an unmanaged stream. - - - - - Seeks in an unmanaged stream. - - - - - Retrieves the position of an unmanaged stream. - - - - - Gets or sets if the plugin is enabled. - - - - - Gets if the plugin was registered successfully. - - - - - Gets the FreeImage assigned to this plugin. - - - - - MethodFlags defines values to fill a bitfield telling which - functions have been implemented by a plugin. - - - - - No mothods implemented. - - - - - DescriptionProc has been implemented. - - - - - ExtensionListProc has been implemented. - - - - - RegExprProc has been implemented. - - - - - OpenProc has been implemented. - - - - - CloseProc has been implemented. - - - - - PageCountProc has been implemented. - - - - - PageCapabilityProc has been implemented. - - - - - LoadProc has been implemented. - - - - - SaveProc has been implemented. - - - - - ValidateProc has been implemented. - - - - - MimeProc has been implemented. - - - - - SupportsExportBPPProc has been implemented. - - - - - SupportsExportTypeProc has been implemented. - - - - - SupportsICCProfilesProc has been implemented. - - - - - Represents unmanaged memory, containing an array of a given structure. - - Structuretype represented by the instance. - - and can not be marshalled. - - Use instead of and - instead of . - - - - - Baseaddress of the wrapped memory. - - - - - Number of elements being wrapped. - - - - - Size, in bytes, of each element. - - - - - Array of T containing a single element. - The array is used as a workaround, because there are no pointer for generic types. - - - - - Pointer to the element of buffer. - - - - - Handle for pinning buffer. - - - - - Indicates whether the wrapped memory is handled like a bitfield. - - - - - Indicates whther the wrapped memory is handles like 4-bit blocks. - - - - - An object that can be used to synchronize access to the . - - - - - Initializes a new instance. - - - - - Initializes a new instance of the class. - - Address of the memory block. - Length of the array. - - is null. - - is less or equal zero. - - The type is not supported. - - - - Initializes a new instance of the class. - - Address of the memory block. - Length of the array. - - is null. - - is less or equal zero. - - The type is not supported. - - - - Frees the allocated . - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Gets the value at the specified position. - - A 32-bit integer that represents the position - of the array element to get. - The value at the specified position. - - is outside the range of valid indexes - for the unmanaged array. - - - - Sets a value to the element at the specified position. - - The new value for the specified element. - A 32-bit integer that represents the - position of the array element to set. - - is outside the range of valid indexes - for the unmanaged array. - - - - Gets the values at the specified position and length. - - A 32-bit integer that represents the position - of the array elements to get. - A 32-bit integer that represents the length - of the array elements to get. - The values at the specified position and length. - - is outside the range of valid indexes - for the unmanaged array or is greater than the number of elements - from to the end of the unmanaged array. - - - - Sets the values at the specified position. - - An array containing the new values for the specified elements. - A 32-bit integer that represents the position - of the array elements to set. - - is a null reference (Nothing in Visual Basic). - - is outside the range of valid indexes - for the unmanaged array or is greater than the number of elements - from to the end of the array. - - - - Copies the entire array to a compatible one-dimensional , - starting at the specified index of the target array. - - The one-dimensional that is the destination - of the elements copied from . - The must have zero-based indexing. - The zero-based index in - at which copying begins. - - - - Copies a range of elements from the unmanaged array starting at the specified - and pastes them to - starting at the specified . - The length and the indexes are specified as 32-bit integers. - - The array that receives the data. - A 32-bit integer that represents the index - in the unmanaged array at which copying begins. - A 32-bit integer that represents the index in - the destination array at which storing begins. - A 32-bit integer that represents the number of elements to copy. - - is a null reference (Nothing in Visual Basic). - - is outside the range of valid indexes - for the unmanaged array or is greater than the number of elements - from to the end of the unmanaged array - -or- - is outside the range of valid indexes - for the array or is greater than the number of elements - from to the end of the array. - - - - - Copies a range of elements from the array starting at the specified - and pastes them to the unmanaged array - starting at the specified . - The length and the indexes are specified as 32-bit integers. - - The array that holds the data. - A 32-bit integer that represents the index - in the array at which copying begins. - A 32-bit integer that represents the index in - the unmanaged array at which storing begins. - A 32-bit integer that represents the number of elements to copy. - - is a null reference (Nothing in Visual Basic). - - is outside the range of valid indexes - for the array or is greater than the number of elements - from to the end of the array - -or- - is outside the range of valid indexes - for the unmanaged array or is greater than the number of elements - from to the end of the unmanaged array. - - - - - Returns the represented block of memory as an array of . - - The represented block of memory. - - - - Creates a shallow copy of the . - - A shallow copy of the . - - - - Retrieves an object that can iterate through the individual - elements in this . - - An for the . - - - - Retrieves an object that can iterate through the individual - elements in this . - - An for the . - - - - Releases all ressources. - - - - - Releases allocated handles associated with this instance. - - true to release managed resources. - - - - Throws an if - this instance is disposed. - - - - - Tests whether the specified structure is equivalent to this - structure. - - The structure to test. - true if is a - instance equivalent to this structure; otherwise, - false. - - - - Tests whether the specified structure is equivalent to this - structure. - - The structure to test. - true if is equivalent to this - structure; otherwise, - false. - - - - Serves as a hash function for a particular type. - - A hash code for the current . - - - - Copies a block of memory from one location to another. - - Pointer to the starting address of the copy destination. - Pointer to the starting address of the block of memory to be copied. - Size of the block of memory to copy, in bytes. - - - - Gets or sets the value at the specified position in the array. - - A 32-bit integer that represents the position - of the array element to get. - The value at the specified position in the array. - - is outside the range of valid indexes - for the unmanaged array. - - - - Gets or sets the values of the unmanaged array. - - - - - Gets the length of the unmanaged array. - - - - - Gets the base address of the represented memory block. - - - - - Gets a 32-bit integer that represents the total number of elements - in the . - - - - - Gets a value indicating whether access to the - is synchronized (thread safe). - - - - - Gets an object that can be used to synchronize access to the . - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the comment of the image. - Supported formats are JPEG, PNG and GIF. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the version of this standard supported. - Constant length or 4. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the Flashpix format version supported by a FPXR file. - Constant length or 4. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the color space information tag. - See remarks for further information. - - - The following values are defined: - - - ID - Description - - - 1 - sRGB (default) - - - 0xFFFF - uncalibrated - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the valid width of a compressed image. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the valid height of a compressed image. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets components configuration. See remarks for further information. - Constant length of 4. - - - The channels of each component are arranged in order from the 1st component to the 4th. - For uncompressed data the data arrangement is given in the PhotometricInterpretation tag. - However, since PhotometricInterpretation can only express the order of Y,Cb and Cr, - this tag is provided for cases when compressed data uses components other than Y, Cb, - and Cr and to enable support of other sequences. - Default = 4 5 6 0 (if RGB uncompressed) - The following values are defined: - - - ID - Description - - - 0 - does not exist - - - 1 - Y - - - 2 - Cb - - - 3 - Cr - - - 4 - R - - - 5 - R - - - 6 - R - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets compression mode used for a compressed image is indicated - in unit bits per pixel. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a tag for manufacturers of Exif writers to record any desired information. - The contents are up to the manufacturer, but this tag should not be used for any other - than its intended purpose. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a tag for Exif users to write keywords or comments on the image besides - those in ImageDescription, and without the character code limitations of the ImageDescription tag. - Minimum length of 8. See remarks for further information. - - - The character code used in the UserComment tag is identified based on an ID code in a fixed 8-byte - area at the start of the tag data area. The unused portion of the area is padded with NULL. - The ID code for the UserComment area may be a Defined code such as JIS or ASCII, or may be Undefined. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the name of an audio file related to the image data. - The format is 8.3. - Constant length of 12 - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the date and time when the original image data was generated. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the date and time when the image was stored as digital data. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a tag used to record fractions of seconds for the DateTime tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a tag used to record fractions of seconds for the DateTimeOriginal tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a tag used to record fractions of seconds for the DateTimeDigitized tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or the exposure time, given in seconds (sec). - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or the F number. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the class of the program used by the camera to set exposure when the - picture is taken. - See remarks for further information. - - - The following values are defined: - - - ID - Description - - - 0 - not defined - - - 1 - manual - - - 2 - normal program - - - 3 - aperture priority - - - 4 - shutter priority - - - 5 - create program - - - 6 - action program - - - 7 - portrait mode - - - 8 - landscape mode - - - others - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the spectral sensitivity of each channel of the camera used. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the the ISO Speed and ISO Latitude of the camera or input device as - specified in ISO 12232. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the Opto-Electric Conversion Function (OECF) specified in ISO 14524. - OECF is the relationship between the camera optical input and the image values. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the shutter speed. The unit is the APEX (Additive System of Photographic Exposure). - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the lens aperture. The unit is the APEX value. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of brightness. The unit is the APEX value. - Ordinarily it is given in the range of -99.99 to 99.99. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the exposure bias. The unit is the APEX value. - Ordinarily it is given in the range of –99.99 to 99.99. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the smallest F number of the lens. The unit is the APEX value. - Ordinarily it is given in the range of 00.00 to 99.99, - but it is not limited to this range. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets distance to the subject, given in meters. - Note that if the numerator of the recorded value is FFFFFFFF, infinity shall be indicated; - and if the numerator is 0, distance unknown shall be indicated. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the metering mode. See remarks for further information. - - - The following values are defined: - - - ID - Description - - - 0 - unknown - - - 1 - average - - - 2 - center-weighted-average - - - 3 - spot - - - 4 - multi-spot - - - 5 - pattern - - - 6 - partial - - - other - reserved - - - 255 - other - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the kind of light source. - See remarks for further information. - - - The following values are defined: - - - ID - Description - - - 0 - unknown - - - 1 - daylight - - - 2 - fluorescent - - - 3 - tungsten - - - 4 - flash - - - 9 - fine weather - - - 10 - cloudy weather - - - 11 - shade - - - 12 - daylight fluorecent (D 5700 - 7100K) - - - 13 - day white fluorescent (N 4600 - 5400K) - - - 14 - cool white fluorescent (W 3900 - 4500K) - - - 15 - white fluorescent (WW 3200 - 3700K) - - - 17 - standard light A - - - 18 - standard light B - - - 19 - standard light C - - - 20 - D55 - - - 21 - D65 - - - 22 - D75 - - - 23 - D50 - - - 24 - ISO studio tungsten - - - 255 - other light source - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets a value indicating the status of flash when the image was shot. - Bit 0 indicates the flash firing status, bits 1 and 2 indicate the flash return - status, bits 3 and 4 indicate the flash mode, bit 5 indicates whether the flash - function is present, and bit 6 indicates "red eye" mode. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating the location and area of the main subject in - the overall scene. Variable length between 2 and 4. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the actual focal length of the lens, in mm. - Conversion is not made to the focal length of a 35 mm film camera. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the strobe energy at the time the image is captured, - as measured in Beam Candle Power Seconds (BCPS). - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the camera or input device spatial frequency table and SFR values - in the direction of image width, image height, and diagonal direction, - as specified in ISO 12233. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of pixels in the image width (X) direction per - FocalPlaneResolutionUnit on the camera focal plane. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of pixels in the image height (Y) direction per - FocalPlaneResolutionUnit on the camera focal plane. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the unit for measuring FocalPlaneXResolution and FocalPlaneYResolution. - This value is the same as the ResolutionUnit. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the location of the main subject in the scene. - The value of this tag represents the pixel at the center of the main subject - relative to the left edge, prior to rotation processing as per the Rotation tag. - The first value indicates the X column number and second indicates the Y row number. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the exposure index selected on the camera or input device at the - time the image was captured. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the image sensor type on the camera or input device. - See remarks for further information. - - - The following values are defined: - - - ID - Description - - - 1 - not defined - - - 2 - one-chip color area sensor - - - 3 - two-chip color area sensor - - - 4 - three-chip color area sensor - - - 5 - color sequential area sensor - - - 7 - trilinear sensor - - - 8 - color sequential linear sensor - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the image source. If a DSC recorded the image, this tag value of this - tag always be set to 3, indicating that the image was recorded on a DSC. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the type of scene. If a DSC recorded the image, this tag value shall - always be set to 1, indicating that the image was directly photographed. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the color filter array (CFA) geometric pattern of the image sensor - when a one-chip color area sensor is used. It does not apply to all sensing methods. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the use of special processing on image data, such as rendering geared to output. - When special processing is performed, the reader is expected to disable or minimize any - further processing. See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - normal process - - - 1 - custom process - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the exposure mode set when the image was shot. - In auto-bracketing mode, the camera shoots a series of frames of the same scene - at different exposure settings. See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - auto exposure - - - 1 - manual exposure - - - 2 - auto bracket - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the white balance mode set when the image was shot. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - auto white balance - - - 1 - manual white balance - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the digital zoom ratio when the image was shot. - If the numerator of the recorded value is 0, this indicates that digital zoom was not used. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the equivalent focal length assuming a 35mm film camera, in mm. - A value of 0 means the focal length is unknown. Note that this tag differs - from the FocalLength tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the type of scene that was shot. - It can also be used to record the mode in which the image was shot. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - standard - - - 1 - landscape - - - 2 - portrait - - - 3 - night scene - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the degree of overall image gain adjustment. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - none - - - 1 - low gain up - - - 2 - high gain up - - - 3 - low gain down - - - 4 - high gain down - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the direction of contrast processing applied by the camera - when the image was shot. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - normal - - - 1 - soft - - - 2 - hard - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the direction of saturation processing applied by the camera - when the image was shot. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - normal - - - 1 - low saturation - - - 2 - high saturation - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the direction of sharpness processing applied by the camera - when the image was shot. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - normal - - - 1 - soft - - - 2 - hard - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets information on the picture-taking conditions of a particular camera model. - The tag is used only to indicate the picture-taking conditions in the reader. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the distance to the subject. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 0 - unknown - - - 1 - macro - - - 2 - close view - - - 3 - distant view - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets an identifier assigned uniquely to each image. - It is recorded as an ASCII string equivalent to hexadecimal notation and 128-bit fixed length. - Constant length of 32. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the GPS version ID. Constant length of 4. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating whether the - is north or south latitude. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the latitude of the image. The latitude is expressed as three rational - values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets a value indicating whether - is east or west longitude. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the longitude of the image. The longitude is expressed as three rational - values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets a value indicating whether is sea level and the altitude - is above sea level. If the altitude is below sea level is - indicated as an absolute value. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the altitude based on the reference in . - Altitude is expressed as one rational value. The reference unit is meters. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the sign of the . - - - This is a derived property. There is no metadata tag directly associated - with this property value. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the signed altitude. - Altitude is expressed as one rational value. The reference unit is meters. - - - Altitude is too large to fit into a FIRational. - - - This is a derived property. There is no metadata tag directly associated - with this property value. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the time as UTC (Coordinated Universal Time). Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the GPS satellites used for measurements. This tag can be used to describe - the number of satellites, their ID number, angle of elevation, azimuth, SNR and other - information in ASCII notation. The format is not specified. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating the status of the GPS receiver when the image was recorded. - true indicates measurement was in progress; - false indicates measurement was Interoperability. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating the GPS measurement mode. - true indicates three-dimensional measurement; - false indicated two-dimensional measurement was in progress. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the GPS DOP (data degree of precision). An HDOP value is written during - two-dimensional measurement, and PDOP during three-dimensional measurement. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the unit used to express the GPS receiver of movement. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the speed of GPS receiver movement. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the reference for giving the direction of GPS receiver movement. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the direction of GPS receiver movement. - The range of values is from 0.00 to 359.99. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the reference for giving the direction of GPS receiver movement. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the direction of the image when it was captured. - The range of values is from 0.00 to 359.99. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the geodetic survey data used by the GPS receiver. If the survey data - is restricted to Japan, the value of this tag is 'TOKYO' or 'WGS-84'. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating whether the destination point - is north or south latitude. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the latitude of the destination point. The latitude is expressed as three rational - values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets a value indicating whether the destination point - is east or west longitude. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the longitude of the destination point. The longitude is expressed as three rational - values giving the degrees, minutes, and seconds, respectively. Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the reference used for giving the bearing to the destination point. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the bearing to the destination point. - The range of values is from 0.00 to 359.99. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the unit used to express the distance to the destination point. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets a character string recording the name of the method used - for location finding. The first byte indicates the character code used, - and this is followed by the name of the method. Since the Type is not ASCII, - NULL termination is not necessary. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a character string recording the name of the GPS area. - The first byte indicates the character code used, and this is followed by - the name of the GPS area. Since the Type is not ASCII, NULL termination is - not necessary. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets date and time information relative to UTC (Coordinated Universal Time). - - - This is a derived property. There is no metadata tag directly associated - with this property value. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets date information relative to UTC (Coordinated Universal Time). - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value indicating whether differential correction was applied to - the GPS receiver. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the identification of the Interoperability rule. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - This class is obsolete. Use class instead. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the number of columns of image data, equal to the number - of pixels per row. In JPEG compressed data a JPEG marker is used - instead of this tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets number of rows of image data. In JPEG compressed data a JPEG marker - is used instead of this tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets number of bits per image component. In this standard - each component of the image is 8 bits, so the value for this tag is 8. - Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets compression scheme used for the image data. When a primary image - is JPEG compressed, this designation is not necessary and is omitted. - When thumbnails use JPEG compression, this tag value is set to 6. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets pixel composition. In JPEG compressed data a JPEG marker is - used instead of this tag. See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 2 - RGB - - - 6 - YCbCr - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the image orientation viewed in terms of rows and columns. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of components per pixel. Since this standard applies - to RGB and YCbCr images, the value set for this tag is 3. In JPEG compressed - data a JPEG marker is used instead of this tag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a value that indicates whether pixel components are recorded in - chunky or planar format. In JPEG compressed files a JPEG marker is used instead - of this tag. If this field does not exist, the TIFF default of 1 (chunky) is assumed. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 1 - chunky format - - - 2 - planar format - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the sampling ratio of chrominance components in relation to - the luminance component. In JPEG compressed dat a JPEG marker is used - instead of this tag. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - [2,1] - YCbCr4:2:2 - - - [2,2] - YCbCr4:2:0 - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets position of chrominance components in relation to the luminance component. - See remarks for further information. - - - This field is designated only for JPEG compressed data or uncompressed YCbCr data. - The TIFF default is 1 (centered); but when Y:Cb:Cr = 4:2:2 it is recommended in - this standard that 2 (co-sited) be used to record data, in order to improve the - image quality when viewed on TV systems. - - When this field does not exist, the reader shall assume the TIFF default. - In the case of Y:Cb:Cr = 4:2:0, the TIFF default (centered) is recommended. - If the reader does not have the capability of supporting both kinds of YCbCrPositioning, - it shall follow the TIFF default regardless of the value in this field. - It is preferable that readers be able to support both centered and co-sited positioning. - - The following values are definied: - - - ID - Description - - - 1 - centered - - - 2 - co-sited - - - other - reserved - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the number of pixels per - in the direction. When the image resolution is unknown, - 72 [dpi] is designated. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of pixels per - in the direction. When the image resolution is unknown, - 72 [dpi] is designated. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the unit for measuring and . - The same unit is used for both and . - If the image resolution in unknown, 2 (inches) is designated. - See remarks for further information. - - - The following values are definied: - - - ID - Description - - - 2 - inches - - - 3 - YCbCr4:2:0 - - - other - centimeters - - - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the byte offset of that strip. - It is recommended that this be selected so the number of strip bytes - does not exceed 64 Kbytes. - With JPEG compressed data this designation is not needed and is omitted. - Constant length of * StripsPerImage. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - - Gets or sets number of rows per strip. This is the number of rows in the image of - one strip when an image is divided into strips. With JPEG compressed data this - designation is not needed and is omitted. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - - Gets or sets the total number of bytes in each strip. - With JPEG compressed data this designation is not needed and is omitted. - Constant length of * StripsPerImage. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the offset to the start byte (SOI) of JPEG compressed thumbnail data. - This is not used for primary image JPEG data. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the number of bytes of JPEG compressed thumbnail data. - - - This is not used for primary image JPEG data. - JPEG thumbnails are not divided but are recorded as a continuous - JPEG bitstream from SOI to EOI. APPn and COM markers should not be recorded. - Compressed thumbnails shall be recorded in no more than 64 Kbytes, - including all other data to be recorded in APP1. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets a transfer function for the image, described in tabular style. - Constant length of 3 * 256. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the chromaticity of the white point of the image. - Constant length of 2. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the chromaticity of the three primary colors of the image. - Constant length of 6. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the matrix coefficients for transformation from RGB to YCbCr image data. - Constant length of 3. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the reference black point value and reference white point value. - Constant length of 6. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the date and time of image creation. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets a string giving the title of the image. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the manufacturer of the recording equipment. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the model name or model number of the equipment. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the name and version of the software or firmware of the camera - or image input device used to generate the image. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the name of the camera owner, photographer or image creator. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the photographer and editor copyrights. - Constant length of 1-2. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the value of the GeoTIFF GeoASCIIParamsTag. - - - The GeoASCIIParamsTag is used to store all of the valued - GeoKeys, referenced by the property. Since keys - defined in the GeoKeyDirectoryTag use offsets into this tag, any special - comments may be placed at the beginning of this tag. - For the most part, the only keys that are valued are - Citation keys, giving documentation and references for obscure - projections, datums, etc. - - Special handling is required for -valued keys. While it - is true that TIFF 6.0 permits multiple NULL-delimited strings within a single - ASCII tag, the secondary strings might not appear in the output of naive - tiffdump programs. For this reason, the NULL delimiter of each ASCII key - value shall be converted to a "|" (pipe) character before being installed - back into the holding tag, so that a dump of the tag - will look like this. - - AsciiTag="first_value|second_value|etc...last_value|" - - A baseline GeoTIFF-reader must check for and convert the final "|" pipe - character of a key back into a NULL before returning it to the client - software. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the value of the GeoTIFF GeoDoubleParamsTag. - - - The GeoDoubleParamsTag is used to store all of the valued - GeoKeys, referenced by the property. The meaning of - any value of this double array is determined from the GeoKeyDirectoryTag reference - pointing to it. values should first be converted to - and stored here. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the value of the GeoTIFF GeoKeyDirectoryTag. - - - The GeoKeyDirectoryTag may be used to store the GeoKey Directory, which defines and - references the GeoKeys. - - The tag is an array of unsigned values, which are primarily - grouped into blocks of 4. The first 4 values are special, and contain GeoKey directory - header information. The header values consist of the following information, in order: - - Header={KeyDirectoryVersion, KeyRevision, MinorRevision, NumberOfKeys} - - where - - KeyDirectoryVersion indicates the current version of Key implementation, and will - only change if this Tag's Key structure is changed. (Similar to the TIFFVersion (42)). - The current DirectoryVersion number is 1. This value will most likely never change, - and may be used to ensure that this is a valid Key-implementation. - - KeyRevision indicates what revision of Key-Sets are used. - - MinorRevision indicates what set of Key-Codes are used. The complete revision number - is denoted <KeyRevision>.<MinorRevision>. - - NumberOfKeys indicates how many Keys are defined by the rest of this Tag. - - This header is immediately followed by a collection of <NumberOfKeys> KeyEntry - sets, each of which is also 4- long. Each KeyEntry is modeled on the - TIFFEntry format of the TIFF directory header, and is of the form: - - KeyEntry = { KeyID, TIFFTagLocation, Count, Value_Offset } - - where - - KeyID gives the Key-ID value of the Key (identical in function to TIFF tag ID, - but completely independent of TIFF tag-space), - - TIFFTagLocation indicates which TIFF tag contains the value(s) of the Key: if - TIFFTagLocation is 0, then the value is , and is contained in the - Value_Offset entry. Otherwise, the type (format) of the value is implied by the - TIFF-Type of the tag containing the value. - - Count indicates the number of values in this key. - - Value_Offset Value_Offset indicates the index-offset into the TagArray indicated - by TIFFTagLocation, if it is nonzero. If TIFFTagLocation is 0 (zero) , then Value_Offset - contains the actual () value of the Key, and Count=1 is implied. - Note that the offset is not a byte-offset, but rather an index based on the natural data - type of the specified tag array. - - Following the KeyEntry definitions, the KeyDirectory tag may also contain additional - values. For example, if a key requires multiple values, they shall - be placed at the end of this tag, and the KeyEntry will set - TIFFTagLocation=GeoKeyDirectoryTag, with the Value_Offset pointing to the location of the - value(s). - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the value of the GeoTIFF ModelPixelScaleTag. - - - The ModelPixelScaleTag tag may be used to specify the size of raster pixel spacing - in the model space units, when the raster space can be embedded in the model space - coordinate system without rotation, and consists of the following 3 values: - - ModelPixelScaleTag = (ScaleX, ScaleY, ScaleZ) - - where ScaleX and ScaleY give the horizontal and vertical spacing of - raster pixels. The ScaleZ is primarily used to map the pixel value of a - digital elevation model into the correct Z-scale, and so for most other purposes - this value should be zero (since most model spaces are 2-D, with Z=0). - - A single tiepoint in the tag, together with this tag, - completely determine the relationship between raster and model space; thus they - comprise the two tags which Baseline GeoTIFF files most often will use to place a - raster image into a "standard position" in model space. - - Like the tag, this tag information is independent of the - XPosition, YPosition, Resolution and Orientation tags of the standard TIFF 6.0 spec. - However, simple reversals of orientation between raster and model space - (e.g. horizontal or vertical flips) may be indicated by reversal of sign in the - corresponding component of the ModelPixelScaleTag. GeoTIFF compliant readers must - honor this signreversal convention. - - This tag must not be used if the raster image requires rotation or shearing to place - it into the standard model space. In such cases the transformation shall be defined - with the more general . - -
Naming differences - In the native FreeImage library and thus, in the FreeImage API documentation, this - property's key is named GeoPixelScale. Since the GeoTIFF specification - as well as Java's EXIFTIFFTagSet class call this tag - , this property was renamed accordingly. - However, when accessing this property's tag by its object, - the native FreeImage tag key GeoPixelScale must be used. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the value of the GeoTIFF GeoTiePointsTag. - - - The GeoTiePointsTag stores raster -> model tiepoint pairs in the order - - ModelTiePoints = (...,I,J,K, X,Y,Z...), - - where (I,J,K) is the point at location (I,J) in raster space with - pixel-value K, and (X,Y,Z) is a vector in model space. In most cases - the model space is only two-dimensional, in which case both K and Z should be set - to zero; this third dimension is provided in anticipation of future support for 3D - digital elevation models and vertical coordinate systems. - - A raster image may be georeferenced simply by specifying its location, size and - orientation in the model coordinate space M. This may be done by specifying the - location of three of the four bounding corner points. However, tiepoints are only - to be considered exact at the points specified; thus defining such a set of - bounding tiepoints does not imply that the model space locations of the interior - of the image may be exactly computed by a linear interpolation of these tiepoints. - - However, since the relationship between the Raster space and the model space will - often be an exact, affine transformation, this relationship can be defined using - one set of tiepoints and the , described below, which - gives the vertical and horizontal raster grid cell size, specified in model units. - - If possible, the first tiepoint placed in this tag shall be the one establishing - the location of the point (0,0) in raster space. However, if this is not possible - (for example, if (0,0) is goes to a part of model space in which the projection is - ill-defined), then there is no particular order in which the tiepoints need be - listed. - - For orthorectification or mosaicking applications a large number of tiepoints may - be specified on a mesh over the raster image. However, the definition of associated - grid interpolation methods is not in the scope of the current GeoTIFF spec. - -
Naming differences - In the native FreeImage library and thus, in the FreeImage API documentation, this - property's key is named GeoTiePoints. Since the GeoTIFF specification - as well as Java's EXIFTIFFTagSet class call this tag - , this property was renamed accordingly. - However, when accessing this property's tag by its object, - the native FreeImage tag key GeoTiePoints must be used. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the value of the GeoTIFF ModelTransformationMatrixTag. - - - This tag may be used to specify the transformation matrix between the raster space - (and its dependent pixel-value space) and the (possibly 3D) model space. - -
Naming differences - In the native FreeImage library and thus, in the FreeImage API documentation, this - property's key is named GeoTransformationMatrix. Since the GeoTIFF specification - as well as Java's EXIFTIFFTagSet class call this tag - , this property was renamed accordingly. - However, when accessing this property's tag by its object, - the native FreeImage tag key GeoTransformationMatrix must be used. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the value of the GeoTIFF IntergraphTransformationMatrixTag. - - - The IntergraphTransformationMatrixTag conflicts with an internal software implementation - at Intergraph, and so its use is no longer encouraged. A GeoTIFF reader should look first - for the new tag, and only if it is not found should it check for this older tag. If found, - it should only consider it to be contain valid GeoTIFF matrix information if the tag-count - is 16; the Intergraph version uses 17 values. - -
Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. -
-
- - - Gets or sets the value of the GeoTIFF JPLCartoIFDOffsetTag. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets the Application Record Version. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Type Reference. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Attribute Reference. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Name. - This is also referred to as Title. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Edit Status. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Editorial Update. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Urgency. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Subject Reference. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Category. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Supplemental Categories. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Fixture Identifier. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Keywords. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Content Location Code. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Content Location Name. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Release Date. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Release Time. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Expiration Date. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Expiration Time. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Special Instructions. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Action Advised. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Reference Service. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Reference Date. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Reference Number. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Date Created. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Time Created. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Digital Creation Date. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Digital Creation Time. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Originating Program. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Program Version. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Cycle. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag By Line. - This is the author's name. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag By Line Title. - This is the author's position. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag City. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Sub Location. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Province State. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Country Primary Location Code. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Country Primary Location Name. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Original Transmission Reference. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Headline. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Credit. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Source. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Copyright Notice. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Contact. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Caption Abstract. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Writer Editor. - This is also referred to as Caption Writer. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Rasterized Caption. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Image Type. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Image Orientation. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Language Identifier. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Audio Type. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Audio Sampling Rate. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Audio Sampling Resolution. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Audio Duration. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Audio Outcue. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Job I D. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Master Document I D. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Short Document I D. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Unique Document I D. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Owner I D. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Preview File Format. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Preview File Version. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Object Preview Data. - This is also referred to as Audio Outcue. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Prefs. - This is also referred to as photo-mechanic preferences. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Classify State. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Similarity Index. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Document Notes. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Document History. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets or sets the value of the IPTC/NAA tag Exif Camera Info. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Represents a collection of all tags contained in the metadata model - . - - - - - Initializes a new instance of this class. - - Handle to a FreeImage bitmap. - - - - Retrieves the datamodel that this instance represents. - - - - - Gets or sets the XMP XML content. - - - Handling of null values - A null value indicates, that the corresponding metadata tag is not - present in the metadata model. - Setting this property's value to a non-null reference creates the - metadata tag if necessary. - Setting this property's value to a null reference deletes the - metadata tag from the metadata model. - - - - - Gets an initialized to read the XMP XML content. - Returns null, if the metadata tag XMLPacket is not present in - this model. - - - - - Manages metadata objects and operations. - - - - - The encapsulated FreeImage-tag. - - - - - The metadata model of . - - - - - Indicates whether this instance has already been disposed. - - - - - Indicates whether this instance was created by FreeImage or - by the user. - - - - - List linking metadata-model and Type. - - - - - List linking Type and metadata-model. - - - - - Initializes a new instance of this class. - - - - - Initializes a new instance of this class. - - The new model the tag should be of. - - - - Initializes a new instance of this class. - - The to represent. - The bitmap was extracted from. - - - - Initializes a new instance of this class. - - The to represent. - The model of . - - - - Releases all resources used by the instance. - - - - - Determines whether two specified objects have the same value. - - A or a null reference (Nothing in Visual Basic). - A or a null reference (Nothing in Visual Basic). - - true if the value of left is the same as the value of right; otherwise, false. - - - - - Determines whether two specified objects have different values. - - A or a null reference (Nothing in Visual Basic). - A or a null reference (Nothing in Visual Basic). - - true if the value of left is different from the value of right; otherwise, false. - - - - - Extracts the value of a instance to a handle. - - A instance. - A new instance of initialized to . - - - - Sets the value of the metadata. - In case value is of byte or byte[] is assumed. - In case value is of uint or uint[] is assumed. - - New data of the metadata. - True on success, false on failure. - - The data format is not supported. - - is null. - - - - Sets the value of the metadata. - - New data of the metadata. - Type of the data. - True on success, false on failure. - - The data type is not supported. - - is null. - - and to not fit. - - - - Sets the value of this tag to the value of - using the given type. - - New value of the tag. - Data-type of the tag. - - - is a null reference. - - - is FIDT_ASCII and - is not String. - is not FIDT_ASCII and - is not Array. - - is FIDT_NOTYPE. - - - - Add this metadata to an image. - - Handle to a FreeImage bitmap. - True on success, false on failure. - - - - Gets a .NET PropertyItem for this metadata tag. - - The .NET PropertyItem. - - - - Converts the value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Creates a deep copy of this . - - A deep copy of this . - - - - Tests whether the specified object is a instance - and is equivalent to this instance. - - The object to test. - true if is a instance - equivalent to this instance; otherwise, false. - - - - Tests whether the specified instance is equivalent to this instance. - - A instance to compare to this instance. - true if equivalent to this instance; - otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares the current instance with another object of the same type. - - An object to compare with this instance. - A 32-bit signed integer that indicates the relative order of the objects being compared. - - - - Releases all resources used by the instance. - - - - - Throwns an in case - this instance has already been disposed. - - - - - Gets the model of the metadata. - - - - - Gets or sets the key of the metadata. - - - - - Gets or sets the description of the metadata. - - - - - Gets or sets the ID of the metadata. - - - - - Gets the type of the metadata. - - - - - Gets the number of elements the metadata object contains. - - - - - Gets the length of the value in bytes. - - - - - Gets or sets the value of the metadata. - - - - - Gets whether this instance has already been disposed. - - - - - Provides methods for working with the standard bitmap palette. - - - - - Initializes a new instance for the given FreeImage bitmap. - - Handle to a FreeImage bitmap. - is null. - is not - -or- - has more than 8bpp. - - - - Initializes a new instance for the given FITAG that contains - a palette. - - The tag containing the palette. - is null. - is not - . - - - - Initializes a new instance for the given MetadataTag that contains - a palette. - - The tag containing the palette. - is null. - is not - . - - - - Initializes a new instance for the given array of that contains - a palette. - - A RGBQUAD array containing the palette data to initialize this instance. - - - - Initializes a new instance for the given array of that contains - a palette. - - A Color array containing the palette data to initialize this instance. - - - - Initializes a new instance with the specified size. - - The size of the palette. - - - - Returns the palette as an array of . - - The palette as an array of . - - - - Creates a linear palette based on the provided . - - The used to colorize the palette. - - Only call this method on linear palettes. - - - - - Creates a linear palette based on the provided . - - The used to colorize the palette. - The position of the color within the new palette. - 0 < < 1. - - Only call this method on linear palettes. - - - - - Creates a linear palette based on the provided . - - The used to colorize the palette. - The position of the color within the new palette. - 0 < < . - - Only call this method on linear palettes. - - - - - Creates a linear grayscale palette. - - - - - Creates a linear grayscale palette. - - true to create an inverse grayscale palette. - - - - Creates a linear palette with the specified . - - - A linear grayscale palette contains all shades of colors from - black to white. This method creates a similar palette with the white - color being replaced by the specified color. - - The used to create the palette. - true to create an inverse palette. - - - - Reverses the palette. - - - - - Copies the values from the specified to this instance. - - The palette to copy from. - - is a null reference. - - - - Copies the values from the specified to this instance, - starting at the specified . - - The palette to copy from. - The position in this instance where the values - will be copied to. - - is a null reference. - - is outside the range of valid indexes. - - - - Saves this to the specified file. - - - A string that contains the name of the file to which to save this . - - - - - Saves this to the specified stream. - - - The where the image will be saved. - - - - - Saves this using the specified writer. - - - The used to save the image. - - - - - Loads a palette from the specified file. - - The name of the palette file. - - - - Loads a palette from the specified stream. - - The stream to load the palette from. - - - - Loads a palette from the reader. - - The reader to load the palette from. - - - - Releases allocated handles associated with this instance. - - true to release managed resources. - - - - Gets or sets the palette through an array of . - - - - - Get an array of that the block of memory represents. - This property is used for internal palette operations. - - - - - Class representing all registered in FreeImage. - - - - - Adds local plugin to this class. - - The registered plugin. - - - - Returns an instance of , representing the given format. - - The representing format. - An instance of . - - - - Returns an instance of , - representing the format at the given index. - - The index of the representing format. - An instance of . - - - - Returns an instance of . - is searched in: - Format, RegExpr, - ValidExtension and ValidFilename. - - The expression to search for. - An instance of . - - - - Returns an instance of for the given format. - - The format of the Plugin. - An instance of . - - - - Returns an instance of for the given filename. - - The valid filename for the plugin. - An instance of . - - - - Returns an instance of for the given mime. - - The valid mime for the plugin. - An instance of . - - - - Gets the number of registered plugins. - - - - - Gets a readonly collection of all plugins. - - - - - Gets a list of plugins that are only able to - read but not to write. - - - - - Gets a list of plugins that are only able to - write but not to read. - - - - - Gets a list of plugins that are not able to - read or write. - - - - - Gets a list of plugins that are able to read. - - - - - Gets a list of plugins that are able to write. - - - - - Gets a list of local plugins. - - - - - Gets a list of built-in plugins. - - - - - Windows or OS/2 Bitmap File (*.BMP) - - - - - Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - - - - - Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - - - - - JPEG Network Graphics (*.JNG) - - - - - Commodore 64 Koala format (*.KOA) - - - - - Amiga IFF (*.IFF, *.LBM) - - - - - Amiga IFF (*.IFF, *.LBM) - - - - - Multiple Network Graphics (*.MNG) - - - - - Portable Bitmap (ASCII) (*.PBM) - - - - - Portable Bitmap (BINARY) (*.PBM) - - - - - Kodak PhotoCD (*.PCD) - - - - - Zsoft Paintbrush PCX bitmap format (*.PCX) - - - - - Portable Graymap (ASCII) (*.PGM) - - - - - Portable Graymap (BINARY) (*.PGM) - - - - - Portable Network Graphics (*.PNG) - - - - - Portable Pixelmap (ASCII) (*.PPM) - - - - - Portable Pixelmap (BINARY) (*.PPM) - - - - - Sun Rasterfile (*.RAS) - - - - - truevision Targa files (*.TGA, *.TARGA) - - - - - Tagged Image File Format (*.TIF, *.TIFF) - - - - - Wireless Bitmap (*.WBMP) - - - - - Adobe Photoshop (*.PSD) - - - - - Dr. Halo (*.CUT) - - - - - X11 Bitmap Format (*.XBM) - - - - - X11 Pixmap Format (*.XPM) - - - - - DirectDraw Surface (*.DDS) - - - - - Graphics Interchange Format (*.GIF) - - - - - High Dynamic Range (*.HDR) - - - - - Raw Fax format CCITT G3 (*.G3) - - - - - Silicon Graphics SGI image format (*.SGI) - - - - - OpenEXR format (*.EXR) - - - - - JPEG-2000 format (*.J2K, *.J2C) - - - - - JPEG-2000 format (*.JP2) - - - - - Portable FloatMap (*.PFM) - - - - - Macintosh PICT (*.PICT) - - - - - RAW camera image (*.*) - - - - - Provides methods for working with generic bitmap scanlines. - - Type of the bitmaps' scanlines. - - - - Initializes a new instance based on the specified FreeImage bitmap. - - Handle to a FreeImage bitmap. - - - - Initializes a new instance based on the specified FreeImage bitmap. - - Handle to a FreeImage bitmap. - Index of the zero based scanline. - - - - Class wrapping streams, implementing a buffer for read data, - so that seek operations can be made. - - - FreeImage can load bitmaps from arbitrary sources. - .NET works with different streams like File- or NetConnection-strams. - NetConnection streams, which are used to load files from web servers, - for example cannot seek. - But FreeImage frequently uses the seek operation when loading bitmaps. - StreamWrapper wrapps a stream and makes it seekable by caching all read - data into an internal MemoryStream to jump back- and forward. - StreamWapper is for internal use and only for loading from streams. - - - - - The stream to wrap - - - - - The caching stream - - - - - Indicates if the wrapped stream reached its end - - - - - Tells the wrapper to block readings or not - - - - - Indicates if the wrapped stream is disposed or not - - - - - Initializes a new instance based on the specified . - - The stream to wrap. - When true the wrapper always tries to read the requested - amount of data from the wrapped stream. - - - - Releases all resources used by the instance. - - - - - Specifies how a single frame will be handled after being displayed. - - - - - Same behavior as but should not be used. - - - - - The image is left in place and will be overdrawn by the next image. - - - - - The area of the image will be blanked out by its background. - - - - - Restores the the area of the image to the state it was before it - has been dawn. - - - - - Color channels. Constants used in color manipulation routines. - - - - - Use red, green and blue channels - - - - - Use red channel - - - - - Use green channel - - - - - Use blue channel - - - - - Use alpha channel - - - - - Use black channel - - - - - Complex images: use real part - - - - - Complex images: use imaginary part - - - - - Complex images: use magnitude - - - - - Complex images: use phase - - - - - Enumeration used for color conversions. - FREE_IMAGE_COLOR_DEPTH contains several colors to convert to. - The default value 'FICD_AUTO'. - - - - - Unknown. - - - - - Auto selected by the used algorithm. - - - - - 1-bit. - - - - - 1-bit using dithering. - - - - - 1-bit using threshold. - - - - - 4-bit. - - - - - 8-bit. - - - - - 16-bit 555 (1 bit remains unused). - - - - - 16-bit 565 (all bits are used). - - - - - 24-bit. - - - - - 32-bit. - - - - - Reorder palette (make it linear). Only affects 1-, 4- and 8-bit images. - The palette is only reordered in case the image is greyscale - (all palette entries have the same red, green and blue value). - - - - - Converts the image to greyscale. - - - - - Flag to mask out all non color depth flags. - - - - - Constants used in color filling routines. - - - - - Default value. - - - - - color is RGB color (contains no valid alpha channel). - - - - - color is RGBA color (contains a valid alpha channel). - - - - - Lookup nearest RGB color from palette. - - - - - Lookup equal RGB color from palette. - - - - - contains the palette index to be used. - - - - - Image color types used in FreeImage. - - - - - min value is white - - - - - min value is black - - - - - RGB color model - - - - - color map indexed - - - - - RGB color model with alpha channel - - - - - CMYK color model - - - - - List of combinable compare modes. - - - - - Compare headers. - - - - - Compare palettes. - - - - - Compare pixel data. - - - - - Compare meta data. - - - - - Compare everything. - - - - - Dithering algorithms. - Constants used in FreeImage_Dither. - - - - - Floyd and Steinberg error diffusion - - - - - Bayer ordered dispersed dot dithering (order 2 dithering matrix) - - - - - Bayer ordered dispersed dot dithering (order 3 dithering matrix) - - - - - Ordered clustered dot dithering (order 3 - 6x6 matrix) - - - - - Ordered clustered dot dithering (order 4 - 8x8 matrix) - - - - - Ordered clustered dot dithering (order 8 - 16x16 matrix) - - - - - Bayer ordered dispersed dot dithering (order 4 dithering matrix) - - - - - Upsampling / downsampling filters. Constants used in FreeImage_Rescale. - - - - - Box, pulse, Fourier window, 1st order (constant) b-spline - - - - - Mitchell and Netravali's two-param cubic filter - - - - - Bilinear filter - - - - - 4th order (cubic) b-spline - - - - - Catmull-Rom spline, Overhauser spline - - - - - Lanczos3 filter - - - - - I/O image format identifiers. - - - - - Unknown format (returned value only, never use it as input value) - - - - - Windows or OS/2 Bitmap File (*.BMP) - - - - - Windows Icon (*.ICO) - - - - - Independent JPEG Group (*.JPG, *.JIF, *.JPEG, *.JPE) - - - - - JPEG Network Graphics (*.JNG) - - - - - Commodore 64 Koala format (*.KOA) - - - - - Amiga IFF (*.IFF, *.LBM) - - - - - Amiga IFF (*.IFF, *.LBM) - - - - - Multiple Network Graphics (*.MNG) - - - - - Portable Bitmap (ASCII) (*.PBM) - - - - - Portable Bitmap (BINARY) (*.PBM) - - - - - Kodak PhotoCD (*.PCD) - - - - - Zsoft Paintbrush PCX bitmap format (*.PCX) - - - - - Portable Graymap (ASCII) (*.PGM) - - - - - Portable Graymap (BINARY) (*.PGM) - - - - - Portable Network Graphics (*.PNG) - - - - - Portable Pixelmap (ASCII) (*.PPM) - - - - - Portable Pixelmap (BINARY) (*.PPM) - - - - - Sun Rasterfile (*.RAS) - - - - - truevision Targa files (*.TGA, *.TARGA) - - - - - Tagged Image File Format (*.TIF, *.TIFF) - - - - - Wireless Bitmap (*.WBMP) - - - - - Adobe Photoshop (*.PSD) - - - - - Dr. Halo (*.CUT) - - - - - X11 Bitmap Format (*.XBM) - - - - - X11 Pixmap Format (*.XPM) - - - - - DirectDraw Surface (*.DDS) - - - - - Graphics Interchange Format (*.GIF) - - - - - High Dynamic Range (*.HDR) - - - - - Raw Fax format CCITT G3 (*.G3) - - - - - Silicon Graphics SGI image format (*.SGI) - - - - - OpenEXR format (*.EXR) - - - - - JPEG-2000 format (*.J2K, *.J2C) - - - - - JPEG-2000 format (*.JP2) - - - - - Portable FloatMap (*.PFM) - - - - - Macintosh PICT (*.PICT) - - - - - RAW camera image (*.*) - - - - - Lossless JPEG transformations constants used in FreeImage_JPEGTransform. - - - - - no transformation - - - - - horizontal flip - - - - - vertical flip - - - - - transpose across UL-to-LR axis - - - - - transpose across UR-to-LL axis - - - - - 90-degree clockwise rotation - - - - - 180-degree rotation - - - - - 270-degree clockwise (or 90 ccw) - - - - - Flags used in load functions. - - - - - Default option for all types. - - - - - Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color. - - - - - 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading. - - - - - Convert to 32bpp and create an alpha channel from the AND-mask when loading. - - - - - Load the file as fast as possible, sacrificing some quality. - - - - - Load the file with the best quality, sacrificing some speed. - - - - - Load separated CMYK "as is" (use | to combine with other load flags). - - - - - Load and rotate according to Exif 'Orientation' tag if available. - - - - - Load the bitmap sized 768 x 512. - - - - - Load the bitmap sized 384 x 256. - - - - - Load the bitmap sized 192 x 128. - - - - - Avoid gamma correction. - - - - - If set the loader converts RGB555 and ARGB8888 -> RGB888. - - - - - Reads tags for separated CMYK. - - - - - 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. - - - - - Loads the image as RGB 24-bit. - - - - - Metadata models supported by FreeImage. - - - - - No data - - - - - single comment or keywords - - - - - Exif-TIFF metadata - - - - - Exif-specific metadata - - - - - Exif GPS metadata - - - - - Exif maker note metadata - - - - - Exif interoperability metadata - - - - - IPTC/NAA metadata - - - - - Abobe XMP metadata - - - - - GeoTIFF metadata - - - - - Animation metadata - - - - - Used to attach other metadata types to a dib - - - - - Tag data type information (based on TIFF specifications) - Note: RATIONALs are the ratio of two 32-bit integer values. - - - - - placeholder - - - - - 8-bit unsigned integer - - - - - 8-bit bytes w/ last byte null - - - - - 16-bit unsigned integer - - - - - 32-bit unsigned integer - - - - - 64-bit unsigned fraction - - - - - 8-bit signed integer - - - - - 8-bit untyped data - - - - - 16-bit signed integer - - - - - 32-bit signed integer - - - - - 64-bit signed fraction - - - - - 32-bit IEEE floating point - - - - - 64-bit IEEE floating point - - - - - 32-bit unsigned integer (offset) - - - - - 32-bit RGBQUAD - - - - - Flags for copying data from a bitmap to another. - - - - - Exisiting metadata will remain unchanged. - - - - - Existing metadata will be cleared. - - - - - Existing metadata will be overwritten. - - - - - Color quantization algorithms. - Constants used in FreeImage_ColorQuantize. - - - - - Xiaolin Wu color quantization algorithm - - - - - NeuQuant neural-net quantization algorithm by Anthony Dekker - - - - - Flags used in save functions. - - - - - Default option for all types. - - - - - Save with run length encoding. - - - - - Save data as float instead of as half (not recommended). - - - - - Save with no compression. - - - - - Save with zlib compression, in blocks of 16 scan lines. - - - - - Save with piz-based wavelet compression. - - - - - Save with lossy 24-bit float compression. - - - - - Save with lossy 44% float compression - goes to 22% when combined with EXR_LC. - - - - - Save images with one luminance and two chroma channels, rather than as RGB (lossy compression). - - - - - Save with superb quality (100:1). - - - - - Save with good quality (75:1). - - - - - Save with normal quality (50:1). - - - - - Save with average quality (25:1). - - - - - Save with bad quality (10:1). - - - - - Save as a progressive-JPEG (use | to combine with other save flags). - - - - - Save with high 4x1 chroma subsampling (4:1:1). - - - - - Save with medium 2x2 medium chroma (4:2:0). - - - - - Save with low 2x1 chroma subsampling (4:2:2). - - - - - Save with no chroma subsampling (4:4:4). - - - - - Save using ZLib level 1 compression flag - (default value is ). - - - - - Save using ZLib level 6 compression flag (default recommended value). - - - - - save using ZLib level 9 compression flag - (default value is ). - - - - - Save without ZLib compression. - - - - - Save using Adam7 interlacing (use | to combine with other save flags). - - - - - If set the writer saves in ASCII format (i.e. P1, P2 or P3). - - - - - Stores tags for separated CMYK (use | to combine with compression flags). - - - - - Save using PACKBITS compression. - - - - - Save using DEFLATE compression (a.k.a. ZLIB compression). - - - - - Save using ADOBE DEFLATE compression. - - - - - Save without any compression. - - - - - Save using CCITT Group 3 fax encoding. - - - - - Save using CCITT Group 4 fax encoding. - - - - - Save using LZW compression. - - - - - Save using JPEG compression. - - - - - Tone mapping operators. Constants used in FreeImage_ToneMapping. - - - - - Adaptive logarithmic mapping (F. Drago, 2003) - - - - - Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - - - - - Gradient domain high dynamic range compression (R. Fattal, 2002) - - - - - Image types used in FreeImage. - - - - - unknown type - - - - - standard image : 1-, 4-, 8-, 16-, 24-, 32-bit - - - - - array of unsigned short : unsigned 16-bit - - - - - array of short : signed 16-bit - - - - - array of unsigned long : unsigned 32-bit - - - - - array of long : signed 32-bit - - - - - array of float : 32-bit IEEE floating point - - - - - array of double : 64-bit IEEE floating point - - - - - array of FICOMPLEX : 2 x 64-bit IEEE floating point - - - - - 48-bit RGB image : 3 x 16-bit - - - - - 64-bit RGBA image : 4 x 16-bit - - - - - 96-bit RGB float image : 3 x 32-bit IEEE floating point - - - - - 128-bit RGBA float image : 4 x 32-bit IEEE floating point - - - - - Flags for ICC profiles. - - - - - Default value. - - - - - The color is CMYK. - - - - - List different search modes. - - - - - The key of the metadata. - - - - - The description of the metadata - - - - - The ToString value of the metadata - - - - - The BITMAP structure defines the type, width, height, color format, and bit values of a bitmap. - - - The bitmap formats currently used are monochrome and color. The monochrome bitmap uses a one-bit, - one-plane format. Each scan is a multiple of 32 bits. - - Scans are organized as follows for a monochrome bitmap of height n: - - - Scan 0 - Scan 1 - . - . - . - Scan n-2 - Scan n-1 - - - The pixels on a monochrome device are either black or white. If the corresponding bit in the - bitmap is 1, the pixel is set to the foreground color; if the corresponding bit in the bitmap - is zero, the pixel is set to the background color. - - All devices that have the RC_BITBLT device capability support bitmaps. For more information, - see GetDeviceCaps. - - Each device has a unique color format. To transfer a bitmap from one device to another, - use the GetDIBits and SetDIBits functions. - - - - - Specifies the bitmap type. This member must be zero. - - - - - Specifies the width, in pixels, of the bitmap. The width must be greater than zero. - - - - - Specifies the height, in pixels, of the bitmap. The height must be greater than zero. - - - - - Specifies the number of bytes in each scan line. This value must be divisible by 2, - because the system assumes that the bit values of a bitmap form an array that is word aligned. - - - - - Specifies the count of color planes. - - - - - Specifies the number of bits required to indicate the color of a pixel. - - - - - Pointer to the location of the bit values for the bitmap. - The bmBits member must be a long pointer to an array of character (1-byte) values. - - - - - The BITMAPINFO structure defines the dimensions and color information for a DIB. - - - A DIB consists of two distinct parts: a BITMAPINFO structure describing the dimensions - and colors of the bitmap, and an array of bytes defining the pixels of the bitmap. The bits in - the array are packed together, but each scan line must be padded with zeroes to end on a - LONG data-type boundary. If the height of the bitmap is positive, the bitmap is a - bottom-up DIB and its origin is the lower-left corner. If the height is negative, the bitmap is - a top-down DIB and its origin is the upper left corner. - - A bitmap is packed when the bitmap array immediately follows the BITMAPINFO header. - Packed bitmaps are referenced by a single pointer. For packed bitmaps, the biClrUsed - member must be set to an even number when using the DIB_PAL_COLORS mode so that the DIB bitmap - array starts on a DWORD boundary. - - Note The bmiColors member should not contain palette indexes if the bitmap is to - be stored in a file or transferred to another application. - - Unless the application has exclusive use and control of the bitmap, the bitmap color table - should contain explicit RGB values. - - - - - Specifies a structure that contains information - about the dimensions of color format. - - - - - The bmiColors member contains one of the following: - - - - - An array of . The elements of the array that make up the - color table. - - - - - - An array of 16-bit unsigned integers that specifies indexes into the currently realized - logical palette. This use of bmiColors is allowed for functions that use DIBs. - When bmiColors elements contain indexes to a realized logical palette, they must - also call the following bitmap functions: - - - - - CreateDIBitmap - - CreateDIBPatternBrush - - CreateDIBSection - - The iUsage parameter of CreateDIBSection must be set to DIB_PAL_COLORS. - - The number of entries in the array depends on the values of the biBitCount and - biClrUsed members of the structure. - - The colors in the bmiColors table appear in order of importance. For more information, - see the Remarks section. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - This structure contains information about the dimensions and color format - of a device-independent bitmap (DIB). - - - The structure combines the - BITMAPINFOHEADER structure and a color table to provide a complete - definition of the dimensions and colors of a DIB. - - - - - Specifies the size of the structure, in bytes. - - - - - Specifies the width of the bitmap, in pixels. - - Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - the biWidth member specifies the width of the decompressed JPEG or PNG image file, - respectively. - - - - - Specifies the height of the bitmap, in pixels. If biHeight is positive, the bitmap - is a bottom-up DIB and its origin is the lower-left corner. If biHeight is negative, - the bitmap is a top-down DIB and its origin is the upper-left corner. - - If biHeight is negative, indicating a top-down DIB, biCompression must be - either BI_RGB or BI_BITFIELDS. Top-down DIBs cannot be compressed. - - Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - the biHeight member specifies the height of the decompressed JPEG or PNG image file, - respectively. - - - - - Specifies the number of planes for the target device. This value must be set to 1. - - - - - Specifies the number of bits per pixel.The biBitCount member of the BITMAPINFOHEADER - structure determines the number of bits that define each pixel and the maximum number of - colors in the bitmap. This member must be one of the following values. - - - - - Value - Meaning - - - - 0 - - Windows 98/Me, Windows 2000/XP: The number of bits-per-pixel is specified - or is implied by the JPEG or PNG format. - - - - - 1 - - The bitmap is monochrome, and the bmiColors member of - contains two entries. Each bit in the bitmap array represents a pixel. If the bit is clear, - the pixel is displayed with the color of the first entry in the bmiColors table; if the bit - is set, the pixel has the color of the second entry in the table. - - - - - 4 - - The bitmap has a maximum of 16 colors, and the bmiColors member of BITMAPINFO - contains up to 16 entries. Each pixel in the bitmap is represented by a 4-bit index into the - color table. For example, if the first byte in the bitmap is 0x1F, the byte represents two - pixels. The first pixel contains the color in the second table entry, and the second pixel - contains the color in the sixteenth table entry. - - - - 8 - - The bitmap has a maximum of 256 colors, and the bmiColors member of BITMAPINFO - contains up to 256 entries. In this case, each byte in the array represents a single pixel. - - - - - 16 - - The bitmap has a maximum of 2^16 colors. If the biCompression member of the - BITMAPINFOHEADER is BI_RGB, the bmiColors member of BITMAPINFO is NULL. - Each WORD in the bitmap array represents a single pixel. The relative intensities - of red, green, and blue are represented with five bits for each color component. - The value for blue is in the least significant five bits, followed by five bits each for - green and red. The most significant bit is not used. The bmiColors color table is used - for optimizing colors used on palette-based devices, and must contain the number of entries - specified by the biClrUsed member of the BITMAPINFOHEADER. - - If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, the - bmiColors member contains three DWORD color masks that specify the red, green, - and blue components, respectively, of each pixel. Each WORD in the bitmap array represents - a single pixel. - - Windows NT/Windows 2000/XP: When the biCompression member is BI_BITFIELDS, - bits set in each DWORD mask must be contiguous and should not overlap the bits - of another mask. All the bits in the pixel do not have to be used. - - Windows 95/98/Me: When the biCompression member is BI_BITFIELDS, the system - supports only the following 16bpp color masks: A 5-5-5 16-bit image, where the blue mask is - 0x001F, the green mask is 0x03E0, and the red mask is 0x7C00; and a 5-6-5 16-bit image, - where the blue mask is 0x001F, the green mask is 0x07E0, and the red mask is 0xF800. - - - - - 24 - - The bitmap has a maximum of 2^24 colors, and the bmiColors member of BITMAPINFO - is NULL. Each 3-byte triplet in the bitmap array represents the relative intensities of blue, - green, and red, respectively, for a pixel. The bmiColors color table is used for - optimizing colors used on palette-based devices, and must contain the number of entries - specified by the biClrUsed member of the BITMAPINFOHEADER. - - - - - 32 - - The bitmap has a maximum of 2^32 colors. If the biCompression member of the - BITMAPINFOHEADER is BI_RGB, the bmiColors member of BITMAPINFO is NULL. - Each DWORD in the bitmap array represents the relative intensities of blue, green, and red, - respectively, for a pixel. The high byte in each DWORD is not used. The bmiColors - color table is used for optimizing colors used on palette-based devices, and must contain the - number of entries specified by the biClrUsed member of the BITMAPINFOHEADER. - - If the biCompression member of the BITMAPINFOHEADER is BI_BITFIELDS, - the bmiColors member contains three DWORD color masks that specify the red, green, - and blue components, respectively, of each pixel. Each DWORD in the bitmap array represents - a single pixel. - - Windows NT/ 2000: When the biCompression member is BI_BITFIELDS, bits set in each - DWORD mask must be contiguous and should not overlap the bits of another mask. All the - bits in the pixel do not need to be used. - - Windows 95/98/Me: When the biCompression member is BI_BITFIELDS, the system - supports only the following 32-bpp color mask: The blue mask is 0x000000FF, the green mask is - 0x0000FF00, and the red mask is 0x00FF0000. - - - - - - - - Specifies the type of compression for a compressed bottom-up bitmap (top-down DIBs cannot be - compressed). - - - Value - Meaning - - - - BI_RGB - An uncompressed format. - - - - BI_RLE8 - A run-length encoded (RLE) format for bitmaps with 8 bpp. The compression format - is a 2-byte format consisting of a count byte followed by a byte containing a color index. - - - - - BI_RLE4 - An RLE format for bitmaps with 4 bpp. The compression format is a 2-byte format - consisting of a count byte followed by two word-length color indexes. - - - - BI_BITFIELDS - Specifies that the bitmap is not compressed and that the color table consists - of three DWORD color masks that specify the red, green, and blue components, respectively, - of each pixel. This is valid when used with 16- and 32-bpp bitmaps. - - - - BI_JPEG - Windows 98/Me, Windows 2000/XP: Indicates that the image is a JPEG image. - - - - - BI_PNG - Windows 98/Me, Windows 2000/XP: Indicates that the image is a PNG image. - - - - - - - - - Specifies the size, in bytes, of the image. This may be set to zero for BI_RGB bitmaps. - - Windows 98/Me, Windows 2000/XP: If biCompression is BI_JPEG or BI_PNG, - biSizeImage indicates the size of the JPEG or PNG image buffer, respectively. - - - - - Specifies the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - An application can use this value to select a bitmap from a resource group that best matches - the characteristics of the current device. - - - - - Specifies the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - - - - - Specifies the number of color indexes in the color table that are actually used by the bitmap. - If this value is zero, the bitmap uses the maximum number of colors corresponding to the value - of the biBitCount member for the compression mode specified by biCompression. - - If iClrUsed is nonzero and the biBitCount member is less than 16, the biClrUsed - member specifies the actual number of colors the graphics engine or device driver accesses. - If biBitCount is 16 or greater, the biClrUsed member specifies the size of the color - table used to optimize performance of the system color palettes. If biBitCount equals 16 or 32, - the optimal color palette starts immediately following the three DWORD masks. - - When the bitmap array immediately follows the structure, it is a packed bitmap. - Packed bitmaps are referenced by a single pointer. Packed bitmaps require that the - biClrUsed member must be either zero or the actual size of the color table. - - - - - Specifies the number of color indexes that are required for displaying the bitmap. If this value - is zero, all colors are required. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - The FI16RGB555 structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 5 bits and so, takes values in the range from 0 to 31. - - - For easy integration of the underlying structure into the .NET framework, - the FI16RGB555 structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FI16RGB555 structure and my be used in all situations which require - an FI16RGB555 type. - - - - The following code example demonstrates the various conversions between the - FI16RGB555 structure and the structure. - - FI16RGB555 fi16rgb; - // Initialize the structure using a native .NET Color structure. - fi16rgb = new FI16RGB555(Color.Indigo); - // Initialize the structure using the implicit operator. - fi16rgb = Color.DarkSeaGreen; - // Convert the FI16RGB555 instance into a native .NET Color - // using its implicit operator. - Color color = fi16rgb; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = fi16rgb.Color; - - - - - - The value of the color. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Gets or sets the of the structure. - - - - - Gets or sets the red color component. - - - - - Gets or sets the green color component. - - - - - Gets or sets the blue color component. - - - - - The FI16RGB565 structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 5 bits and so, takes values in the range from 0 to 31. - - - For easy integration of the underlying structure into the .NET framework, - the FI16RGB565 structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FI16RGB565 structure and my be used in all situations which require - an FI16RGB565 type. - - - - The following code example demonstrates the various conversions between the - FI16RGB565 structure and the structure. - - FI16RGB565 fi16rgb; - // Initialize the structure using a native .NET Color structure. - fi16rgb = new FI16RGB565(Color.Indigo); - // Initialize the structure using the implicit operator. - fi16rgb = Color.DarkSeaGreen; - // Convert the FI16RGB565 instance into a native .NET Color - // using its implicit operator. - Color color = fi16rgb; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = fi16rgb.Color; - - - - - - The value of the color. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Gets or sets the of the structure. - - - - - Gets or sets the red color component. - - - - - Gets or sets the green color component. - - - - - Gets or sets the blue color component. - - - - - The FI1BIT structure represents a single bit. - It's value can be 0 or 1. - - - - - Represents the largest possible value of . This field is constant. - - - - - Represents the smallest possible value of . This field is constant. - - - - - The value of the structure. - - - - - Initializes a new instance based on the specified value. - - The value to initialize with. - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - The FI4BIT structure represents the half of a . - It's valuerange is between 0 and 15. - - - - - Represents the largest possible value of . This field is constant. - - - - - Represents the smallest possible value of . This field is constant. - - - - - The value of the structure. - - - - - Initializes a new instance based on the specified value. - - The value to initialize with. - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - The FIBITMAP structure is a handle to a FreeImage bimtap. - - - The handle represented by a FIBITBAP structure provides - access to either a singlepage bitmap or exactly one page of - a multipage bitmap. - - - - - A read-only field that represents a handle that has been initialized to zero. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Sets the handle to null. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - true if the specified is equal to the current ; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - true if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Gets whether the handle is a null or not. - - true if this handle is a null; - otherwise, false. - - - - The FICOMPLEX structure describes a color consisting of a real and an imaginary part. - Each part is using 4 bytes of data. - - - - - Real part of the color. - - - - - Imaginary part of the color. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - This Structure contains ICC-Profile data. - - - - - Creates a new ICC-Profile for . - - Handle to a FreeImage bitmap. - The ICC-Profile data. - - is null. - - - - Creates a new ICC-Profile for . - - Handle to a FreeImage bitmap. - The ICC-Profile data. - Number of bytes to use from data. - - is null. - - - - Info flag of the profile. - - - - - Profile's size measured in bytes. - - - - - Points to a block of contiguous memory containing the profile. - - - - - Copy of the ICC-Profiles data. - - - - - Indicates whether the profile is CMYK. - - - - - The FIMEMORY structure is a handle to an opened memory stream. - - - - - A read-only field that represents a handle that has been initialized to zero. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Sets the handle to null. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - true if the specified is equal to the current ; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - true if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Gets whether the pointer is a null pointer or not. - - true if this is a null pointer; - otherwise, false. - - - - The FIMETADATA structure is an unique search handle for metadata search operations. - - - The FIMETADATA structure is usually returned by the - - function and then used on subsequent calls to - . - When the FIMETADATA handle is no longer used, it needs to be freed by the - function. - - - - - A read-only field that represents a handle that has been initialized to zero. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Sets the handle to null. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - true if the specified is equal to the current ; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - true if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Gets whether the pointer is a null pointer or not. - - true if this is a null pointer; - otherwise, false. - - - - The FIMULTIBITMAP structure is a handle to a FreeImage multipaged bimtap. - - - - - A read-only field that represents a handle that has been initialized to zero. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Sets the handle to null. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - true if the specified is equal to the current ; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - true if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Gets whether the handle is a null or not. - - true if this handle is a null; - otherwise, false. - - - - The FIRational structure represents a fraction via two - instances which are interpreted as numerator and denominator. - - - The structure tries to approximate the value of - when creating a new instance by using a better algorithm than FreeImage does. - - The structure implements the following operators: - +, -, ++, --, ==, != , >, >==, <, <== and ~ (which switches nominator and denomiator). - - The structure can be converted into all .NET standard types either implicit or - explicit. - - - - - Represents the largest possible value of . This field is constant. - - - - - Represents the smallest possible value of . This field is constant. - - - - - Represents the smallest positive value greater than zero. This field is constant. - - - - - Initializes a new instance based on the specified parameters. - - The numerator. - The denominator. - - - - Initializes a new instance based on the specified parameters. - - The tag to read the data from. - - - - Initializes a new instance based on the specified parameters. - - The value to convert into a fraction. - - cannot be converted into a fraction - represented by two integer values. - - - - Returns the truncated value of the fraction. - - - - - - Calculated the greatest common divisor of 'a' and 'b'. - - - - - Calculated the smallest common multiple of 'a' and 'b'. - - - - - Normalizes the fraction. - - - - - Normalizes a fraction. - - - - - Returns the digits after the point. - - - - - Creates a continued fraction of a decimal value. - - - - - Creates a fraction from a continued fraction. - - - - - Tries 'brute force' to approximate with a fraction. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Returns the reciprocal value of this instance. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Formats the value of the current instance using the specified format. - - The String specifying the format to use. - The IFormatProvider to use to format the value. - A String containing the value of the current instance in the specified format. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - The numerator of the fraction. - - - - - The denominator of the fraction. - - - - - Returns whether the fraction is representing an integer value. - - - - - The FIRGB16 structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 16 bits and so, takes values in the range from 0 to 65535. - - - - The FIRGB16 structure provides access to an underlying FreeImage FIRGB16 - structure. To determine the red, green or blue component of a color, - use the red, green or blue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the FIRGB16 structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FIRGB16 structure and my be used in all situations which require - an FIRGB16 type. - - - Each color component red, green or blue of FIRGB16 is translated into - it's corresponding color component R, G or B of - by right shifting 8 bits and shifting left 8 bits for the reverse conversion. - When converting from into FIRGB16, the - color's alpha value is ignored and assumed to be 255 when converting from - FIRGB16 into , creating a fully - opaque color. - - - Conversion from System.Drawing.Color to FIRGB16 - - FIRGB16.component = Color.component << 8 - - Conversion from FIRGB16 to System.Drawing.Color - - Color.component = FIRGB16.component >> 8 - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - FIRGB16 structure and the structure. - - FIRGB16 firgb16; - // Initialize the structure using a native .NET Color structure. - firgb16 = new FIRGBA16(Color.Indigo); - // Initialize the structure using the implicit operator. - firgb16 = Color.DarkSeaGreen; - // Convert the FIRGB16 instance into a native .NET Color - // using its implicit operator. - Color color = firgb16; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = firgb16.Color; - - - - - - The red color component. - - - - - The green color component. - - - - - The blue color component. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Gets or sets the of the structure. - - - - - The FIRGBA16 structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 16 bits and so, takes values in the range from 0 to 65535. - - - - The FIRGBA16 structure provides access to an underlying FreeImage FIRGBA16 - structure. To determine the alpha, red, green or blue component of a color, - use the alpha, red, green or blue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the FIRGBA16 structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FIRGBA16 structure and my be used in all situations which require - an FIRGBA16 type. - - - Each color component alpha, red, green or blue of FIRGBA16 - is translated into it's corresponding color component A, R, G or B of - by an 8 bit right shift and vice versa. - - - Conversion from System.Drawing.Color to FIRGBA16 - - FIRGBA16.component = Color.component << 8 - - Conversion from FIRGBA16 to System.Drawing.Color - - Color.component = FIRGBA16.component >> 8 - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - FIRGBA16 structure and the structure. - - FIRGBA16 firgba16; - // Initialize the structure using a native .NET Color structure. - firgba16 = new FIRGBA16(Color.Indigo); - // Initialize the structure using the implicit operator. - firgba16 = Color.DarkSeaGreen; - // Convert the FIRGBA16 instance into a native .NET Color - // using its implicit operator. - Color color = firgba16; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = firgba16.Color; - - - - - - The red color component. - - - - - The green color component. - - - - - The blue color component. - - - - - The alpha color component. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Gets or sets the of the structure. - - - - - The FIRGBAF structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 32 bits and takes values in the range from 0 to 1. - - - - The FIRGBAF structure provides access to an underlying FreeImage FIRGBAF - structure. To determine the alpha, red, green or blue component of a color, - use the alpha, red, green or blue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the FIRGBAF structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FIRGBAF structure and my be used in all situations which require - an FIRGBAF type. - - - Each color component alpha, red, green or blue of FIRGBAF is translated - into it's corresponding color component A, R, G or B of - by linearly mapping the values of one range - into the other range and vice versa. - - - Conversion from System.Drawing.Color to FIRGBAF - - FIRGBAF.component = (float)Color.component / 255f - - Conversion from FIRGBAF to System.Drawing.Color - - Color.component = (int)(FIRGBAF.component * 255f) - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - FIRGBAF structure and the structure. - - FIRGBAF firgbaf; - // Initialize the structure using a native .NET Color structure. - firgbaf = new FIRGBAF(Color.Indigo); - // Initialize the structure using the implicit operator. - firgbaf = Color.DarkSeaGreen; - // Convert the FIRGBAF instance into a native .NET Color - // using its implicit operator. - Color color = firgbaf; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = firgbaf.Color; - - - - - - The red color component. - - - - - The green color component. - - - - - The blue color component. - - - - - The alpha color component. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Gets or sets the of the structure. - - - - - The FIRGBF structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 32 bits and takes values in the range from 0 to 1. - - - - The FIRGBF structure provides access to an underlying FreeImage FIRGBF - structure. To determine the red, green or blue component of a color, use the - red, green or blue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the FIRGBF structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the FIRGBF structure and my be used in all situations which require - an FIRGBF type. - - - Each color component alpha, red, green or blue of FIRGBF is translated - into it's corresponding color component A, R, G or B of - by linearly mapping the values of one range - into the other range and vice versa. - When converting from into FIRGBF, the - color's alpha value is ignored and assumed to be 255 when converting from - FIRGBF into , creating a fully - opaque color. - - - Conversion from System.Drawing.Color to FIRGBF - - FIRGBF.component = (float)Color.component / 255f - - Conversion from FIRGBF to System.Drawing.Color - - Color.component = (int)(FIRGBF.component * 255f) - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - FIRGBF structure and the structure. - - FIRGBF firgbf; - // Initialize the structure using a native .NET Color structure. - firgbf = new FIRGBF(Color.Indigo); - // Initialize the structure using the implicit operator. - firgbf = Color.DarkSeaGreen; - // Convert the FIRGBF instance into a native .NET Color - // using its implicit operator. - Color color = firgbf; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = firgbf.Color; - - - - - - The red color component. - - - - - The green color component. - - - - - The blue color component. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Gets or sets the of the structure. - - - - - The FITAG structure is a handle to a FreeImage metadata tag. - - - - - A read-only field that represents a handle that has been initialized to zero. - - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Sets the handle to null. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Determines whether the specified is equal to the current . - - The to compare with the current . - true if the specified is equal to the current ; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - true if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Gets whether the pointer is a null pointer or not. - - true if this is a null pointer; - otherwise, false. - - - - The FIURational structure represents a fraction via two - instances which are interpreted as numerator and denominator. - - - The structure tries to approximate the value of - when creating a new instance by using a better algorithm than FreeImage does. - - The structure implements the following operators: - +, ++, --, ==, != , >, >==, <, <== and ~ (which switches nominator and denomiator). - - The structure can be converted into all .NET standard types either implicit or - explicit. - - - - - Represents the largest possible value of . This field is constant. - - - - - Represents the smallest possible value of . This field is constant. - - - - - Represents the smallest positive value greater than zero. This field is constant. - - - - - Initializes a new instance based on the specified parameters. - - The numerator. - The denominator. - - - - Initializes a new instance based on the specified parameters. - - The tag to read the data from. - - - - Initializes a new instance based on the specified parameters. - - The value to convert into a fraction. - - cannot be converted into a fraction - represented by two unsigned integer values. - - - - Returns the truncated value of the fraction. - - - - - - Calculated the greatest common divisor of 'a' and 'b'. - - - - - Calculated the smallest common multiple of 'a' and 'b'. - - - - - Normalizes the fraction. - - - - - Normalizes a fraction. - - - - - Returns the digits after the point. - - - - - Creates a continued fraction of a decimal value. - - - - - Creates a fraction from a continued fraction. - - - - - Tries 'brute force' to approximate with a fraction. - - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Standard implementation of the operator. - - - - - Returns the reciprocal value of this instance. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Standard implementation of the operator. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Formats the value of the current instance using the specified format. - - The String specifying the format to use. - The IFormatProvider to use to format the value. - A String containing the value of the current instance in the specified format. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - The numerator of the fraction. - - - - - The denominator of the fraction. - - - - - Returns whether the fraction is representing an integer value. - - - - - Wrapper for a custom handle. - - - The fi_handle of FreeImage in C++ is a simple pointer, but in .NET - it's not that simple. This wrapper uses fi_handle in two different ways. - - We implement a new plugin and FreeImage gives us a handle (pointer) that - we can simply pass through to the given functions in a 'FreeImageIO' - structure. - But when we want to use LoadFromhandle or SaveToHandle we need - a fi_handle (that we receive again in our own functions). - This handle is for example a stream (see LoadFromStream / SaveToStream) - that we want to work with. To know which stream a read/write is meant for - we could use a hash value that the wrapper itself handles or we can - go the unmanaged way of using a handle. - Therefor we use a to receive a unique pointer that we can - convert back into a .NET object. - When the fi_handle instance is no longer needed the instance must be disposed - by the creater manually! It is recommended to use the using statement to - be sure the instance is always disposed: - - - using (fi_handle handle = new fi_handle(object)) - { - callSomeFunctions(handle); - } - - - What does that mean? - If we get a fi_handle from unmanaged code we get a pointer to unmanaged - memory that we do not have to care about, and just pass ist back to FreeImage. - If we have to create a handle our own we use the standard constructur - that fills the with an pointer that represents the given object. - With calling the is used to retrieve the original - object we passed through the constructor. - - This way we can implement a fi_handle that works with managed an unmanaged - code. - - - - - The handle to wrap. - - - - - Initializes a new instance wrapping a managed object. - - The object to wrap. - - is null. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Returns the object assigned to the handle in case this instance - was created by managed code. - - assigned to this handle or null on failure. - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Indicates whether the current object is equal to another object of the same type. - - An object to compare with this object. - True if the current object is equal to the other parameter; otherwise, false. - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Releases all resources used by the instance. - - - - - Gets whether the pointer is a null pointer. - - - - - Structure for implementing access to custom handles. - - - - - Delegate to the C++ function fread. - - - - - Delegate to the C++ function fwrite. - - - - - Delegate to the C++ function fseek. - - - - - Delegate to the C++ function ftell. - - - - - The structure contains functionpointers that make up a FreeImage plugin. - - - - - Delegate to a function that returns a string which describes - the plugins format. - - - - - Delegate to a function that returns a string which contains - a more detailed description. - - - - - Delegate to a function that returns a comma seperated list - of file extensions the plugin can read or write. - - - - - Delegate to a function that returns a regular expression that - can be used to idientify whether a file can be handled by the plugin. - - - - - Delegate to a function that opens a file. - - - - - Delegate to a function that closes a previosly opened file. - - - - - Delegate to a function that returns the number of pages of a multipage - bitmap if the plugin is capable of handling multipage bitmaps. - - - - - UNKNOWN - - - - - Delegate to a function that loads and decodes a bitmap into memory. - - - - - Delegate to a function that saves a bitmap. - - - - - Delegate to a function that determines whether the source is a valid image. - - - - - Delegate to a function that returns a string which contains - the plugin's mime type. - - - - - Delegate to a function that returns whether the plugin can handle the - specified color depth. - - - - - Delegate to a function that returns whether the plugin can handle the - specified image type. - - - - - Delegate to a function that returns whether the plugin can handle - ICC-Profiles. - - - - - The RGBQUAD structure describes a color consisting of relative - intensities of red, green, blue and alpha value. Each single color - component consumes 8 bits and so, takes values in the range from 0 to 255. - - - - The RGBQUAD structure provides access to an underlying Win32 RGBQUAD - structure. To determine the alpha, red, green or blue component of a color, - use the rgbReserved, rgbRed, rgbGreen or rgbBlue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the RGBQUAD structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the RGBQUAD structure and my be used in all situations which require - an RGBQUAD type. - - - Each color component rgbReserved, rgbRed, rgbGreen or rgbBlue of RGBQUAD - is translated into it's corresponding color component A, R, G or B of - by an one-to-one manner and vice versa. - - - Conversion from System.Drawing.Color to RGBQUAD - - RGBQUAD.component = Color.component - - Conversion from RGBQUAD to System.Drawing.Color - - Color.component = RGBQUAD.component - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - RGBQUAD structure and the structure. - - RGBQUAD rgbq; - // Initialize the structure using a native .NET Color structure. - rgbq = new RGBQUAD(Color.Indigo); - // Initialize the structure using the implicit operator. - rgbq = Color.DarkSeaGreen; - // Convert the RGBQUAD instance into a native .NET Color - // using its implicit operator. - Color color = rgbq; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = rgbq.Color; - - - - - - The blue color component. - - - - - The green color component. - - - - - The red color component. - - - - - The alpha color component. - - - - - The color's value. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a Color structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Converts an array of into an array of - . - - The array to convert. - An array of . - - - - Converts an array of into an array of - . - - The array to convert. - An array of . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Gets or sets the of the structure. - - - - - The RGBTRIPLE structure describes a color consisting of relative - intensities of red, green and blue value. Each single color component - consumes 8 bits and so, takes values in the range from 0 to 255. - - - - The RGBTRIPLE structure provides access to an underlying Win32 RGBTRIPLE - structure. To determine the red, green or blue component of a color, use the - rgbtRed, rgbtGreen or rgbtBlue fields, respectively. - - For easy integration of the underlying structure into the .NET framework, - the RGBTRIPLE structure implements implicit conversion operators to - convert the represented color to and from the - type. This makes the type a real replacement - for the RGBTRIPLE structure and my be used in all situations which require - an RGBTRIPLE type. - - - Each of the color components rgbtRed, rgbtGreen or rgbtBlue of RGBTRIPLE is - translated into it's corresponding color component R, G or B of - by an one-to-one manner and vice versa. - When converting from into RGBTRIPLE, the - color's alpha value is ignored and assumed to be 255 when converting from - RGBTRIPLE into , creating a fully - opaque color. - - - Conversion from System.Drawing.Color to RGBTRIPLE - - RGBTRIPLE.component = Color.component - - Conversion from RGBTRIPLE to System.Drawing.Color - - Color.component = RGBTRIPLE.component - - The same conversion is also applied when the - property or the constructor - is invoked. - - - - The following code example demonstrates the various conversions between the - RGBTRIPLE structure and the structure. - - RGBTRIPLE rgbt; - // Initialize the structure using a native .NET Color structure. - rgbt = new RGBTRIPLE(Color.Indigo); - // Initialize the structure using the implicit operator. - rgbt = Color.DarkSeaGreen; - // Convert the RGBTRIPLE instance into a native .NET Color - // using its implicit operator. - Color color = rgbt; - // Using the structure's Color property for converting it - // into a native .NET Color. - Color another = rgbt.Color; - - - - - - The blue color component. - - - - - The green color component. - - - - - The red color component. - - - - - Initializes a new instance based on the specified . - - to initialize with. - - - - Tests whether two specified structures are equivalent. - - The that is to the left of the equality operator. - The that is to the right of the equality operator. - - true if the two structures are equal; otherwise, false. - - - - - Tests whether two specified structures are different. - - The that is to the left of the inequality operator. - The that is to the right of the inequality operator. - - true if the two structures are different; otherwise, false. - - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of a structure to a structure. - - A structure. - A new instance of initialized to . - - - - Converts the value of an structure to a structure. - - An structure. - A new instance of initialized to . - - - - Converts the value of a structure to an structure. - - A structure. - A new instance of initialized to . - - - - Compares this instance with a specified . - - An object to compare with this instance. - A 32-bit signed integer indicating the lexical relationship between the two comparands. - is not a . - - - - Compares this instance with a specified object. - - A to compare. - A signed number indicating the relative values of this instance - and . - - - - Tests whether the specified object is a structure - and is equivalent to this structure. - - The object to test. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Tests whether the specified structure is equivalent to this - structure. - - A structure to compare to this instance. - true if is a structure - equivalent to this structure; otherwise, false. - - - - Returns a hash code for this structure. - - An integer value that specifies the hash code for this . - - - - Converts the numeric value of the object - to its equivalent string representation. - - The string representation of the value of this instance. - - - - Gets or sets the of the structure. - - - - - Delegate for capturing FreeImage error messages. - - The format of the image. - The errormessage. - - - - Delegate to the C++ function fread. - - Pointer to read from. - Item size in bytes. - Maximum number of items to be read. - Handle/stream to read from. - Number of full items actually read, - which may be less than count if an error occurs or - if the end of the file is encountered before reaching count. - - - - Delegate to the C++ function fwrite. - - Pointer to data to be written. - Item size in bytes. - Maximum number of items to be written. - Handle/stream to write to. - Number of full items actually written, - which may be less than count if an error occurs. - Also, if an error occurs, the file-position indicator cannot be determined. - - - - Delegate to the C++ function fseek. - - Handle/stream to seek in. - Number of bytes from origin. - Initial position. - If successful 0 is returned; otherwise a nonzero value. - - - - Delegate to the C++ function ftell. - - Handle/stream to retrieve its currents position from. - The current position. - - - - Delegate to a function that returns a string which describes - the plugins format. - - - - - Delegate to a function that returns a string which contains - a more detailed description. - - - - - Delegate to a function that returns a comma seperated list - of file extensions the plugin can read or write. - - - - - Delegate to a function that returns a regular expression that - can be used to idientify whether a file can be handled by the plugin. - - - - - Delegate to a function that opens a file. - - - - - Delegate to a function that closes a previosly opened file. - - - - - Delegate to a function that returns the number of pages of a multipage - bitmap if the plugin is capable of handling multipage bitmaps. - - - - - UNKNOWN - - - - - Delegate to a function that loads and decodes a bitmap into memory. - - - - - Delegate to a function that saves a bitmap. - - - - - Delegate to a function that determines whether the source defined - by and is a valid image. - - - - - Delegate to a function that returns a string which contains - the plugin's mime type. - - - - - Delegate to a function that returns whether the plugin can handle the - specified color depth. - - - - - Delegate to a function that returns whether the plugin can handle the - specified image type. - - - - - Delegate to a function that returns whether the plugin can handle - ICC-Profiles. - - - - - Callback function used by FreeImage to register plugins. - - - - - Static class importing functions from the FreeImage library - and providing additional functions. - - - - - Filename of the FreeImage library. - - - - - Number of bytes to shift left within a 4 byte block. - - - - - Number of bytes to shift left within a 4 byte block. - - - - - Number of bytes to shift left within a 4 byte block. - - - - - Number of bytes to shift left within a 4 byte block. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Number of bits to shift left within a 32 bit block. - - - - - Number of bits to shift left within a 32 bit block. - - - - - Number of bits to shift left within a 32 bit block. - - - - - Number of bits to shift left within a 32 bit block. - - - - - Mask indicating the position of color components of a 32 bit color. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Mask indicating the position of the given color. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Number of bits to shift left within a 16 bit block. - - - - - Number of bits to shift left within a 16 bit block. - - - - - An uncompressed format. - - - - - A run-length encoded (RLE) format for bitmaps with 8 bpp. The compression format is a 2-byte - format consisting of a count byte followed by a byte containing a color index. - - - - - An RLE format for bitmaps with 4 bpp. The compression format is a 2-byte format consisting - of a count byte followed by two word-length color indexes. - - - - - Specifies that the bitmap is not compressed and that the color table consists of three - DWORD color masks that specify the red, green, and blue components, respectively, - of each pixel. This is valid when used with 16- and 32-bpp bitmaps. - - - - - Windows 98/Me, Windows 2000/XP: Indicates that the image is a JPEG image. - - - - - Windows 98/Me, Windows 2000/XP: Indicates that the image is a PNG image. - - - - - Initialises the library. - - - When the is true, FreeImage won't make use of external plugins. - - - - - Deinitialises the library. - - - - - Returns a string containing the current version of the library. - - The current version of the library. - - - - Returns a string containing a standard copyright message. - - A standard copyright message. - - - - Calls the set error message function in FreeImage. - - Format of the bitmaps. - The error message. - - - - You use the function FreeImage_SetOutputMessage to capture the log string - so that you can show it to the user of the program. - The callback is implemented in the event of this class. - - The function is private because FreeImage can only have a single - callback function. To use the callback use the - event of this class. - Handler to the callback function. - - - - Creates a new bitmap in memory. - - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new Bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - Red part of the color layout. - eg: 0xFF0000 - Green part of the color layout. - eg: 0x00FF00 - Blue part of the color layout. - eg: 0x0000FF - Handle to a FreeImage bitmap. - - - - Creates a new bitmap in memory. - - Type of the image. - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new Bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - Red part of the color layout. - eg: 0xFF0000 - Green part of the color layout. - eg: 0x00FF00 - Blue part of the color layout. - eg: 0x0000FF - Handle to a FreeImage bitmap. - - - - Makes an exact reproduction of an existing bitmap, including metadata and attached profile if any. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Deletes a previously loaded FIBITMAP from memory. - - Handle to a FreeImage bitmap. - - - - Decodes a bitmap, allocates memory for it and returns it as a FIBITMAP. - - Type of the bitmap. - Name of the file to decode. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - - - Decodes a bitmap, allocates memory for it and returns it as a FIBITMAP. - The filename supports UNICODE. - - Type of the bitmap. - Name of the file to decode. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - - - Loads a bitmap from an arbitrary source. - - Type of the bitmap. - A FreeImageIO structure with functionpointers to handle the source. - A handle to the source. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - - - Saves a previosly loaded FIBITMAP to a file. - - Type of the bitmap. - Handle to a FreeImage bitmap. - Name of the file to save to. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Saves a previosly loaded FIBITMAP to a file. - The filename supports UNICODE. - - Type of the bitmap. - Handle to a FreeImage bitmap. - Name of the file to save to. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Saves a bitmap to an arbitrary source. - - Type of the bitmap. - Handle to a FreeImage bitmap. - A FreeImageIO structure with functionpointers to handle the source. - A handle to the source. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Open a memory stream. - - Pointer to the data in memory. - Length of the data in byte. - Handle to a memory stream. - - - - Close and free a memory stream. - - Handle to a memory stream. - - - - Decodes a bitmap from a stream, allocates memory for it and returns it as a FIBITMAP. - - Type of the bitmap. - Handle to a memory stream. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - - - Saves a previosly loaded FIBITMAP to a stream. - - Type of the bitmap. - Handle to a FreeImage bitmap. - Handle to a memory stream. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Gets the current position of a memory handle. - - Handle to a memory stream. - The current file position if successful, -1 otherwise. - - - - Moves the memory handle to a specified location. - - Handle to a memory stream. - Number of bytes from origin. - Initial position. - Returns true on success, false on failure. - - - - Provides a direct buffer access to a memory stream. - - The target memory stream. - Pointer to the data in memory. - Size of the data in bytes. - Returns true on success, false on failure. - - - - Reads data from a memory stream. - - The buffer to store the data in. - Size in bytes of the items. - Number of items to read. - The stream to read from. - The memory pointer associated with stream is increased by the number of bytes actually read. - The number of full items actually read. - May be less than count on error or stream-end. - - - - Writes data to a memory stream. - - The buffer to read the data from. - Size in bytes of the items. - Number of items to write. - The stream to write to. - The memory pointer associated with stream is increased by the number of bytes actually written. - The number of full items actually written. - May be less than count on error or stream-end. - - - - Open a multi-page bitmap from a memory stream. - - Type of the bitmap. - The stream to decode. - Flags to enable or disable plugin-features. - Handle to a FreeImage multi-paged bitmap. - - - - Registers a new plugin to be used in FreeImage. - - Pointer to the function that initialises the plugin. - A string describing the format of the plugin. - A string describing the plugin. - A string witha comma sperated list of extensions. f.e: "pl,pl2,pl4" - A regular expression used to identify the bitmap. - The format idientifier assigned by FreeImage. - - - - Registers a new plugin to be used in FreeImage. The plugin is residing in a DLL. - The Init function must be called “Init” and must use the stdcall calling convention. - - Complete path to the dll file hosting the plugin. - A string describing the format of the plugin. - A string describing the plugin. - A string witha comma sperated list of extensions. f.e: "pl,pl2,pl4" - A regular expression used to identify the bitmap. - The format idientifier assigned by FreeImage. - - - - Retrieves the number of FREE_IMAGE_FORMAT identifiers being currently registered. - - The number of registered formats. - - - - Enables or disables a plugin. - - The plugin to enable or disable. - True: enable the plugin. false: disable the plugin. - The previous state of the plugin. - 1 - enabled. 0 - disables. -1 plugin does not exist. - - - - Retrieves the state of a plugin. - - The plugin to check. - 1 - enabled. 0 - disables. -1 plugin does not exist. - - - - Returns a identifier from the format string that was used to register the FIF. - - The string that was used to register the plugin. - A identifier from the format. - - - - Returns a identifier from a MIME content type string - (MIME stands for Multipurpose Internet Mail Extension). - - A MIME content type. - A identifier from the MIME. - - - - Returns the string that was used to register a plugin from the system assigned . - - The assigned . - The string that was used to register the plugin. - - - - Returns a comma-delimited file extension list describing the bitmap formats the given plugin can read and/or write. - - The desired . - A comma-delimited file extension list. - - - - Returns a descriptive string that describes the bitmap formats the given plugin can read and/or write. - - The desired . - A descriptive string that describes the bitmap formats. - - - - Returns a regular expression string that can be used by a regular expression engine to identify the bitmap. - FreeImageQt makes use of this function. - - The desired . - A regular expression string. - - - - Given a identifier, returns a MIME content type string (MIME stands for Multipurpose Internet Mail Extension). - - The desired . - A MIME content type string. - - - - This function takes a filename or a file-extension and returns the plugin that can - read/write files with that extension in the form of a identifier. - - The filename or -extension. - The of the plugin. - - - - This function takes a filename or a file-extension and returns the plugin that can - read/write files with that extension in the form of a identifier. - Supports UNICODE filenames. - - The filename or -extension. - The of the plugin. - - - - Checks if a plugin can load bitmaps. - - The of the plugin. - True if the plugin can load bitmaps, else false. - - - - Checks if a plugin can save bitmaps. - - The of the plugin. - True if the plugin can save bitmaps, else false. - - - - Checks if a plugin can save bitmaps in the desired bit depth. - - The of the plugin. - The desired bit depth. - True if the plugin can save bitmaps in the desired bit depth, else false. - - - - Checks if a plugin can save a bitmap in the desired data type. - - The of the plugin. - The desired image type. - True if the plugin can save bitmaps as the desired type, else false. - - - - Checks if a plugin can load or save an ICC profile. - - The of the plugin. - True if the plugin can load or save an ICC profile, else false. - - - - Loads a FreeImage multi-paged bitmap. - Load flags can be provided by the flags parameter. - - Format of the image. - The complete name of the file to load. - When true a new bitmap is created. - When true the bitmap will be loaded read only. - When true performance is increased at the cost of memory. - Flags to enable or disable plugin-features. - Handle to a FreeImage multi-paged bitmap. - - - - Loads a FreeImage multi-pages bitmap from the specified handle - using the specified functions. - Load flags can be provided by the flags parameter. - - Format of the image. - IO functions used to read from the specified handle. - The handle to load the bitmap from. - Flags to enable or disable plugin-features. - Handle to a FreeImage multi-paged bitmap. - - - - Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, applies any changes made to it. - - Handle to a FreeImage multi-paged bitmap. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Returns the number of pages currently available in the multi-paged bitmap. - - Handle to a FreeImage multi-paged bitmap. - Number of pages. - - - - Appends a new page to the end of the bitmap. - - Handle to a FreeImage multi-paged bitmap. - Handle to a FreeImage bitmap. - - - - Inserts a new page before the given position in the bitmap. - - Handle to a FreeImage multi-paged bitmap. - Page has to be a number smaller than the current number of pages available in the bitmap. - Handle to a FreeImage bitmap. - - - - Deletes the page on the given position. - - Handle to a FreeImage multi-paged bitmap. - Number of the page to delete. - - - - Locks a page in memory for editing. - - Handle to a FreeImage multi-paged bitmap. - Number of the page to lock. - Handle to a FreeImage bitmap. - - - - Unlocks a previously locked page and gives it back to the multi-page engine. - - Handle to a FreeImage multi-paged bitmap. - Handle to a FreeImage bitmap. - If true, the page is applied to the multi-page bitmap. - - - - Moves the source page to the position of the target page. - - Handle to a FreeImage multi-paged bitmap. - New position of the page. - Old position of the page. - Returns true on success, false on failure. - - - - Returns an array of page-numbers that are currently locked in memory. - When the pages parameter is null, the size of the array is returned in the count variable. - - - - int[] lockedPages = null; - int count = 0; - GetLockedPageNumbers(dib, lockedPages, ref count); - lockedPages = new int[count]; - GetLockedPageNumbers(dib, lockedPages, ref count); - - - Handle to a FreeImage multi-paged bitmap. - The list of locked pages in the multi-pages bitmap. - If set to null, count will contain the number of pages. - If is set to null count will contain the number of locked pages. - Returns true on success, false on failure. - - - - Orders FreeImage to analyze the bitmap signature. - - Name of the file to analyze. - Reserved parameter - use 0. - Type of the bitmap. - - - - Orders FreeImage to analyze the bitmap signature. - Supports UNICODE filenames. - - Name of the file to analyze. - Reserved parameter - use 0. - Type of the bitmap. - - - - Uses the structure as described in the topic bitmap management functions - to identify a bitmap type. - - A structure with functionpointers to handle the source. - A handle to the source. - Size in bytes of the source. - Type of the bitmap. - - - - Uses a memory handle to identify a bitmap type. - - Pointer to the stream. - Size in bytes of the source. - Type of the bitmap. - - - - Returns whether the platform is using Little Endian. - - Returns true if the platform is using Litte Endian, else false. - - - - Converts a X11 color name into a corresponding RGB value. - - Name of the color to convert. - Red component. - Green component. - Blue component. - Returns true on success, false on failure. - - - - Converts a SVG color name into a corresponding RGB value. - - Name of the color to convert. - Red component. - Green component. - Blue component. - Returns true on success, false on failure. - - - - Returns a pointer to the data-bits of the bitmap. - - Handle to a FreeImage bitmap. - Pointer to the data-bits. - - - - Returns a pointer to the start of the given scanline in the bitmap's data-bits. - - Handle to a FreeImage bitmap. - Number of the scanline. - Pointer to the scanline. - - - - Get the pixel index of a palettized image at position (x, y), including range check (slow access). - - Handle to a FreeImage bitmap. - Pixel position in horizontal direction. - Pixel position in vertical direction. - The pixel index. - Returns true on success, false on failure. - - - - Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - - Handle to a FreeImage bitmap. - Pixel position in horizontal direction. - Pixel position in vertical direction. - The pixel color. - Returns true on success, false on failure. - - - - Set the pixel index of a palettized image at position (x, y), including range check (slow access). - - Handle to a FreeImage bitmap. - Pixel position in horizontal direction. - Pixel position in vertical direction. - The new pixel index. - Returns true on success, false on failure. - - - - Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - - Handle to a FreeImage bitmap. - Pixel position in horizontal direction. - Pixel position in vertical direction. - The new pixel color. - Returns true on success, false on failure. - - - - Retrieves the type of the bitmap. - - Handle to a FreeImage bitmap. - Type of the bitmap. - - - - Returns the number of colors used in a bitmap. - - Handle to a FreeImage bitmap. - Palette-size for palletised bitmaps, and 0 for high-colour bitmaps. - - - - Returns the size of one pixel in the bitmap in bits. - - Handle to a FreeImage bitmap. - Size of one pixel in the bitmap in bits. - - - - Returns the width of the bitmap in pixel units. - - Handle to a FreeImage bitmap. - With of the bitmap. - - - - Returns the height of the bitmap in pixel units. - - Handle to a FreeImage bitmap. - Height of the bitmap. - - - - Returns the width of the bitmap in bytes. - - Handle to a FreeImage bitmap. - With of the bitmap in bytes. - - - - Returns the width of the bitmap in bytes, rounded to the next 32-bit boundary, - also known as pitch or stride or scan width. - - Handle to a FreeImage bitmap. - With of the bitmap in bytes. - - - - Returns the size of the DIB-element of a FIBITMAP in memory. - - Handle to a FreeImage bitmap. - Size of the DIB-element - - - - Returns a pointer to the bitmap's palette. - - Handle to a FreeImage bitmap. - Pointer to the bitmap's palette. - - - - Returns the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - - Handle to a FreeImage bitmap. - The horizontal resolution, in pixels-per-meter. - - - - Returns the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - - Handle to a FreeImage bitmap. - The vertical resolution, in pixels-per-meter. - - - - Set the horizontal resolution, in pixels-per-meter, of the target device for the bitmap. - - Handle to a FreeImage bitmap. - The new horizontal resolution. - - - - Set the vertical resolution, in pixels-per-meter, of the target device for the bitmap. - - Handle to a FreeImage bitmap. - The new vertical resolution. - - - - Returns a pointer to the of the DIB-element in a FIBITMAP. - - Handle to a FreeImage bitmap. - Poiter to the header of the bitmap. - - - - Alias for FreeImage_GetInfoHeader that returns a pointer to a - rather than to a . - - Handle to a FreeImage bitmap. - Pointer to the structure for the bitmap. - - - - Investigates the color type of the bitmap by reading the bitmap's pixel bits and analysing them. - - Handle to a FreeImage bitmap. - The color type of the bitmap. - - - - Returns a bit pattern describing the red color component of a pixel in a FreeImage bitmap. - - Handle to a FreeImage bitmap. - The bit pattern for RED. - - - - Returns a bit pattern describing the green color component of a pixel in a FreeImage bitmap. - - Handle to a FreeImage bitmap. - The bit pattern for green. - - - - Returns a bit pattern describing the blue color component of a pixel in a FreeImage bitmap. - - Handle to a FreeImage bitmap. - The bit pattern for blue. - - - - Returns the number of transparent colors in a palletised bitmap. - - Handle to a FreeImage bitmap. - The number of transparent colors in a palletised bitmap. - - - - Returns a pointer to the bitmap's transparency table. - - Handle to a FreeImage bitmap. - Pointer to the bitmap's transparency table. - - - - Tells FreeImage if it should make use of the transparency table - or the alpha channel that may accompany a bitmap. - - Handle to a FreeImage bitmap. - True to enable the transparency, false to disable. - - - - Set the bitmap's transparency table. Only affects palletised bitmaps. - - Handle to a FreeImage bitmap. - Pointer to the bitmap's new transparency table. - The number of transparent colors in the new transparency table. - - - - Returns whether the transparency table is enabled. - - Handle to a FreeImage bitmap. - Returns true when the transparency table is enabled (1-, 4- or 8-bit images) - or when the input dib contains alpha values (32-bit images). Returns false otherwise. - - - - Returns whether the bitmap has a file background color. - - Handle to a FreeImage bitmap. - Returns true when the image has a file background color, false otherwise. - - - - Returns the file background color of an image. - For 8-bit images, the color index in the palette is returned in the - rgbReserved member of the bkcolor parameter. - - Handle to a FreeImage bitmap. - The background color. - Returns true on success, false on failure. - - - - Set the file background color of an image. - When saving an image to PNG, this background color is transparently saved to the PNG file. - - Handle to a FreeImage bitmap. - The new background color. - Returns true on success, false on failure. - - - - Set the file background color of an image. - When saving an image to PNG, this background color is transparently saved to the PNG file. - When the bkcolor parameter is null, the background color is removed from the image. - - This overloaded version of the function with an array parameter is provided to allow - passing null in the parameter. This is similar to the - original C/C++ function. Passing null as parameter will - unset the dib's previously set background color. - - - Handle to a FreeImage bitmap. - The new background color. - The first entry in the array is used. - Returns true on success, false on failure. - - - // create a RGBQUAD color - RGBQUAD color = new RGBQUAD(Color.Green); - - // set the dib's background color (using the other version of the function) - FreeImage.SetBackgroundColor(dib, ref color); - - // remove it again (this only works due to the array parameter RGBQUAD[]) - FreeImage.SetBackgroundColor(dib, null); - - - - - - Sets the index of the palette entry to be used as transparent color - for the image specified. Does nothing on high color images. - - Handle to a FreeImage bitmap. - The index of the palette entry to be set as transparent color. - - - - Returns the palette entry used as transparent color for the image specified. - Works for palletised images only and returns -1 for high color - images or if the image has no color set to be transparent. - - Handle to a FreeImage bitmap. - the index of the palette entry used as transparent color for - the image specified or -1 if there is no transparent color found - (e.g. the image is a high color image). - - - - Retrieves the data of the bitmap. - This function can also be called safely, when the original format does not support profiles. - - Handle to a FreeImage bitmap. - The data of the bitmap. - - - - Retrieves a pointer to the data of the bitmap. - This function can also be called safely, when the original format does not support profiles. - - Handle to a FreeImage bitmap. - Pointer to the data of the bitmap. - - - - Creates a new block from ICC profile data previously read from a file - or built by a color management system. The profile data is attached to the bitmap. - - Handle to a FreeImage bitmap. - Pointer to the new data. - Size of the data. - Pointer to the created structure. - - - - This function destroys an previously created by . - After this call the bitmap will contain no profile information. - This function should be called to ensure that a stored bitmap will not contain any profile information. - - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 4 bits. - If the bitmap was a high-color bitmap (16, 24 or 32-bit) or if it was a - monochrome or greyscale bitmap (1 or 8-bit), the end result will be a - greyscale bitmap, otherwise (1-bit palletised bitmaps) it will be a palletised bitmap. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 8 bits. If the bitmap was a high-color bitmap (16, 24 or 32-bit) - or if it was a monochrome or greyscale bitmap (1 or 4-bit), the end result will be a - greyscale bitmap, otherwise (1 or 4-bit palletised bitmaps) it will be a palletised bitmap. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to a 8-bit greyscale image with a linear ramp. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 16 bits, where each pixel has a color pattern of - 5 bits red, 5 bits green and 5 bits blue. One bit in each pixel is unused. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 16 bits, where each pixel has a color pattern of - 5 bits red, 6 bits green and 5 bits blue. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 24 bits. A clone of the input bitmap is returned for 24-bit bitmaps. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 32 bits. A clone of the input bitmap is returned for 32-bit bitmaps. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Quantizes a high-color 24-bit bitmap to an 8-bit palette color bitmap. - - Handle to a FreeImage bitmap. - Specifies the color reduction algorithm to be used. - Handle to a FreeImage bitmap. - - - - ColorQuantizeEx is an extension to the method that - provides additional options used to quantize a 24-bit image to any - number of colors (up to 256), as well as quantize a 24-bit image using a - partial or full provided palette. - - Handle to a FreeImage bitmap. - Specifies the color reduction algorithm to be used. - Size of the desired output palette. - Size of the provided palette of ReservePalette. - The provided palette. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 1-bit monochrome bitmap using a threshold T between [0..255]. - The function first converts the bitmap to a 8-bit greyscale bitmap. - Then, any brightness level that is less than T is set to zero, otherwise to 1. - For 1-bit input bitmaps, the function clones the input bitmap and builds a monochrome palette. - - Handle to a FreeImage bitmap. - The threshold. - Handle to a FreeImage bitmap. - - - - Converts a bitmap to 1-bit monochrome bitmap using a dithering algorithm. - For 1-bit input bitmaps, the function clones the input bitmap and builds a monochrome palette. - - Handle to a FreeImage bitmap. - The dithering algorithm to use. - Handle to a FreeImage bitmap. - - - - Converts a raw bitmap to a FreeImage bitmap. - - Pointer to the memory block containing the raw bitmap. - The width in pixels of the raw bitmap. - The height in pixels of the raw bitmap. - Defines the total width of a scanline in the raw bitmap, - including padding bytes. - The bit depth (bits per pixel) of the raw bitmap. - The bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap is stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - Handle to a FreeImage bitmap. - - - - Converts a raw bitmap to a FreeImage bitmap. - - Array of bytes containing the raw bitmap. - The width in pixels of the raw bitmap. - The height in pixels of the raw bitmap. - Defines the total width of a scanline in the raw bitmap, - including padding bytes. - The bit depth (bits per pixel) of the raw bitmap. - The bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap is stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - Handle to a FreeImage bitmap. - - - - Converts a FreeImage bitmap to a raw bitmap, that is a raw piece of memory. - - Pointer to the memory block receiving the raw bitmap. - Handle to a FreeImage bitmap. - The desired total width in bytes of a scanline in the raw bitmap, - including any padding bytes. - The desired bit depth (bits per pixel) of the raw bitmap. - The desired bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The desired bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The desired bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap will be stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - - - - Converts a FreeImage bitmap to a raw bitmap, that is a raw piece of memory. - - Array of bytes receiving the raw bitmap. - Handle to a FreeImage bitmap. - The desired total width in bytes of a scanline in the raw bitmap, - including any padding bytes. - The desired bit depth (bits per pixel) of the raw bitmap. - The desired bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The desired bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The desired bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap will be stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - - - - Converts a 24- or 32-bit RGB(A) standard image or a 48-bit RGB image to a FIT_RGBF type image. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - - - - Converts a non standard image whose color type is FIC_MINISBLACK - to a standard 8-bit greyscale image. - - Handle to a FreeImage bitmap. - When true the conversion is done by scaling linearly - each pixel value from [min, max] to an integer value between [0..255], - where min and max are the minimum and maximum pixel values in the image. - When false the conversion is done by rounding each pixel value to an integer between [0..255]. - - Rounding is done using the following formula: - - dst_pixel = (BYTE) MIN(255, MAX(0, q)) where int q = int(src_pixel + 0.5); - Handle to a FreeImage bitmap. - - - - Converts an image of any type to type dst_type. - - Handle to a FreeImage bitmap. - Destination type. - True to scale linear, else false. - Handle to a FreeImage bitmap. - - - - Converts a High Dynamic Range image (48-bit RGB or 96-bit RGBF) to a 24-bit RGB image, suitable for display. - - Handle to a FreeImage bitmap. - The tone mapping operator to be used. - Parmeter depending on the used algorithm - Parmeter depending on the used algorithm - Handle to a FreeImage bitmap. - - - - Converts a High Dynamic Range image to a 24-bit RGB image using a global - operator based on logarithmic compression of luminance values, imitating the human response to light. - - Handle to a FreeImage bitmap. - A gamma correction that is applied after the tone mapping. - A value of 1 means no correction. - Scale factor allowing to adjust the brightness of the output image. - Handle to a FreeImage bitmap. - - - - Converts a High Dynamic Range image to a 24-bit RGB image using a global operator inspired - by photoreceptor physiology of the human visual system. - - Handle to a FreeImage bitmap. - Controls the overall image intensity in the range [-8, 8]. - Controls the overall image contrast in the range [0.3, 1.0[. - Handle to a FreeImage bitmap. - - - - Apply the Gradient Domain High Dynamic Range Compression to a RGBF image and convert to 24-bit RGB. - - Handle to a FreeImage bitmap. - Color saturation (s parameter in the paper) in [0.4..0.6] - Atenuation factor (beta parameter in the paper) in [0.8..0.9] - Handle to a FreeImage bitmap. - - - - Compresses a source buffer into a target buffer, using the ZLib library. - - Pointer to the target buffer. - Size of the target buffer. - Must be at least 0.1% larger than source_size plus 12 bytes. - Pointer to the source buffer. - Size of the source buffer. - The actual size of the compressed buffer, or 0 if an error occurred. - - - - Decompresses a source buffer into a target buffer, using the ZLib library. - - Pointer to the target buffer. - Size of the target buffer. - Must have been saved outlide of zlib. - Pointer to the source buffer. - Size of the source buffer. - The actual size of the uncompressed buffer, or 0 if an error occurred. - - - - Compresses a source buffer into a target buffer, using the ZLib library. - - Pointer to the target buffer. - Size of the target buffer. - Must be at least 0.1% larger than source_size plus 24 bytes. - Pointer to the source buffer. - Size of the source buffer. - The actual size of the compressed buffer, or 0 if an error occurred. - - - - Decompresses a source buffer into a target buffer, using the ZLib library. - - Pointer to the target buffer. - Size of the target buffer. - Must have been saved outlide of zlib. - Pointer to the source buffer. - Size of the source buffer. - The actual size of the uncompressed buffer, or 0 if an error occurred. - - - - Generates a CRC32 checksum. - - The CRC32 checksum to begin with. - Pointer to the source buffer. - If the value is 0, the function returns the required initial value for the crc. - Size of the source buffer. - - - - - Allocates a new object. - This object must be destroyed with a call to - when no longer in use. - - The new . - - - - Delete a previously allocated object. - - The to destroy. - - - - Creates and returns a copy of a object. - - The to clone. - The new . - - - - Returns the tag field name (unique inside a metadata model). - - The tag field. - The field name. - - - - Returns the tag description. - - The tag field. - The description or NULL if unavailable. - - - - Returns the tag ID. - - The tag field. - The ID or 0 if unavailable. - - - - Returns the tag data type. - - The tag field. - The tag type. - - - - Returns the number of components in the tag (in tag type units). - - The tag field. - The number of components. - - - - Returns the length of the tag value in bytes. - - The tag field. - The length of the tag value. - - - - Returns the tag value. - It is up to the programmer to interpret the returned pointer correctly, - according to the results of GetTagType and GetTagCount. - - The tag field. - Pointer to the value. - - - - Sets the tag field name. - - The tag field. - The new name. - Returns true on success, false on failure. - - - - Sets the tag description. - - The tag field. - The new description. - Returns true on success, false on failure. - - - - Sets the tag ID. - - The tag field. - The new ID. - Returns true on success, false on failure. - - - - Sets the tag data type. - - The tag field. - The new type. - Returns true on success, false on failure. - - - - Sets the number of data in the tag. - - The tag field. - New number of data. - Returns true on success, false on failure. - - - - Sets the length of the tag value in bytes. - - The tag field. - The new length. - Returns true on success, false on failure. - - - - Sets the tag value. - - The tag field. - Pointer to the new value. - Returns true on success, false on failure. - - - - Provides information about the first instance of a tag that matches the metadata model. - - The model to match. - Handle to a FreeImage bitmap. - Tag that matches the metadata model. - Unique search handle that can be used to call FindNextMetadata or FindCloseMetadata. - Null if the metadata model does not exist. - - - - Find the next tag, if any, that matches the metadata model argument in a previous call - to FindFirstMetadata, and then alters the tag object contents accordingly. - - Unique search handle provided by FindFirstMetadata. - Tag that matches the metadata model. - Returns true on success, false on failure. - - - - Closes the specified metadata search handle and releases associated resources. - - The handle to close. - - - - Retrieve a metadata attached to a dib. - - The metadata model to look for. - Handle to a FreeImage bitmap. - The metadata field name. - A FITAG structure returned by the function. - Returns true on success, false on failure. - - - - Attach a new FreeImage tag to a dib. - - The metadata model used to store the tag. - Handle to a FreeImage bitmap. - The tag field name. - The FreeImage tag to be attached. - Returns true on success, false on failure. - - - - Returns the number of tags contained in the model metadata model attached to the input dib. - - The metadata model. - Handle to a FreeImage bitmap. - Number of tags contained in the metadata model. - - - - Copies the metadata of FreeImage bitmap to another. - - The FreeImage bitmap to copy the metadata to. - The FreeImage bitmap to copy the metadata from. - Returns true on success, false on failure. - - - - Converts a FreeImage tag structure to a string that represents the interpreted tag value. - The function is not thread safe. - - The metadata model. - The interpreted tag value. - Reserved. - The representing string. - - - - This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - 1-bit images rotation is limited to integer multiple of 90°. - null is returned for other values. - - Handle to a FreeImage bitmap. - The angle of rotation. - Handle to a FreeImage bitmap. - - - - This function performs a rotation and / or translation of an 8-bit greyscale, - 24- or 32-bit image, using a 3rd order (cubic) B-Spline. - - Handle to a FreeImage bitmap. - The angle of rotation. - Horizontal image translation. - Vertical image translation. - Rotation center x-coordinate. - Rotation center y-coordinate. - When true the irrelevant part of the image is set to a black color, - otherwise, a mirroring technique is used to fill irrelevant pixels. - Handle to a FreeImage bitmap. - - - - Flip the input dib horizontally along the vertical axis. - - Handle to a FreeImage bitmap. - Returns true on success, false on failure. - - - - Flip the input dib vertically along the horizontal axis. - - Handle to a FreeImage bitmap. - Returns true on success, false on failure. - - - - Performs a lossless rotation or flipping on a JPEG file. - - Source file. - Destination file; can be the source file; will be overwritten. - The operation to apply. - To avoid lossy transformation, you can set the perfect parameter to true. - Returns true on success, false on failure. - - - - Performs resampling (or scaling, zooming) of a greyscale or RGB(A) image - to the desired destination width and height. - - Handle to a FreeImage bitmap. - Destination width. - Destination height. - The filter to apply. - Handle to a FreeImage bitmap. - - - - Creates a thumbnail from a greyscale or RGB(A) image, keeping aspect ratio. - - Handle to a FreeImage bitmap. - Thumbnail square size. - When true HDR images are transperantly converted to standard images. - Handle to a FreeImage bitmap. - - - - Perfoms an histogram transformation on a 8-, 24- or 32-bit image. - - Handle to a FreeImage bitmap. - The lookup table. - It's size is assumed to be 256 in length. - The color channel to be transformed. - Returns true on success, false on failure. - - - - Performs gamma correction on a 8-, 24- or 32-bit image. - - Handle to a FreeImage bitmap. - The parameter represents the gamma value to use (gamma > 0). - A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it. - Returns true on success, false on failure. - - - - Adjusts the brightness of a 8-, 24- or 32-bit image by a certain amount. - - Handle to a FreeImage bitmap. - A value 0 means no change, - less than 0 will make the image darker and greater than 0 will make the image brighter. - Returns true on success, false on failure. - - - - Adjusts the contrast of a 8-, 24- or 32-bit image by a certain amount. - - Handle to a FreeImage bitmap. - A value 0 means no change, - less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image. - Returns true on success, false on failure. - - - - Inverts each pixel data. - - Handle to a FreeImage bitmap. - Returns true on success, false on failure. - - - - Computes the image histogram. - - Handle to a FreeImage bitmap. - Array of integers with a size of 256. - Channel to compute from. - Returns true on success, false on failure. - - - - Retrieves the red, green, blue or alpha channel of a 24- or 32-bit image. - - Handle to a FreeImage bitmap. - The color channel to extract. - Handle to a FreeImage bitmap. - - - - Insert a 8-bit dib into a 24- or 32-bit image. - Both images must have to same width and height. - - Handle to a FreeImage bitmap. - Handle to the bitmap to insert. - The color channel to replace. - Returns true on success, false on failure. - - - - Retrieves the real part, imaginary part, magnitude or phase of a complex image. - - Handle to a FreeImage bitmap. - The color channel to extract. - Handle to a FreeImage bitmap. - - - - Set the real or imaginary part of a complex image. - Both images must have to same width and height. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - The color channel to replace. - Returns true on success, false on failure. - - - - Copy a sub part of the current dib image. - - Handle to a FreeImage bitmap. - Specifies the left position of the cropped rectangle. - Specifies the top position of the cropped rectangle. - Specifies the right position of the cropped rectangle. - Specifies the bottom position of the cropped rectangle. - Handle to a FreeImage bitmap. - - - - Alpha blend or combine a sub part image with the current dib image. - The bit depth of the dst bitmap must be greater than or equal to the bit depth of the src. - - Handle to a FreeImage bitmap. - Handle to a FreeImage bitmap. - Specifies the left position of the sub image. - Specifies the top position of the sub image. - alpha blend factor. - The source and destination images are alpha blended if alpha=0..255. - If alpha > 255, then the source image is combined to the destination image. - Returns true on success, false on failure. - - - - This function composite a transparent foreground image against a single background color or - against a background image. - - Handle to a FreeImage bitmap. - When true the background of fg is used if it contains one. - The application background is used if useFileBkg is false. - Image used as background when useFileBkg is false or fg has no background - and appBkColor is null. - Handle to a FreeImage bitmap. - - - - This function composite a transparent foreground image against a single background color or - against a background image. - - Handle to a FreeImage bitmap. - When true the background of fg is used if it contains one. - The application background is used if useFileBkg is false - and 'appBkColor' is not null. - Image used as background when useFileBkg is false or fg has no background - and appBkColor is null. - Handle to a FreeImage bitmap. - - - - Performs a lossless crop on a JPEG file. - - Source filename. - Destination filename. - Specifies the left position of the cropped rectangle. - Specifies the top position of the cropped rectangle. - Specifies the right position of the cropped rectangle. - Specifies the bottom position of the cropped rectangle. - Returns true on success, false on failure. - - - - Applies the alpha value of each pixel to its color components. - The aplha value stays unchanged. - Only works with 32-bits color depth. - - Handle to a FreeImage bitmap. - Returns true on success, false on failure. - - - - Solves a Poisson equation, remap result pixels to [0..1] and returns the solution. - - Handle to a FreeImage bitmap. - Number of cycles in the multigrid algorithm (usually 2 or 3) - Handle to a FreeImage bitmap. - - - - Creates a lookup table to be used with which may adjusts brightness and - contrast, correct gamma and invert the image with a single call to . - - Output lookup table to be used with . - The size of 'lookUpTable' is assumed to be 256. - Percentage brightness value where -100 <= brightness <= 100. - A value of 0 means no change, less than 0 will make the image darker and greater - than 0 will make the image brighter. - Percentage contrast value where -100 <= contrast <= 100. - A value of 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - Gamma value to be used for gamma correction. - A value of 1.0 leaves the image alone, less than one darkens it, - and greater than one lightens it. - If set to true, the image will be inverted. - The number of adjustments applied to the resulting lookup table - compared to a blind lookup table. - - This function creates a lookup table to be used with which may adjust - brightness and contrast, correct gamma and invert the image with a single call to - . If more than one of these image display properties need to be adjusted, - using a combined lookup table should be preferred over calling each adjustment function - separately. That's particularly true for huge images or if performance is an issue. Then, - the expensive process of iterating over all pixels of an image is performed only once and - not up to four times. - - Furthermore, the lookup table created does not depend on the order, in which each single - adjustment operation is performed. Due to rounding and byte casting issues, it actually - matters in which order individual adjustment operations are performed. Both of the following - snippets most likely produce different results: - - - // snippet 1: contrast, brightness - AdjustContrast(dib, 15.0); - AdjustBrightness(dib, 50.0); - - - - // snippet 2: brightness, contrast - AdjustBrightness(dib, 50.0); - AdjustContrast(dib, 15.0); - - - Better and even faster would be snippet 3: - - - // snippet 3: - byte[] lut = new byte[256]; - GetAdjustColorsLookupTable(lut, 50.0, 15.0, 1.0, false); - AdjustCurve(dib, lut, FREE_IMAGE_COLOR_CHANNEL.FICC_RGB); - - - This function is also used internally by , which does not return the - lookup table, but uses it to call on the passed image. - - - - - Adjusts an image's brightness, contrast and gamma as well as it may - optionally invert the image within a single operation. - - Handle to a FreeImage bitmap. - Percentage brightness value where -100 <= brightness <= 100. - A value of 0 means no change, less than 0 will make the image darker and greater - than 0 will make the image brighter. - Percentage contrast value where -100 <= contrast <= 100. - A value of 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - Gamma value to be used for gamma correction. - A value of 1.0 leaves the image alone, less than one darkens it, - and greater than one lightens it. - This parameter must not be zero or smaller than zero. - If so, it will be ignored and no gamma correction will be performed on the image. - If set to true, the image will be inverted. - Returns true on success, false on failure. - - This function adjusts an image's brightness, contrast and gamma as well as it - may optionally invert the image within a single operation. If more than one of - these image display properties need to be adjusted, using this function should - be preferred over calling each adjustment function separately. That's particularly - true for huge images or if performance is an issue. - - This function relies on , - which creates a single lookup table, that combines all adjustment operations requested. - - Furthermore, the lookup table created by does - not depend on the order, in which each single adjustment operation is performed. - Due to rounding and byte casting issues, it actually matters in which order individual - adjustment operations are performed. Both of the following snippets most likely produce - different results: - - - // snippet 1: contrast, brightness - AdjustContrast(dib, 15.0); - AdjustBrightness(dib, 50.0); - - - - // snippet 2: brightness, contrast - AdjustBrightness(dib, 50.0); - AdjustContrast(dib, 15.0); - - - Better and even faster would be snippet 3: - - - // snippet 3: - AdjustColors(dib, 50.0, 15.0, 1.0, false); - - - - - - Applies color mapping for one or several colors on a 1-, 4- or 8-bit - palletized or a 16-, 24- or 32-bit high color image. - - Handle to a FreeImage bitmap. - Array of colors to be used as the mapping source. - Array of colors to be used as the mapping destination. - The number of colors to be mapped. This is the size of both - srccolors and dstcolors. - If true, 32-bit images and colors are treated as 24-bit. - If true, source and destination colors are swapped, that is, - each destination color is also mapped to the corresponding source color. - The total number of pixels changed. - - This function maps up to colors specified in - to these specified in . - Thereby, color srccolors[N], if found in the image, will be replaced by color - dstcolors[N]. If is true, additionally all colors - specified in are also mapped to these specified - in . For high color images, the actual image data will be - modified whereas, for palletized images only the palette will be changed. - - The function returns the number of pixels changed or zero, if no pixels were changed. - - Both arrays and are assumed - not to hold less than colors. - - For 16-bit images, all colors specified are transparently converted to their - proper 16-bit representation (either in RGB555 or RGB565 format, which is determined - by the image's red- green- and blue-mask). - - Note, that this behaviour is different from what does, - which modifies the actual image data on palletized images. - - - - - Swaps two specified colors on a 1-, 4- or 8-bit palletized - or a 16-, 24- or 32-bit high color image. - - Handle to a FreeImage bitmap. - One of the two colors to be swapped. - The other of the two colors to be swapped. - If true, 32-bit images and colors are treated as 24-bit. - The total number of pixels changed. - - This function swaps the two specified colors and - on a palletized or high color image. - For high color images, the actual image data will be modified whereas, for palletized - images only the palette will be changed. - - Note, that this behaviour is different from what does, - which modifies the actual image data on palletized images. - - This is just a thin wrapper for and resolves to: - - - return ApplyColorMapping(dib, color_a, color_b, 1, ignore_alpha, true); - - - - - - Applies palette index mapping for one or several indices - on a 1-, 4- or 8-bit palletized image. - - Handle to a FreeImage bitmap. - Array of palette indices to be used as the mapping source. - Array of palette indices to be used as the mapping destination. - The number of palette indices to be mapped. This is the size of both - srcindices and dstindices - If true, source and destination palette indices are swapped, that is, - each destination index is also mapped to the corresponding source index. - The total number of pixels changed. - - This function maps up to palette indices specified in - to these specified in . - Thereby, index srcindices[N], if present in the image, will be replaced by index - dstindices[N]. If is true, additionally all indices - specified in are also mapped to these specified in - . - - The function returns the number of pixels changed or zero, if no pixels were changed. - Both arrays and are assumed not to - hold less than indices. - - Note, that this behaviour is different from what does, which - modifies the actual image data on palletized images. - - - - - Swaps two specified palette indices on a 1-, 4- or 8-bit palletized image. - - Handle to a FreeImage bitmap. - One of the two palette indices to be swapped. - The other of the two palette indices to be swapped. - The total number of pixels changed. - - This function swaps the two specified palette indices index_a and - index_b on a palletized image. Therefore, not the palette, but the - actual image data will be modified. - - Note, that this behaviour is different from what does on palletized images, - which only swaps the colors in the palette. - - This is just a thin wrapper for and resolves to: - - - return ApplyPaletteIndexMapping(dib, index_a, index_b, 1, true); - - - - - - Array containing all 'FREE_IMAGE_MDMODEL's. - - - - - Stores handles used to read from streams. - - - - - Version of the wrapper library. - - - - - Returns the internal version of this FreeImage .NET wrapper. - - The internal version of this FreeImage .NET wrapper. - - - - Returns the version of the native FreeImage library. - - The version of the native FreeImage library. - - - - Returns a value indicating if the FreeImage library is available or not. - See remarks for further details. - - false if the file is not available or out of date; - true, otherwise. - - The FreeImage.NET library is a wrapper for the native C++ library - (FreeImage.dll ... dont mix ist up with this library FreeImageNet.dll). - The native library must be either in the same folder as the program's - executable or in a folder contained in the envirent variable PATH - (for example %WINDIR%\System32). - Further more must both libraries, including the program itself, - be the same architecture (x86 or x64). - - - - - Creates a new bitmap in memory. - - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new Bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - Handle to a FreeImage bitmap. - - - - Creates a new bitmap in memory. - - Type of the image. - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new Bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - Handle to a FreeImage bitmap. - - - - Allocates a new image of the specified width, height and bit depth and optionally - fills it with the specified color. See remarks for further details. - - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmaps. - The color to fill the bitmap with or null. - Options to enable or disable function-features. - The palette of the bitmap or null. - Handle to a FreeImage bitmap. - - This function is an extension to , which additionally supports - specifying a palette to be set for the newly create image, as well as specifying a - background color, the newly created image should initially be filled with. - - Basically, this function internally relies on function , followed by a - call to . This is why both parameters - and behave the same as it is - documented for function . - So, please refer to the documentation of to - learn more about parameters and . - - The palette specified through parameter is only copied to the - newly created image, if the desired bit depth is smaller than or equal to 8 bits per pixel. - In other words, the parameter is only taken into account for - palletized images. So, for an 8-bit image, the length is 256, for an 4-bit image it is 16 - and it is 2 for a 1-bit image. In other words, this function does not support partial palettes. - - However, specifying a palette is not necesarily needed, even for palletized images. This - function is capable of implicitly creating a palette, if is null. - If the specified background color is a greyscale value (red = green = blue) or if option - is specified, a greyscale palette - is created. For a 1-bit image, only if the specified background color is either black or white, - a monochrome palette, consisting of black and white only is created. In any case, the darker - colors are stored at the smaller palette indices. - - If the specified background color is not a greyscale value, or is neither black nor white - for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - palette. For this operation, option - is implicit, so the specified is applied to the palette entry, - specified by the background color's field. - The image is then filled with this palette index. - - This function returns a newly created image as function does, if both - parameters and are null. - If only is null, the palette pointed to by - parameter is initially set for the new image, if a palletized - image of type is created. - However, in the latter case, this function returns an image, whose - pixels are all initialized with zeros so, the image will be filled with the color of the - first palette entry. - - - - - Allocates a new image of the specified width, height and bit depth and optionally - fills it with the specified color. See remarks for further details. - - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmaps. - The color to fill the bitmap with or null. - Options to enable or disable function-features. - The palette of the bitmap or null. - Red part of the color layout. - eg: 0xFF0000 - Green part of the color layout. - eg: 0x00FF00 - Blue part of the color layout. - eg: 0x0000FF - Handle to a FreeImage bitmap. - - This function is an extension to , which additionally supports - specifying a palette to be set for the newly create image, as well as specifying a - background color, the newly created image should initially be filled with. - - Basically, this function internally relies on function , followed by a - call to . This is why both parameters - and behave the same as it is - documented for function . - So, please refer to the documentation of to - learn more about parameters and . - - The palette specified through parameter is only copied to the - newly created image, if the desired bit depth is smaller than or equal to 8 bits per pixel. - In other words, the parameter is only taken into account for - palletized images. So, for an 8-bit image, the length is 256, for an 4-bit image it is 16 - and it is 2 for a 1-bit image. In other words, this function does not support partial palettes. - - However, specifying a palette is not necesarily needed, even for palletized images. This - function is capable of implicitly creating a palette, if is null. - If the specified background color is a greyscale value (red = green = blue) or if option - is specified, a greyscale palette - is created. For a 1-bit image, only if the specified background color is either black or white, - a monochrome palette, consisting of black and white only is created. In any case, the darker - colors are stored at the smaller palette indices. - - If the specified background color is not a greyscale value, or is neither black nor white - for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - palette. For this operation, option - is implicit, so the specified is applied to the palette entry, - specified by the background color's field. - The image is then filled with this palette index. - - This function returns a newly created image as function does, if both - parameters and are null. - If only is null, the palette pointed to by - parameter is initially set for the new image, if a palletized - image of type is created. - However, in the latter case, this function returns an image, whose - pixels are all initialized with zeros so, the image will be filled with the color of the - first palette entry. - - - - - Allocates a new image of the specified type, width, height and bit depth and optionally - fills it with the specified color. See remarks for further details. - - The type of the specified color. - Type of the image. - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - The color to fill the bitmap with or null. - Options to enable or disable function-features. - The palette of the bitmap or null. - Handle to a FreeImage bitmap. - - This function is an extension to , which additionally supports - specifying a palette to be set for the newly create image, as well as specifying a - background color, the newly created image should initially be filled with. - - Basically, this function internally relies on function , followed by a - call to . This is why both parameters - and behave the same as it is - documented for function . So, please refer to the - documentation of to learn more about parameters color and options. - - The palette specified through parameter palette is only copied to the newly created - image, if its image type is and the desired bit - depth is smaller than or equal to 8 bits per pixel. In other words, the - palette is only taken into account for palletized images. However, if the preceding conditions - match and if is not null, the palette is assumed to be at - least as large as the size of a fully populated palette for the desired bit depth. - So, for an 8-bit image, this length is 256, for an 4-bit image it is 16 and it is - 2 for a 1-bit image. In other words, this function does not support partial palettes. - - However, specifying a palette is not necesarily needed, even for palletized images. This - function is capable of implicitly creating a palette, if is null. - If the specified background color is a greyscale value (red = green = blue) or if option - is specified, a greyscale palette - is created. For a 1-bit image, only if the specified background color is either black or white, - a monochrome palette, consisting of black and white only is created. In any case, the darker - colors are stored at the smaller palette indices. - - If the specified background color is not a greyscale value, or is neither black nor white - for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - palette. For this operation, option - is implicit, so the specified color is applied to the palette entry, specified by the - background color's field. The image is then filled with - this palette index. - - This function returns a newly created image as function does, if both - parameters and are null. - If only is null, the palette pointed to by - parameter is initially set for the new image, if a palletized - image of type is created. - However, in the latter case, this function returns an image, whose - pixels are all initialized with zeros so, the image will be filled with the color of the - first palette entry. - - - - - Allocates a new image of the specified type, width, height and bit depth and optionally - fills it with the specified color. See remarks for further details. - - The type of the specified color. - Type of the image. - Width of the new bitmap. - Height of the new bitmap. - Bit depth of the new bitmap. - Supported pixel depth: 1-, 4-, 8-, 16-, 24-, 32-bit per pixel for standard bitmap - The color to fill the bitmap with or null. - Options to enable or disable function-features. - The palette of the bitmap or null. - Red part of the color layout. - eg: 0xFF0000 - Green part of the color layout. - eg: 0x00FF00 - Blue part of the color layout. - eg: 0x0000FF - Handle to a FreeImage bitmap. - - This function is an extension to , which additionally supports - specifying a palette to be set for the newly create image, as well as specifying a - background color, the newly created image should initially be filled with. - - Basically, this function internally relies on function , followed by a - call to . This is why both parameters - and behave the same as it is - documented for function . So, please refer to the - documentation of to learn more about parameters color and options. - - The palette specified through parameter palette is only copied to the newly created - image, if its image type is and the desired bit - depth is smaller than or equal to 8 bits per pixel. In other words, the - palette is only taken into account for palletized images. However, if the preceding conditions - match and if is not null, the palette is assumed to be at - least as large as the size of a fully populated palette for the desired bit depth. - So, for an 8-bit image, this length is 256, for an 4-bit image it is 16 and it is - 2 for a 1-bit image. In other words, this function does not support partial palettes. - - However, specifying a palette is not necesarily needed, even for palletized images. This - function is capable of implicitly creating a palette, if is null. - If the specified background color is a greyscale value (red = green = blue) or if option - is specified, a greyscale palette - is created. For a 1-bit image, only if the specified background color is either black or white, - a monochrome palette, consisting of black and white only is created. In any case, the darker - colors are stored at the smaller palette indices. - - If the specified background color is not a greyscale value, or is neither black nor white - for a 1-bit image, solely this specified color is injected into the otherwise black-initialized - palette. For this operation, option - is implicit, so the specified color is applied to the palette entry, specified by the - background color's field. The image is then filled with - this palette index. - - This function returns a newly created image as function does, if both - parameters and are null. - If only is null, the palette pointed to by - parameter is initially set for the new image, if a palletized - image of type is created. - However, in the latter case, this function returns an image, whose - pixels are all initialized with zeros so, the image will be filled with the color of the - first palette entry. - - - - - Converts a FreeImage bitmap to a .NET . - - Handle to a FreeImage bitmap. - The converted .NET . - Copying metadata has been disabled until a proper way - of reading and storing metadata in a .NET bitmap is found. - - is null. - - The image type of is not FIT_BITMAP. - - - - Converts a FreeImage bitmap to a .NET . - - Handle to a FreeImage bitmap. - When true existing metadata will be copied. - The converted .NET . - Copying metadata has been disabled until a proper way - of reading and storing metadata in a .NET bitmap is found. - - is null. - - The image type of is not FIT_BITMAP. - - - - Converts an .NET into a FreeImage bitmap. - - The to convert. - Handle to a FreeImage bitmap. - Copying metadata has been disabled until a proper way - of reading and storing metadata in a .NET bitmap is found. - - is null. - - The bitmaps pixelformat is invalid. - - - - Converts an .NET into a FreeImage bitmap. - - The to convert. - When true existing metadata will be copied. - Handle to a FreeImage bitmap. - Copying metadata has been disabled until a proper way - of reading and storing metadata in a .NET bitmap is found. - - is null. - - The bitmaps pixelformat is invalid. - - - - Converts a raw bitmap to a FreeImage bitmap. - - Array of bytes containing the raw bitmap. - The type of the raw bitmap. - The width in pixels of the raw bitmap. - The height in pixels of the raw bitmap. - Defines the total width of a scanline in the raw bitmap, - including padding bytes. - The bit depth (bits per pixel) of the raw bitmap. - The bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap is stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - Handle to a FreeImage bitmap. - - - - Converts a raw bitmap to a FreeImage bitmap. - - Pointer to the memory block containing the raw bitmap. - The type of the raw bitmap. - The width in pixels of the raw bitmap. - The height in pixels of the raw bitmap. - Defines the total width of a scanline in the raw bitmap, - including padding bytes. - The bit depth (bits per pixel) of the raw bitmap. - The bit mask describing the bits used to store a single - pixel's red component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's green component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - The bit mask describing the bits used to store a single - pixel's blue component in the raw bitmap. This is only applied to 16-bpp raw bitmaps. - If true, the raw bitmap is stored in top-down order (top-left pixel first) - and in bottom-up order (bottom-left pixel first) otherwise. - Handle to a FreeImage bitmap. - - - - Saves a .NET to a file. - - The .NET to save. - Name of the file to save to. - Returns true on success, false on failure. - - or is null. - - The bitmaps pixelformat is invalid. - - - - Saves a .NET to a file. - - The .NET to save. - Name of the file to save to. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - or is null. - - The bitmaps pixelformat is invalid. - - - - Saves a .NET to a file. - - The .NET to save. - Name of the file to save to. - Format of the bitmap. If the format should be taken from the - filename use . - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - or is null. - - The bitmaps pixelformat is invalid. - - - - Loads a FreeImage bitmap. - The file will be loaded with default loading flags. - - The complete name of the file to load. - Handle to a FreeImage bitmap. - - does not exists. - - - - Loads a FreeImage bitmap. - Load flags can be provided by the flags parameter. - - The complete name of the file to load. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - does not exists. - - - - Loads a FreeImage bitmap. - In case the loading format is the files - real format is being analysed. If no plugin can read the file, format remains - and 0 is returned. - The file will be loaded with default loading flags. - - The complete name of the file to load. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadEx it will be returned in format. - Handle to a FreeImage bitmap. - - does not exists. - - - - Loads a FreeImage bitmap. - In case the loading format is the files - real format is being analysed. If no plugin can read the file, format remains - and 0 is returned. - Load flags can be provided by the flags parameter. - - The complete name of the file to load. - Flags to enable or disable plugin-features. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadEx it will be returned in format. - - Handle to a FreeImage bitmap. - - does not exists. - - - - Loads a .NET from a file. - - Name of the file to be loaded. - Format of the image. If the format should be taken from the - filename use . - Flags to enable or disable plugin-features. - The loaded .NET . - - does not exists. - - The image type of the image is not . - - - - Deletes a previously loaded FreeImage bitmap from memory and resets the handle to 0. - - Handle to a FreeImage bitmap. - - - - Saves a previously loaded FreeImage bitmap to a file. - The format is taken off the filename. - If no suitable format was found false will be returned. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - In case the loading format is - the format is taken off the filename. - If no suitable format was found false will be returned. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Format of the image. If the format should be taken from the - filename use . - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - The format is taken off the filename. - If no suitable format was found false will be returned. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - When true the structure will be unloaded on success. - If the function failed and returned false, the bitmap was not unloaded. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - The format is taken off the filename. - If no suitable format was found false will be returned. - Save flags can be provided by the flags parameter. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - The format is taken off the filename. - If no suitable format was found false will be returned. - Save flags can be provided by the flags parameter. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Flags to enable or disable plugin-features. - When true the structure will be unloaded on success. - If the function failed and returned false, the bitmap was not unloaded. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - In case the loading format is - the format is taken off the filename. - If no suitable format was found false will be returned. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Format of the image. If the format should be taken from the - filename use . - When true the structure will be unloaded on success. - If the function failed and returned false, the bitmap was not unloaded. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - In case the loading format is - the format is taken off the filename. - If no suitable format was found false will be returned. - Save flags can be provided by the flags parameter. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Format of the image. If the format should be taken from the - filename use . - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - or is null. - - - - Saves a previously loaded FreeImage bitmap to a file. - In case the loading format is - the format is taken off the filename. - If no suitable format was found false will be returned. - Save flags can be provided by the flags parameter. - The bitmaps color depth can be set by 'colorDepth'. - If set to a suitable color depth - will be taken if available. - - Handle to a FreeImage bitmap. - The complete name of the file to save to. - The extension will be corrected if it is no valid extension for the - selected format or if no extension was specified. - Format of the image. If the format should be taken from the - filename use . - Flags to enable or disable plugin-features. - The new color depth of the bitmap. - Set to if Save should take the - best suitable color depth. - If a color depth is selected that the provided format cannot write an - error-message will be thrown. - When true the structure will be unloaded on success. - If the function failed and returned false, the bitmap was not unloaded. - Returns true on success, false on failure. - - A direct color conversion failed. - - or is null. - - - - Loads a FreeImage bitmap. - The stream must be set to the correct position before calling LoadFromStream. - - The stream to read from. - Handle to a FreeImage bitmap. - - is null. - - is not capable of reading. - - - - Loads a FreeImage bitmap. - The stream must be set to the correct position before calling LoadFromStream. - - The stream to read from. - Flags to enable or disable plugin-features. - Handle to a FreeImage bitmap. - - is null. - - is not capable of reading. - - - - Loads a FreeImage bitmap. - In case the loading format is the - bitmaps real format is being analysed. - The stream must be set to the correct position before calling LoadFromStream. - - The stream to read from. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadFromStream it will be returned in format. - Handle to a FreeImage bitmap. - - is null. - - is not capable of reading. - - - - Loads a FreeImage bitmap. - In case the loading format is - the bitmaps real format is being analysed. - The stream must be set to the correct position before calling LoadFromStream. - - The stream to read from. - Flags to enable or disable plugin-features. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadFromStream it will be returned in format. - Handle to a FreeImage bitmap. - - is null. - - is not capable of reading. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - When true the structure will be unloaded on success. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - Flags to enable or disable plugin-features. - When true the structure will be unloaded on success. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - Flags to enable or disable plugin-features. - The new color depth of the bitmap. - Set to if SaveToStream should - take the best suitable color depth. - If a color depth is selected that the provided format cannot write an - error-message will be thrown. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Saves a previously loaded FreeImage bitmap to a stream. - The stream must be set to the correct position before calling SaveToStream. - - Handle to a FreeImage bitmap. - The stream to write to. - Format of the image. - Flags to enable or disable plugin-features. - The new color depth of the bitmap. - Set to if SaveToStream should - take the best suitable color depth. - If a color depth is selected that the provided format cannot write an - error-message will be thrown. - When true the structure will be unloaded on success. - Returns true on success, false on failure. - - or is null. - - cannot write. - - - - Checks if an extension is valid for a certain format. - - The desired format. - The desired extension. - True if the extension is valid for the given format, false otherwise. - - is null. - - - - Checks if an extension is valid for a certain format. - - The desired format. - The desired extension. - The string comparison type. - True if the extension is valid for the given format, false otherwise. - - is null. - - - - Checks if a filename is valid for a certain format. - - The desired format. - The desired filename. - True if the filename is valid for the given format, false otherwise. - - is null. - - - - Checks if a filename is valid for a certain format. - - The desired format. - The desired filename. - The string comparison type. - True if the filename is valid for the given format, false otherwise. - - is null. - - - - This function returns the primary (main or most commonly used?) extension of a certain - image format (fif). This is done by returning the first of all possible extensions - returned by GetFIFExtensionList(). - That assumes, that the plugin returns the extensions in ordered form. - The image format to obtain the primary extension for. - The primary extension of the specified image format. - - - - Loads a FreeImage multi-paged bitmap. - - The complete name of the file to load. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - - The complete name of the file to load. - When true performance is increased at the cost of memory. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - - The complete name of the file to load. - When true the bitmap will be loaded read only. - When true performance is increased at the cost of memory. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - - The complete name of the file to load. - When true a new bitmap is created. - When true the bitmap will be loaded read only. - When true performance is increased at the cost of memory. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - In case the loading format is the files real - format is being analysed. If no plugin can read the file, format remains - and 0 is returned. - - The complete name of the file to load. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadEx it will be returned in format. - When true a new bitmap is created. - When true the bitmap will be loaded read only. - When true performance is increased at the cost of memory. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - In case the loading format is the files - real format is being analysed. If no plugin can read the file, format remains - and 0 is returned. - Load flags can be provided by the flags parameter. - - The complete name of the file to load. - Format of the image. If the format is unknown use - . - In case a suitable format was found by LoadEx it will be returned in format. - Flags to enable or disable plugin-features. - When true a new bitmap is created. - When true the bitmap will be loaded read only. - When true performance is increased at the cost of memory. - Handle to a FreeImage multi-paged bitmap. - - does not exists while opening. - - - - Loads a FreeImage multi-paged bitmap. - - The stream to load the bitmap from. - Handle to a FreeImage multi-paged bitmap. - - - - Loads a FreeImage multi-paged bitmap. - In case the loading format is the files - real format is being analysed. If no plugin can read the file, format remains - and 0 is returned. - Load flags can be provided by the flags parameter. - - The stream to load the bitmap from. - Format of the image. If the format is unknown use - . - Flags to enable or disable plugin-features. - Handle to a FreeImage multi-paged bitmap. - - - - Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, applies any changes made to it. - - Handle to a FreeImage multi-paged bitmap. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, - applies any changes made to it. - On success the handle will be reset to null. - - Handle to a FreeImage multi-paged bitmap. - Returns true on success, false on failure. - - - - Closes a previously opened multi-page bitmap and, when the bitmap was not opened read-only, - applies any changes made to it. - On success the handle will be reset to null. - - Handle to a FreeImage multi-paged bitmap. - Flags to enable or disable plugin-features. - Returns true on success, false on failure. - - - - Retrieves the number of pages that are locked in a multi-paged bitmap. - - Handle to a FreeImage multi-paged bitmap. - Number of locked pages. - - is null. - - - - Retrieves a list locked pages of a multi-paged bitmap. - - Handle to a FreeImage multi-paged bitmap. - List containing the indexes of the locked pages. - - is null. - - - - Loads a FreeImage multi-paged bitmap from a stream and returns the - FreeImage memory stream used as temporary buffer. - The bitmap can not be modified by calling - , - , - or - . - - The stream to read from. - Format of the image. - Flags to enable or disable plugin-features. - The temporary memory buffer used to load the bitmap. - Handle to a FreeImage multi-paged bitmap. - - is null. - - can not read. - - - - Orders FreeImage to analyze the bitmap signature. - In case the stream is not seekable, the stream will have been used - and must be recreated for loading. - - Name of the stream to analyze. - Type of the bitmap. - - is null. - - can not read. - - - - Retrieves an hBitmap for a FreeImage bitmap. - Call FreeHbitmap(IntPtr) to free the handle. - - Handle to a FreeImage bitmap. - A reference device context. - Use IntPtr.Zero if no reference is available. - When true dib will be unloaded if the function succeeded. - The hBitmap for the FreeImage bitmap. - - is null. - - - - Returns an HBITMAP created by the CreateDIBitmap() function which in turn - has always the same color depth as the reference DC, which may be provided - through . The desktop DC will be used, - if IntPtr.Zero DC is specified. - Call to free the handle. - - Handle to a FreeImage bitmap. - Handle to a device context. - When true the structure will be unloaded on success. - If the function failed and returned false, the bitmap was not unloaded. - If the function succeeds, the return value is a handle to the - compatible bitmap. If the function fails, the return value is . - - is null. - - - - Creates a FreeImage DIB from a Device Context/Compatible Bitmap. - - Handle to the bitmap. - Handle to a device context. - Handle to a FreeImage bitmap. - - is null. - - - - Frees a bitmap handle. - - Handle to a bitmap. - True on success, false on failure. - - - - Retrieves a DIB's resolution in X-direction measured in 'dots per inch' (DPI) and not in - 'dots per meter'. - - Handle to a FreeImage bitmap. - The resolution in 'dots per inch'. - - is null. - - - - Retrieves a DIB's resolution in Y-direction measured in 'dots per inch' (DPI) and not in - 'dots per meter'. - - Handle to a FreeImage bitmap. - The resolution in 'dots per inch'. - - is null. - - - - Sets a DIB's resolution in X-direction measured in 'dots per inch' (DPI) and not in - 'dots per meter'. - - Handle to a FreeImage bitmap. - The new resolution in 'dots per inch'. - - is null. - - - - Sets a DIB's resolution in Y-direction measured in 'dots per inch' (DPI) and not in - 'dots per meter'. - - Handle to a FreeImage bitmap. - The new resolution in 'dots per inch'. - - is null. - - - - Returns whether the image is a greyscale image or not. - The function scans all colors in the bitmaps palette for entries where - red, green and blue are not all the same (not a grey color). - Supports 1-, 4- and 8-bit bitmaps. - - Handle to a FreeImage bitmap. - True if the image is a greyscale image, else false. - - is null. - - - - Returns a structure that represents the palette of a FreeImage bitmap. - - Handle to a FreeImage bitmap. - A structure representing the bitmaps palette. - - is null. - - - - Returns the structure of a FreeImage bitmap. - The structure is a copy, so changes will have no effect on - the bitmap itself. - - Handle to a FreeImage bitmap. - structure of the bitmap. - - is null. - - - - Returns the structure of a FreeImage bitmap. - The structure is a copy, so changes will have no effect on - the bitmap itself. - - Handle to a FreeImage bitmap. - structure of the bitmap. - - is null. - - - - Returns the pixelformat of the bitmap. - - Handle to a FreeImage bitmap. - of the bitmap. - - is null. - - - - Retrieves all parameters needed to create a new FreeImage bitmap from - the format of a .NET . - - The - of the .NET . - Returns the type used for the new bitmap. - Returns the color depth for the new bitmap. - Returns the red_mask for the new bitmap. - Returns the green_mask for the new bitmap. - Returns the blue_mask for the new bitmap. - True in case a matching conversion exists; else false. - - - - - Returns the for the specified - . - - The - for which to return the corresponding . - The for the specified - - - - - Retrieves all parameters needed to create a new FreeImage bitmap from - raw bits . - - The - of the data in memory. - The color depth for the data. - Returns the red_mask for the data. - Returns the green_mask for the data. - Returns the blue_mask for the data. - True in case a matching conversion exists; else false. - - - - - Compares two FreeImage bitmaps. - - The first bitmap to compare. - The second bitmap to compare. - Determines which components of the bitmaps will be compared. - True in case both bitmaps match the compare conditions, false otherwise. - - - - Returns the FreeImage bitmap's transparency table. - The array is empty in case the bitmap has no transparency table. - - Handle to a FreeImage bitmap. - The FreeImage bitmap's transparency table. - - is null. - - - - Set the FreeImage bitmap's transparency table. Only affects palletised bitmaps. - - Handle to a FreeImage bitmap. - The FreeImage bitmap's new transparency table. - - or is null. - - - - This function returns the number of unique colors actually used by the - specified 1-, 4-, 8-, 16-, 24- or 32-bit image. This might be different from - what function FreeImage_GetColorsUsed() returns, which actually returns the - palette size for palletised images. Works for - type images only. - - Handle to a FreeImage bitmap. - Returns the number of unique colors used by the image specified or - zero, if the image type cannot be handled. - - is null. - - - - Verifies whether the FreeImage bitmap is 16bit 555. - - The FreeImage bitmap to verify. - true if the bitmap is RGB16-555; otherwise false. - - - - Verifies whether the FreeImage bitmap is 16bit 565. - - The FreeImage bitmap to verify. - true if the bitmap is RGB16-565; otherwise false. - - - - Creates a new ICC-Profile for a FreeImage bitmap. - - Handle to a FreeImage bitmap. - The data of the new ICC-Profile. - The new ICC-Profile of the bitmap. - - is null. - - - - Creates a new ICC-Profile for a FreeImage bitmap. - - Handle to a FreeImage bitmap. - The data of the new ICC-Profile. - The number of bytes of to use. - The new ICC-Profile of the FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - When true the structure will be unloaded on success. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Threshold value when converting with - . - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Dither algorithm when converting - with . - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - The quantization algorithm for conversion to 8-bit color depth. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Threshold value when converting with - . - When true the structure will be unloaded on success. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Dither algorithm when converting with - . - When true the structure will be unloaded on success. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - The quantization algorithm for conversion to 8-bit color depth. - When true the structure will be unloaded on success. - Handle to a FreeImage bitmap. - - is null. - - - - Converts a FreeImage bitmap from one color depth to another. - If the conversion fails the original FreeImage bitmap is returned. - - Handle to a FreeImage bitmap. - The desired output format. - Threshold value when converting with - . - Dither algorithm when converting with - . - The quantization algorithm for conversion to 8-bit color depth. - When true the structure will be unloaded on success. - Handle to a FreeImage bitmap. - - is null. - - - - ColorQuantizeEx is an extension to the - method that provides additional options used to quantize a 24-bit image to any - number of colors (up to 256), as well as quantize a 24-bit image using a - provided palette. - - Handle to a FreeImage bitmap. - Specifies the color reduction algorithm to be used. - Size of the desired output palette. - The provided palette. - true to create a bitmap with the smallest possible - color depth for the specified . - Handle to a FreeImage bitmap. - - - - ColorQuantizeEx is an extension to the - method that provides additional options used to quantize a 24-bit image to any - number of colors (up to 256), as well as quantize a 24-bit image using a - partial or full provided palette. - - Handle to a FreeImage bitmap. - Specifies the color reduction algorithm to be used. - Size of the desired output palette. - The provided palette. - The desired color depth of the created image. - Handle to a FreeImage bitmap. - - - - Copies metadata from one FreeImage bitmap to another. - - Source FreeImage bitmap containing the metadata. - FreeImage bitmap to copy the metadata to. - Flags to switch different copy modes. - Returns -1 on failure else the number of copied tags. - - or is null. - - - - Returns the comment of a JPEG, PNG or GIF image. - - Handle to a FreeImage bitmap. - Comment of the FreeImage bitmp, or null in case no comment exists. - - is null. - - - - Sets the comment of a JPEG, PNG or GIF image. - - Handle to a FreeImage bitmap. - New comment of the FreeImage bitmap. - Use null to remove the comment. - Returns true on success, false on failure. - - is null. - - - - Retrieve a metadata attached to a FreeImage bitmap. - - The metadata model to look for. - Handle to a FreeImage bitmap. - The metadata field name. - A structure returned by the function. - Returns true on success, false on failure. - - is null. - - - - Attach a new metadata tag to a FreeImage bitmap. - - The metadata model used to store the tag. - Handle to a FreeImage bitmap. - The tag field name. - The to be attached. - Returns true on success, false on failure. - - is null. - - - - Provides information about the first instance of a tag that matches the metadata model. - - The model to match. - Handle to a FreeImage bitmap. - Tag that matches the metadata model. - Unique search handle that can be used to call FindNextMetadata or FindCloseMetadata. - Null if the metadata model does not exist. - - is null. - - - - Find the next tag, if any, that matches the metadata model argument in a previous call - to FindFirstMetadata, and then alters the tag object contents accordingly. - - Unique search handle provided by FindFirstMetadata. - Tag that matches the metadata model. - Returns true on success, false on failure. - - - - Closes the specified metadata search handle and releases associated resources. - - The handle to close. - - - - This dictionary links FIMETADATA handles and FREE_IMAGE_MDMODEL models. - - - - - This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - 1-bit images rotation is limited to integer multiple of 90°. - null is returned for other values. - - Handle to a FreeImage bitmap. - The angle of rotation. - Handle to a FreeImage bitmap. - - - - This function rotates a 1-, 8-bit greyscale or a 24-, 32-bit color image by means of 3 shears. - 1-bit images rotation is limited to integer multiple of 90°. - null is returned for other values. - - The type of the color to use as background. - Handle to a FreeImage bitmap. - The angle of rotation. - The color used used to fill the bitmap's background. - Handle to a FreeImage bitmap. - - - - Rotates a 4-bit color FreeImage bitmap. - Allowed values for are 90, 180 and 270. - In case is 0 or 360 a clone is returned. - 0 is returned for other values or in case the rotation fails. - - Handle to a FreeImage bitmap. - The angle of rotation. - Handle to a FreeImage bitmap. - - This function is kind of temporary due to FreeImage's lack of - rotating 4-bit images. It's particularly used by 's - method RotateFlip. This function will be removed as soon as FreeImage - supports rotating 4-bit images. - - - is null. - - - - Enlarges or shrinks the FreeImage bitmap selectively per side and fills newly added areas - with the specified background color. See remarks for further details. - - The type of the specified color. - Handle to a FreeImage bitmap. - The number of pixels, the image should be enlarged on its left side. - Negative values shrink the image on its left side. - The number of pixels, the image should be enlarged on its top side. - Negative values shrink the image on its top side. - The number of pixels, the image should be enlarged on its right side. - Negative values shrink the image on its right side. - The number of pixels, the image should be enlarged on its bottom side. - Negative values shrink the image on its bottom side. - The color, the enlarged sides of the image should be filled with. - Options that affect the color search process for palletized images. - Handle to a FreeImage bitmap. - - This function enlarges or shrinks an image selectively per side. - The main purpose of this function is to add borders to an image. - To add a border to any of the image's sides, a positive integer value must be passed in - any of the parameters , , - or . This value represents the border's - width in pixels. Newly created parts of the image (the border areas) are filled with the - specified . - Specifying a negative integer value for a certain side, will shrink or crop the image on - this side. Consequently, specifying zero for a certain side will not change the image's - extension on that side. - - So, calling this function with all parameters , , - and set to zero, is - effectively the same as calling function ; setting all parameters - , , and - to value equal to or smaller than zero, my easily be substituted - by a call to function . Both these cases produce a new image, which is - guaranteed not to be larger than the input image. Thus, since the specified - is not needed in these cases, - may be null. - - Both parameters and work according to - function . So, please refer to the documentation of - to learn more about parameters - and . For palletized images, the palette of the input image is - transparently copied to the newly created enlarged or shrunken image, so any color look-ups - are performed on this palette. - - - // create a white color
- RGBQUAD c;
- c.rgbRed = 0xFF;
- c.rgbGreen = 0xFF;
- c.rgbBlue = 0xFF;
- c.rgbReserved = 0x00;
-
- // add a white, symmetric 10 pixel wide border to the image
- dib2 = FreeImage_EnlargeCanvas(dib, 10, 10, 10, 10, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
-
- // add white, 20 pixel wide stripes to the top and bottom side of the image
- dib3 = FreeImage_EnlargeCanvas(dib, 0, 20, 0, 20, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
-
- // add white, 30 pixel wide stripes to the right side of the image and
- // cut off the 40 leftmost pixel columns
- dib3 = FreeImage_EnlargeCanvas(dib, -40, 0, 30, 0, c, FREE_IMAGE_COLOR_OPTIONS.FICO_RGB);
-
-
- - - Sets all pixels of the specified image to the color provided through the - parameter. See remarks for further details. - - The type of the specified color. - Handle to a FreeImage bitmap. - The color to fill the bitmap with. See remarks for further details. - Options that affect the color search process for palletized images. - true on success, false on failure. - - This function sets all pixels of an image to the color provided through - the parameter. is used for standard type images. - For non standard type images the underlaying structure is used. - - So, must be of type , if the image to be filled is of type - and must be a structure if the - image is of type and so on. - - However, the fill color is always specified through a structure - for all images of type . - So, for 32- and 24-bit images, the red, green and blue members of the - structure are directly used for the image's red, green and blue channel respectively. - Although alpha transparent colors are - supported, the alpha channel of a 32-bit image never gets modified by this function. - A fill color with an alpha value smaller than 255 gets blended with the image's actual - background color, which is determined from the image's bottom-left pixel. - So, currently using alpha enabled colors, assumes the image to be unicolor before the - fill operation. However, the field is only taken into account, - if option has been specified. - - For 16-bit images, the red-, green- and blue components of the specified color are - transparently translated into either the 16-bit 555 or 565 representation. This depends - on the image's actual red- green- and blue masks. - - Special attention must be payed for palletized images. Generally, the RGB color specified - is looked up in the image's palette. The found palette index is then used to fill the image. - There are some option flags, that affect this lookup process: - - - Value - Meaning - - - - - Uses the color, that is nearest to the specified color. - This is the default behavior and should always find a - color in the palette. However, the visual result may - far from what was expected and mainly depends on the - image's palette. - - - - - - Searches the image's palette for the specified color - but only uses the returned palette index, if the specified - color exactly matches the palette entry. Of course, - depending on the image's actual palette entries, this - operation may fail. In this case, the function falls back - to option - and uses the RGBQUAD's rgbReserved member (or its low nibble for 4-bit images - or its least significant bit (LSB) for 1-bit images) as - the palette index used for the fill operation. - - - - - - Does not perform any color lookup from the palette, but - uses the RGBQUAD's alpha channel member rgbReserved as - the palette index to be used for the fill operation. - However, for 4-bit images, only the low nibble of the - rgbReserved member are used and for 1-bit images, only - the least significant bit (LSB) is used. - - - - - - - - Returns the next higher possible color depth. - - Color depth to increase. - The next higher color depth or 0 if there is no valid color depth. - - - - Returns the next lower possible color depth. - - Color depth to decrease. - The next lower color depth or 0 if there is no valid color depth. - - - - Reads a null-terminated c-string. - - Pointer to the first char of the string. - The converted string. - - - - Changes a bitmaps color depth. - Used by SaveEx and SaveToStream. - - - - - Compares blocks of memory. - - A pointer to a block of memory to compare. - A pointer to a block of memory to compare. - Specifies the number of bytes to be compared. - true, if all bytes compare as equal, false otherwise. - - - - Compares blocks of memory. - - A pointer to a block of memory to compare. - A pointer to a block of memory to compare. - Specifies the number of bytes to be compared. - true, if all bytes compare as equal, false otherwise. - - - - Compares blocks of memory. - - A pointer to a block of memory to compare. - A pointer to a block of memory to compare. - Specifies the number of bytes to be compared. - true, if all bytes compare as equal, false otherwise. - - - - Compares blocks of memory. - - A pointer to a block of memory to compare. - A pointer to a block of memory to compare. - Specifies the number of bytes to be compared. - true, if all bytes compare as equal, false otherwise. - - - - Moves a block of memory from one location to another. - - A pointer to the starting address of the move destination. - A pointer to the starting address of the block of memory to be moved. - The size of the block of memory to move, in bytes. - - - - Moves a block of memory from one location to another. - - A pointer to the starting address of the move destination. - A pointer to the starting address of the block of memory to be moved. - The size of the block of memory to move, in bytes. - - - - Moves a block of memory from one location to another. - - A pointer to the starting address of the move destination. - A pointer to the starting address of the block of memory to be moved. - The size of the block of memory to move, in bytes. - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory from one location to another. - - A pointer to the starting address of the copied block's destination. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - CopyMemory runs faster than . - However, if both blocks overlap the result is undefined. - - - - - Copies a block of memory into an array. - - An array used as the destination of the copy process. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - - - Copies a block of memory into an array. - - An array used as the destination of the copy process. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - - - Copies a block of memory into an array. - - An array used as the destination of the copy process. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - - - Copies a block of memory into an array. - - An array used as the destination of the copy process. - A pointer to the starting address of the block of memory to copy. - The size of the block of memory to copy, in bytes. - - - - Copies the content of an array to a memory location. - - A pointer to the starting address of the copied block's destination. - An array used as the source of the copy process. - The size of the block of memory to copy, in bytes. - - - - Copies the content of an array to a memory location. - - A pointer to the starting address of the copied block's destination. - An array used as the source of the copy process. - The size of the block of memory to copy, in bytes. - - - - Copies the content of an array to a memory location. - - A pointer to the starting address of the copied block's destination. - An array used as the source of the copy process. - The size of the block of memory to copy, in bytes. - - - - Copies the content of an array to a memory location. - - A pointer to the starting address of the copied block's destination. - An array used as the source of the copy process. - The size of the block of memory to copy, in bytes. - - - - Copies the content of one array into another array. - - An array used as the destination of the copy process. - An array used as the source of the copy process. - The size of the content to copy, in bytes. - - - - Copies the content of one array into another array. - - An array used as the destination of the copy process. - An array used as the source of the copy process. - The size of the content to copy, in bytes. - - - - Retrieves a handle to a display device context (DC) for the client area of a specified window - or for the entire screen. You can use the returned handle in subsequent GDI functions to draw in the DC. - - Handle to the window whose DC is to be retrieved. - If this value is IntPtr.Zero, GetDC retrieves the DC for the entire screen. - If the function succeeds, the return value is a handle to the DC for the specified window's client area. - If the function fails, the return value is NULL. - - - - Releases a device context (DC), freeing it for use by other applications. - The effect of the ReleaseDC function depends on the type of DC. It frees only common and window DCs. - It has no effect on class or private DCs. - - Handle to the window whose DC is to be released. - Handle to the DC to be released. - Returns true on success, false on failure. - - - - Creates a DIB that applications can write to directly. - The function gives you a pointer to the location of the bitmap bit values. - You can supply a handle to a file-mapping object that the function will use to create the bitmap, - or you can let the system allocate the memory for the bitmap. - - Handle to a device context. - Pointer to a BITMAPINFO structure that specifies various attributes of the DIB, - including the bitmap dimensions and colors. - Specifies the type of data contained in the bmiColors array member of the BITMAPINFO structure - pointed to by pbmi (either logical palette indexes or literal RGB values). - Pointer to a variable that receives a pointer to the location of the DIB bit values. - Handle to a file-mapping object that the function will use to create the DIB. - This parameter can be NULL. - Specifies the offset from the beginning of the file-mapping object referenced by hSection - where storage for the bitmap bit values is to begin. This value is ignored if hSection is NULL. - If the function succeeds, the return value is a handle to the newly created DIB, - and *ppvBits points to the bitmap bit values. If the function fails, the return value is NULL, and *ppvBits is NULL. - - - - Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. - After the object is deleted, the specified handle is no longer valid. - - Handle to a logical pen, brush, font, bitmap, region, or palette. - Returns true on success, false on failure. - - - - Creates a compatible bitmap (DDB) from a DIB and, optionally, sets the bitmap bits. - - Handle to a device context. - Pointer to a bitmap information header structure. - Specifies how the system initializes the bitmap bits - (use 4). - Pointer to an array of bytes containing the initial bitmap data. - Pointer to a BITMAPINFO structure that describes the dimensions - and color format of the array pointed to by the lpbInit parameter. - Specifies whether the bmiColors member of the BITMAPINFO structure - was initialized - (use 0). - Handle to a DIB or null on failure. - - - - Retrieves information for the specified graphics object. - - Handle to the graphics object of interest. - Specifies the number of bytes of information to - be written to the buffer. - Pointer to a buffer that receives the information - about the specified graphics object. - 0 on failure. - - - - Retrieves the bits of the specified compatible bitmap and copies them into a buffer - as a DIB using the specified format. - - Handle to the device context. - Handle to the bitmap. This must be a compatible bitmap (DDB). - Specifies the first scan line to retrieve. - Specifies the number of scan lines to retrieve. - Pointer to a buffer to receive the bitmap data. - Pointer to a BITMAPINFO structure that specifies the desired - format for the DIB data. - Specifies the format of the bmiColors member of the - BITMAPINFO structure - (use 0). - 0 on failure. - - - - Moves a block of memory from one location to another. - - Pointer to the starting address of the move destination. - Pointer to the starting address of the block of memory to be moved. - Size of the block of memory to move, in bytes. - - - - The RtlCompareMemory routine compares blocks of memory - and returns the number of bytes that are equivalent. - - A pointer to a block of memory to compare. - A pointer to a block of memory to compare. - Specifies the number of bytes to be compared. - RtlCompareMemory returns the number of bytes that compare as equal. - If all bytes compare as equal, the input Length is returned. - -
-
diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Bin/FreeImageNET.dll b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Bin/FreeImageNET.dll deleted file mode 100644 index 6822041..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Bin/FreeImageNET.dll and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.chm b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.chm deleted file mode 100644 index 9054cc9..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/FreeImage.NET.chm and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/ReleaseNotes.txt b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/ReleaseNotes.txt deleted file mode 100644 index 450520f..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/ReleaseNotes.txt +++ /dev/null @@ -1,8 +0,0 @@ -FreeImage .NET Wrapper Release Notes - -The FreeImage .NET Wrapper included in the 3.14.1 release is still on version 3.13.1. It does not yet contain any new features or bug fixes. However, it is expected to work with the new FreeImage DLL with no problems. - -The next version of FreeImage is expected to be released soon and will contain an updated .NET wrapper, including support for all new features, that have been introduced in this and the next version of FreeImage. - -Regards, FreeImage .NET Wrapper Team - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Program.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Program.cs deleted file mode 100644 index 2e53888..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Program.cs +++ /dev/null @@ -1,179 +0,0 @@ -using System; -using System.IO; -using FreeImageAPI; -using System.Collections.Generic; -using System.Runtime.Serialization.Formatters.Binary; -using System.Drawing; -using System.Drawing.Imaging; -using System.Runtime.InteropServices; - -namespace Sample01 -{ - class Program - { - static void Main(string[] args) - { - // Check if FreeImage.dll is available (can be in %path%). - if (!FreeImage.IsAvailable()) - { - Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); - return; - } - - Sample sample = new Sample(); - // This example shows the basic loading and saving operations offered by FreeImage. - sample.Example01(); - - // This example shows a more comfortable way offered by the .NET Wrapper. - sample.Example02(); - - // This example shows the FreeImage-Errormessage-Callback - sample.Example03(); - } - } - - public class Sample - { - const string fileName = @"Sample.jpg"; - const string outFileName = @"Sample.tif"; - FIBITMAP dib = new FIBITMAP(); - string message = null; - - public void Example01() - { - if (!File.Exists(fileName)) - { - Console.WriteLine(fileName + " does not exist. Aborting."); - return; - } - - // Try to unload the bitmap handle (in case it is not null). - // Always assert that a handle (like dib) is unloaded before it is reused, because - // on unmanaged side there is no garbage collector that will clean up unreferenced - // objects. - // The following code will produce a memory leak (in case the bitmap is loaded - // successfully) because the handle to the first bitmap is lost: - // dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, fileName, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - // dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, fileName, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - if (!dib.IsNull) - FreeImage.Unload(dib); - - // Loading a sample bitmap. In this case it's a .jpg file. 'Load' requires the file - // format or the loading process will fail. An additional flag (the default value is - // 'DEFAULT') can be set to enable special loading options. - dib = FreeImage.Load(FREE_IMAGE_FORMAT.FIF_JPEG, fileName, FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - - // Check if the handle is null which means the bitmap could not be loaded. - if (dib.IsNull) - { - Console.WriteLine("Loading bitmap failed. Aborting."); - // Check whether there was an error message. - return; - } - - // Try flipping the bitmap. - if (!FreeImage.FlipHorizontal(dib)) - { - Console.WriteLine("Unable to flip bitmap."); - // Check whether there was an error message. - } - - // Store the bitmap back to disk. Again the desired format is needed. In this case the format is 'TIFF'. - // An output filename has to be chosen (which will be overwritten without a warning). - // A flag can be provided to enable pluginfunctions (compression is this case). - FreeImage.Save(FREE_IMAGE_FORMAT.FIF_TIFF, dib, outFileName, FREE_IMAGE_SAVE_FLAGS.TIFF_DEFLATE); - - // The bitmap was saved to disk but is still allocated in memory, so the handle has to be freed. - if (!dib.IsNull) - FreeImage.Unload(dib); - - // Make sure to set the handle to null so that it is clear that the handle is not pointing to a bitmap. - dib.SetNull(); - } - - public void Example02() - { - // 'UnloadEx' is a comfortable way of unloading a bitmap. The coder can call 'UnloadEx' even - // when the handle is pointing to null (in this case nothing will happen). In case the handle - // is valid (valid means that it is NOT pointing to null) the bitmap will be unloaded and the - // handle will be set to null manually. - FreeImage.UnloadEx(ref dib); - - // 'LoadEx' is a comfortable way of loading a bitmap. 'LoadEx' tries to find out the format of - // the file and will use this to load it. It will use DEFAULT loading values. - dib = FreeImage.LoadEx(fileName); - - // Check if the handle is null which means the bitmap could not be loaded. - if (dib.IsNull) - { - Console.WriteLine("Loading bitmap failed. Aborting."); - return; - } - - // 'SaveEx' (like 'LoadEx') will try to save the bitmap with default values. - // Before saving the bitmap, 'SaveEx' checks whether the extension is valid for the file type - // and if the plugin can use the colordepth of the bitmap. If not it will automatically convert - // the bitmap into the next best colordepth and save it. - if (!FreeImage.SaveEx(ref dib, @"Sample.gif", false)) - { - Console.WriteLine("Saving bitmap failed."); - } - - // The handle is still valid. - if (!FreeImage.SaveEx( - ref dib, - @"Sample", // No extension was selected so let 'SaveEx' decide. - FREE_IMAGE_FORMAT.FIF_PNG, // A format is needed this time. - FREE_IMAGE_SAVE_FLAGS.DEFAULT, // PNG has no options so use default. - FREE_IMAGE_COLOR_DEPTH.FICD_04_BPP, // 4bpp as result color depth. - true)) // We're done so unload - { - // SaveEx will not unload the bitmap in case saving failed. - // This way possible operations done to the bitmaps aren't lost. - FreeImage.UnloadEx(ref dib); - } - } - - public void Example03() - { - // Safely unload to prevent memory leak. - FreeImage.UnloadEx(ref dib); - - // Load the example bitmap. - dib = FreeImage.LoadEx(fileName); - - // Check whether loading succeeded. - if (dib.IsNull) - { - return; - } - - // Add this class to the callback event. - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - - // Try to save the bitmap as a gif - if (!FreeImage.Save(FREE_IMAGE_FORMAT.FIF_GIF, dib, @"Sample_fail.gif", FREE_IMAGE_SAVE_FLAGS.DEFAULT)) - { - // Saving failed - // Check whether there was an error callback - if (message != null) - { - // Print the message and delete it. - Console.WriteLine("Error message recieved: {0}", message); - message = null; - } - } - - // Unload bitmap. - FreeImage.UnloadEx(ref dib); - - // Remove this class from the callback event. - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - this.message = message; - } - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Properties/AssemblyInfo.cs deleted file mode 100644 index 5323808..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("ac0569fe-c021-4f40-bfe9-275baf0fd21a")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample 01 - Loading and saving.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample 01 - Loading and saving.csproj deleted file mode 100644 index d406bfd..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample 01 - Loading and saving.csproj +++ /dev/null @@ -1,103 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {0D294AB6-FAD4-4364-AAB6-43C1796116A9} - Exe - Properties - Sample01 - Sample01 - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - true - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - true - - - true - bin\Debug\ - DEBUG;TRACE - true - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - true - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - true - - - x64 - false - prompt - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - - - - - Always - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample.jpg b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample.jpg deleted file mode 100644 index b537c00..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 01 - Loading and saving/Sample.jpg and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Program.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Program.cs deleted file mode 100644 index dccc2d8..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Program.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using System.IO; -using FreeImageAPI; - -namespace Sample02 -{ - class Program - { - static void Main(string[] args) - { - // Check if FreeImage.dll is available (can be in %path%). - if (!FreeImage.IsAvailable()) - { - Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); - return; - } - - Sample sample = new Sample(); - sample.Example(); - } - } - - public class Sample - { - const string fileName = @"multipaged.tif"; - FIMULTIBITMAP dib = new FIMULTIBITMAP(); - Random rand = new Random(); - - public void Example() - { - if (!File.Exists(fileName)) - { - Console.WriteLine("File not found. Aborting."); - return; - } - - // Load the multipaged bitmap. - // 'OpenMultiBitmapEx' tries to find the correct file format, loads the bitmap - // with default options, with write support and does not use caching. - dib = FreeImage.OpenMultiBitmapEx(fileName); - - // Check whether loading succeeded. - if (dib.IsNull) - { - Console.WriteLine("File could not be loaded. Aborting."); - return; - } - - // Get the number of bitmaps the multipaged bitmap contains. - int count = FreeImage.GetPageCount(dib); - - // Multipaged bitmaps consist of multiple single FIBITMAPs - FIBITMAP page = new FIBITMAP(); - - // There are bitmaps we can work with. - if (count > 0) - { - // Lock a random bitmap to work with. - page = FreeImage.LockPage(dib, rand.Next(0, count)); - } - - // Check whether locking succeeded. - if (page.IsNull) - { - // Locking failed. Unload the bitmap and return. - FreeImage.CloseMultiBitmapEx(ref dib); - return; - } - - // Get a list of locked pages. This can be usefull to check whether a page has already been locked. - int[] lockedPages = FreeImage.GetLockedPages(dib); - - // Lets modify the page. - if (FreeImage.AdjustGamma(page, 2d)) - { - Console.WriteLine("Successfully changed gamma of page {0}.", lockedPages[0]); - } - else - { - Console.WriteLine("Failed to adjust gamma ..."); - } - - // Print out the list of locked pages - foreach (int i in lockedPages) - Console.WriteLine("Page {0} is locked.", i); - - // Use 'UnlockPage' instead of 'Unload' to free the page. Set the third parameter to 'true' - // so that FreeImage can store the changed page within the multipaged bitmap. - FreeImage.UnlockPage(dib, page, true); - - // Retieve the list again to see whether unlocking succeeded. - lockedPages = FreeImage.GetLockedPages(dib); - - // No output should be produced here. - foreach (int i in lockedPages) - Console.WriteLine("Page {0} is still locked.", i); - - // If there are more than one page we can swap them - if (count > 1) - { - if (!FreeImage.MovePage(dib, 1, 0)) - { - Console.WriteLine("Swapping pages failed."); - } - } - - if (count > 2) - { - // Lock page 2 - page = FreeImage.LockPage(dib, 2); - if (!page.IsNull) - { - // Clone the page for later appending - FIBITMAP temp = FreeImage.Clone(page); - - // Unlock the page again - FreeImage.UnlockPage(dib, page, false); - - // Delete the page form the multipaged bitmap - FreeImage.DeletePage(dib, 2); - - // Append the clone again - FreeImage.AppendPage(dib, temp); - - // Check whether the number of pages is still the same - Console.WriteLine("Pages before: {0}. Pages after: {1}", count, FreeImage.GetPageCount(dib)); - - // Unload clone to prevent memory leak - FreeImage.UnloadEx(ref temp); - } - } - - // We are done and close the multipaged bitmap. - if (!FreeImage.CloseMultiBitmapEx(ref dib)) - { - Console.WriteLine("Closing bitmap failed!"); - } - } - } -} diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Properties/AssemblyInfo.cs deleted file mode 100644 index 6ada91e..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("35960522-c01a-40d2-a86b-37b9839b131c")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.csproj deleted file mode 100644 index a1ddf79..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.csproj +++ /dev/null @@ -1,95 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B} - Exe - Properties - Sample02 - Sample02 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - - - - - Always - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/multipaged.tif b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/multipaged.tif deleted file mode 100644 index 886a7c9..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 02 - Multipaged bitmaps/multipaged.tif and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Program.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Program.cs deleted file mode 100644 index b7e9524..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Program.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.IO; -using FreeImageAPI; - -namespace Sample03 -{ - class Program - { - static void Main(string[] args) - { - // Check if FreeImage.dll is available (can be in %path%). - if (!FreeImage.IsAvailable()) - { - Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); - return; - } - - // Add this class to the message event - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - - Sample sample = new Sample(); - sample.Example(); - - // Remove this class from the message event - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - static void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - Console.WriteLine("Error for {0}: {1}", fif.ToString(), message); - } - } - - public class Sample - { - FIBITMAP dib = new FIBITMAP(); - - public void Example() - { - // Allocating a new bitmap with 99x99 pixels, 16-bit color depth and an allocation of 5 bits for each color. - dib = FreeImage.Allocate(99, 99, 16, FreeImage.FI16_555_RED_MASK, FreeImage.FI16_555_GREEN_MASK, FreeImage.FI16_555_BLUE_MASK); - - // Saving bitmap. - if (!FreeImage.SaveEx(ref dib, "example01.bmp", true)) - { - Console.WriteLine("Saving 'example.bmp' failed."); - FreeImage.UnloadEx(ref dib); - } - - // Allocation a new bitmap with 71x33 pixels, 4-bit color depth. Bitmaps below 16-bit have paletts. - // Each pixel references an index within the palette wich contains the true color. - // Therefor no bit-masks are needed and can be set to 0. - dib = FreeImage.Allocate(71, 33, 4, 0, 0, 0); - - // Saving bitmap. - if (!FreeImage.SaveEx(ref dib, "example02.tif", true)) - { - Console.WriteLine("Saving 'example02.tif' failed."); - FreeImage.UnloadEx(ref dib); - } - - // Allocation a new bitmap. This time 'AllocateT' is used because 'Allocate' can only create standard bitmaps. - // In this case a RGBF bitmap is created. Red, green and blue are represented by a float-value so no bit-masks are needed. - dib = FreeImage.AllocateT(FREE_IMAGE_TYPE.FIT_RGBF, 50, 75, 9, 0, 0, 0); - - // Saving bitmap. - if (!FreeImage.SaveEx(ref dib, "example03.hdr", true)) - { - Console.WriteLine("Saving 'example03.hdr' failed."); - FreeImage.UnloadEx(ref dib); - } - } - } -} diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Properties/AssemblyInfo.cs deleted file mode 100644 index f60e31d..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("7139f1dc-3312-4c76-aeb3-891f869409b3")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Sample 03 - Allocating.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Sample 03 - Allocating.csproj deleted file mode 100644 index b9ba32c..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 03 - Allocating/Sample 03 - Allocating.csproj +++ /dev/null @@ -1,89 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9} - Exe - Properties - Sample03 - Sample03 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.Designer.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.Designer.cs deleted file mode 100644 index cb3836a..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.Designer.cs +++ /dev/null @@ -1,205 +0,0 @@ -namespace Sample04 -{ - partial class MainForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.ofd = new System.Windows.Forms.OpenFileDialog(); - this.bOpenFile = new System.Windows.Forms.Button(); - this.lWidth = new System.Windows.Forms.Label(); - this.lHeight = new System.Windows.Forms.Label(); - this.lBPP = new System.Windows.Forms.Label(); - this.lRedMask = new System.Windows.Forms.Label(); - this.lGreenMask = new System.Windows.Forms.Label(); - this.lBlueMask = new System.Windows.Forms.Label(); - this.lImageType = new System.Windows.Forms.Label(); - this.lDPIY = new System.Windows.Forms.Label(); - this.lDPIX = new System.Windows.Forms.Label(); - this.lFormat = new System.Windows.Forms.Label(); - this.lHeader = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // ofd - // - this.ofd.Filter = "All files (*.*)|*.*"; - // - // bOpenFile - // - this.bOpenFile.Location = new System.Drawing.Point(12, 358); - this.bOpenFile.Name = "bOpenFile"; - this.bOpenFile.Size = new System.Drawing.Size(75, 23); - this.bOpenFile.TabIndex = 4; - this.bOpenFile.Text = "Open file"; - this.bOpenFile.UseVisualStyleBackColor = true; - this.bOpenFile.Click += new System.EventHandler(this.bOpenFile_Click); - // - // lWidth - // - this.lWidth.AutoSize = true; - this.lWidth.Location = new System.Drawing.Point(9, 51); - this.lWidth.Name = "lWidth"; - this.lWidth.Size = new System.Drawing.Size(46, 16); - this.lWidth.TabIndex = 0; - this.lWidth.Text = "Width:"; - // - // lHeight - // - this.lHeight.AutoSize = true; - this.lHeight.Location = new System.Drawing.Point(9, 76); - this.lHeight.Name = "lHeight"; - this.lHeight.Size = new System.Drawing.Size(53, 16); - this.lHeight.TabIndex = 1; - this.lHeight.Text = "Height: "; - // - // lBPP - // - this.lBPP.AutoSize = true; - this.lBPP.Location = new System.Drawing.Point(9, 101); - this.lBPP.Name = "lBPP"; - this.lBPP.Size = new System.Drawing.Size(80, 16); - this.lBPP.TabIndex = 2; - this.lBPP.Text = "Color Depth:"; - // - // lRedMask - // - this.lRedMask.AutoSize = true; - this.lRedMask.Location = new System.Drawing.Point(9, 129); - this.lRedMask.Name = "lRedMask"; - this.lRedMask.Size = new System.Drawing.Size(68, 16); - this.lRedMask.TabIndex = 3; - this.lRedMask.Text = "Red Mask:"; - // - // lGreenMask - // - this.lGreenMask.AutoSize = true; - this.lGreenMask.Location = new System.Drawing.Point(9, 188); - this.lGreenMask.Name = "lGreenMask"; - this.lGreenMask.Size = new System.Drawing.Size(80, 16); - this.lGreenMask.TabIndex = 5; - this.lGreenMask.Text = "Green Mask:"; - // - // lBlueMask - // - this.lBlueMask.AutoSize = true; - this.lBlueMask.Location = new System.Drawing.Point(9, 158); - this.lBlueMask.Name = "lBlueMask"; - this.lBlueMask.Size = new System.Drawing.Size(70, 16); - this.lBlueMask.TabIndex = 6; - this.lBlueMask.Text = "Blue Mask:"; - // - // lImageType - // - this.lImageType.AutoSize = true; - this.lImageType.Location = new System.Drawing.Point(9, 215); - this.lImageType.Name = "lImageType"; - this.lImageType.Size = new System.Drawing.Size(81, 16); - this.lImageType.TabIndex = 7; - this.lImageType.Text = "Image Type:"; - // - // lDPIY - // - this.lDPIY.AutoSize = true; - this.lDPIY.Location = new System.Drawing.Point(9, 244); - this.lDPIY.Name = "lDPIY"; - this.lDPIY.Size = new System.Drawing.Size(43, 16); - this.lDPIY.TabIndex = 8; - this.lDPIY.Text = "DPI Y:"; - // - // lDPIX - // - this.lDPIX.AutoSize = true; - this.lDPIX.Location = new System.Drawing.Point(9, 273); - this.lDPIX.Name = "lDPIX"; - this.lDPIX.Size = new System.Drawing.Size(44, 16); - this.lDPIX.TabIndex = 9; - this.lDPIX.Text = "DPI X:"; - // - // lFormat - // - this.lFormat.AutoSize = true; - this.lFormat.Location = new System.Drawing.Point(9, 302); - this.lFormat.Name = "lFormat"; - this.lFormat.Size = new System.Drawing.Size(78, 16); - this.lFormat.TabIndex = 10; - this.lFormat.Text = "File Format:"; - // - // lHeader - // - this.lHeader.AutoSize = true; - this.lHeader.Location = new System.Drawing.Point(117, 19); - this.lHeader.Name = "lHeader"; - this.lHeader.Size = new System.Drawing.Size(162, 16); - this.lHeader.TabIndex = 11; - this.lHeader.Text = "Bitmap-Information Viewer"; - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(400, 393); - this.Controls.Add(this.lHeader); - this.Controls.Add(this.lFormat); - this.Controls.Add(this.lDPIX); - this.Controls.Add(this.lDPIY); - this.Controls.Add(this.lImageType); - this.Controls.Add(this.lBlueMask); - this.Controls.Add(this.lGreenMask); - this.Controls.Add(this.bOpenFile); - this.Controls.Add(this.lRedMask); - this.Controls.Add(this.lBPP); - this.Controls.Add(this.lHeight); - this.Controls.Add(this.lWidth); - this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MainForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Sample04"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.OpenFileDialog ofd; - private System.Windows.Forms.Button bOpenFile; - private System.Windows.Forms.Label lWidth; - private System.Windows.Forms.Label lHeight; - private System.Windows.Forms.Label lBPP; - private System.Windows.Forms.Label lRedMask; - private System.Windows.Forms.Label lGreenMask; - private System.Windows.Forms.Label lBlueMask; - private System.Windows.Forms.Label lImageType; - private System.Windows.Forms.Label lDPIY; - private System.Windows.Forms.Label lDPIX; - private System.Windows.Forms.Label lFormat; - private System.Windows.Forms.Label lHeader; - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.cs deleted file mode 100644 index cf72567..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.cs +++ /dev/null @@ -1,120 +0,0 @@ -using System; -using System.Windows.Forms; -using FreeImageAPI; - -namespace Sample04 -{ - public partial class MainForm : Form - { - string message = null; - - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - - public MainForm() - { - InitializeComponent(); - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - } - - ~MainForm() - { - FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - if (this.message == null) - { - this.message = message; - } - else - { - this.message += "\n" + message; - } - } - - private void bOpenFile_Click(object sender, EventArgs e) - { - // Resetting filename - ofd.FileName = ""; - - // Was a file selected - if (ofd.ShowDialog() == DialogResult.OK) - { - // Format is stored in 'format' on successfull load. - FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; - - // Try loading the file - FIBITMAP dib = FreeImage.LoadEx(ofd.FileName, ref format); - - try - { - // Error handling - if (dib.IsNull) - { - // Chech whether FreeImage generated an error messe - if (message != null) - { - MessageBox.Show("File could not be loaded!\nError:{0}", message); - } - else - { - MessageBox.Show("File could not be loaded!", message); - } - return; - } - - // Read width - lWidth.Text = String.Format("Width: {0}", FreeImage.GetWidth(dib)); - - // Read height - lHeight.Text = String.Format("Width: {0}", FreeImage.GetWidth(dib)); - - // Read color depth - lBPP.Text = String.Format("Color Depth: {0}", FreeImage.GetBPP(dib)); - - // Read red bitmask (16 - 32 bpp) - lRedMask.Text = String.Format("Red Mask: 0x{0:X8}", FreeImage.GetRedMask(dib)); - - // Read green bitmask (16 - 32 bpp) - lBlueMask.Text = String.Format("Green Mask: 0x{0:X8}", FreeImage.GetGreenMask(dib)); - - // Read blue bitmask (16 - 32 bpp) - lGreenMask.Text = String.Format("Blue Mask: 0x{0:X8}", FreeImage.GetBlueMask(dib)); - - // Read image type (FI_BITMAP, FIT_RGB16, FIT_COMPLEX ect) - lImageType.Text = String.Format("Image Type: {0}", FreeImage.GetImageType(dib)); - - // Read x-axis dpi - lDPIX.Text = String.Format("DPI X: {0}", FreeImage.GetResolutionX(dib)); - - // Read y-axis dpi - lDPIY.Text = String.Format("DPI Y: {0}", FreeImage.GetResolutionY(dib)); - - // Read file format - lFormat.Text = String.Format("File Format: {0}", FreeImage.GetFormatFromFIF(format)); - } - catch - { - } - - // Always unload bitmap - FreeImage.UnloadEx(ref dib); - - // Reset the error massage buffer - message = null; - } - // No file was selected - else - { - MessageBox.Show("No file loaded.", "Error"); - } - } - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.resx b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.resx deleted file mode 100644 index 86c9308..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/MainForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Properties/AssemblyInfo.cs deleted file mode 100644 index c14bca6..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("7c8fdc9a-a8f9-4996-99c8-9df47513edeb")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Sample 04 - Getting bitmap informations.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Sample 04 - Getting bitmap informations.csproj deleted file mode 100644 index dc0e2fb..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 04 - Getting bitmap informations/Sample 04 - Getting bitmap informations.csproj +++ /dev/null @@ -1,102 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A} - WinExe - Properties - Sample04 - Sample04 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - - Form - - - MainForm.cs - - - - - - Designer - MainForm.cs - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Program.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Program.cs deleted file mode 100644 index 40f878f..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Program.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System; -using FreeImageAPI; -using System.Drawing; - -namespace Sample05 -{ - class Program - { - static void Main(string[] args) - { - // Check if FreeImage.dll is available (can be in %path%). - if (!FreeImage.IsAvailable()) - { - Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); - return; - } - - Sample sample = new Sample(); - - // The example will flip the bitmap by manually accessing the - // bitmaps scanlines and swapping them - sample.Example01(); - - // The example will access each pixel of the bitmap manually - // and change its color intensity to 3/4 of the original value - // which will have a darker bitmap as result. - sample.Example02(); - - // The example will access and swap the bitmaps palette from - // 'FIC_MINISBLACK' to 'FIC_MINISWHITE'. Then it will swap each pixels - // palette index so that each pixel is assigned to the its old value - // so that the bitmaps "pixeldata" stays the same. - sample.Example03(); - } - } - - public class Sample - { - FIBITMAP dib = new FIBITMAP(); - - public void Example01() - { - // Load sample file - dib = FreeImage.LoadEx("Sample.jpg", FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - - // Check whether loading succeeded - if (dib.IsNull) - { - Console.WriteLine("Sample.jpg could not be loaded. Aborting."); - return; - } - - // Check whether the bitmap has 24 bpp color depth to ensure - // using RGBTRIPPLE is correct. - if (FreeImage.GetBPP(dib) != 24) - { - Console.WriteLine("Sample.jpg is no 24 bpp bitmap. Aborting."); - FreeImage.UnloadEx(ref dib); - return; - } - - // Store height of the bitmap - int height = (int)FreeImage.GetHeight(dib); - - // Iterate over half of the bitmaps scanlines and swap - // line[1] with line[height], line[2] with line[height-1] etc which will - // flip the image. - for (int i = 0; i < (height / 2); i++) - { - // Get scanline from the bottom part of the bitmap - Scanline scanlineBottom = new Scanline(dib, i); - - // Get scanline from the top part of the bitmap - Scanline scanlineTop = new Scanline(dib, height - 1 - i); - - // Get arrays of RGBTRIPPLEs that contain the bitmaps real pixel data - // of the two scanlines. - RGBTRIPLE[] rgbtBottom = scanlineBottom.Data; - RGBTRIPLE[] rgbtTop = scanlineTop.Data; - - // Restore the scanline across to switch the bitmaps lines. - scanlineBottom.Data = rgbtTop; - scanlineTop.Data = rgbtBottom; - } - - // Store the bitmap to disk - if (!FreeImage.SaveEx(ref dib, "SampleOut01.jpg", FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYGOOD, true)) - { - Console.WriteLine("Error while saving 'SampleOut01.jpg'"); - FreeImage.UnloadEx(ref dib); - } - } - - public void Example02() - { - dib = FreeImage.LoadEx("Sample.jpg", FREE_IMAGE_LOAD_FLAGS.JPEG_ACCURATE); - - // Check whether loading succeeded - if (dib.IsNull) - { - Console.WriteLine("Sample.jpg could not be loaded. Aborting."); - return; - } - - // Check whether the bitmap has 24 bpp color depth to ensure - // using RGBTRIPPLE is correct. - if (FreeImage.GetBPP(dib) != 24) - { - Console.WriteLine("Sample.jpg is no 24 bpp bitmap. Aborting."); - FreeImage.UnloadEx(ref dib); - return; - } - - // Iterate over all scanlines - for (int i = 0; i < FreeImage.GetHeight(dib); i++) - { - // Get scanline - Scanline scanline = new Scanline(dib, i); - - // Get pixeldata from scanline - RGBTRIPLE[] rgbt = scanline.Data; - - // Iterate over each pixel reducing the colors intensity to 3/4 which - // will darken the bitmap. - for (int j = 0; j < rgbt.Length; j++) - { - rgbt[j].rgbtBlue = (byte)((int)rgbt[j].rgbtBlue * 3 / 4); - rgbt[j].rgbtGreen = (byte)((int)rgbt[j].rgbtGreen * 3 / 4); - rgbt[j].rgbtRed = (byte)((int)rgbt[j].rgbtRed * 3 / 4); - - // In case no direct access to the data is implemented - // the following way is equivalent: - // - // Color color = rgbt[j].color; - // rgbt[j].color = Color.FromArgb(color.R * 3 / 4, color.G * 3 / 4, color.B * 3 / 4); - } - - // Write the darkened scanline back to memory - scanline.Data = rgbt; - } - - // Store the bitmap to disk - if (!FreeImage.SaveEx(ref dib, "SampleOut02.jpg", FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYGOOD, true)) - { - Console.WriteLine("Error while saving 'SampleOut02.jpg'"); - FreeImage.UnloadEx(ref dib); - } - } - - public void Example03() - { - dib = FreeImage.LoadEx("Sample.tif"); - - // Check whether loading succeeded - if (dib.IsNull) - { - Console.WriteLine("Sample.tif could not be loaded. Aborting."); - return; - } - - // Check whether the bitmap has 4 bpp color depth to ensure - // using FI4B is correct. - if (FreeImage.GetBPP(dib) != 4) - { - Console.WriteLine("Sample.tif is no 4 bpp bitmap. Aborting."); - FreeImage.UnloadEx(ref dib); - return; - } - - // Get the bitmaps palette - Palette palette = FreeImage.GetPaletteEx(dib); - - int size = (int)palette.Length; - - // Check whether the palette has a color (is valid) - if (size == 0) - { - Console.WriteLine("Sample.tif has no valid palette. Aborting."); - FreeImage.UnloadEx(ref dib); - return; - } - - // Swapping the palette - for (int i = 0; i < size / 2; i++) - { - RGBQUAD temp = palette[i]; - palette[i] = palette[size - 1 - i]; - palette[size - 1 - i] = temp; - } - - // Iterate over each scanline - for (int i = 0; i < FreeImage.GetHeight(dib); i++) - { - // Get scanline - Scanline scanline = new Scanline(dib, i); - - // Iterate over all pixels swapping the palette index - // so that the color will stay the same - for (int j = 0; j < scanline.Length; j++) - { - scanline[j] = (byte)(size - 1 - scanline[j]); - } - } - - // Save the bitmap to disk - if (!FreeImage.SaveEx(ref dib, "SampleOut03.tif", FREE_IMAGE_SAVE_FLAGS.TIFF_LZW, true)) - { - Console.WriteLine("Error while saving 'SampleOut03.tif'"); - FreeImage.UnloadEx(ref dib); - } - } - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Properties/AssemblyInfo.cs deleted file mode 100644 index 35304a0..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("fd43331d-5ea4-40f8-86d5-8f820d606912")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.csproj deleted file mode 100644 index 0a9eda9..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.csproj +++ /dev/null @@ -1,98 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {A501F134-8FB6-460B-AFE9-884A696C1C07} - Exe - Properties - Sample05 - Sample05 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - Always - - - Always - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.jpg b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.jpg deleted file mode 100644 index df1918c..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.jpg and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.tif b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.tif deleted file mode 100644 index 7b37c6b..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 05 - Working with pixels/Sample.tif and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.Designer.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.Designer.cs deleted file mode 100644 index 5ae81a8..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.Designer.cs +++ /dev/null @@ -1,120 +0,0 @@ -namespace Sample06 -{ - partial class MainForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.picBox = new System.Windows.Forms.PictureBox(); - this.bExample01 = new System.Windows.Forms.Button(); - this.bOriginal = new System.Windows.Forms.Button(); - this.bExample02 = new System.Windows.Forms.Button(); - this.bExample03 = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.picBox)).BeginInit(); - this.SuspendLayout(); - // - // picBox - // - this.picBox.BackColor = System.Drawing.Color.White; - this.picBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picBox.Location = new System.Drawing.Point(12, 12); - this.picBox.Name = "picBox"; - this.picBox.Size = new System.Drawing.Size(747, 465); - this.picBox.TabIndex = 0; - this.picBox.TabStop = false; - // - // bExample01 - // - this.bExample01.Location = new System.Drawing.Point(93, 483); - this.bExample01.Name = "bExample01"; - this.bExample01.Size = new System.Drawing.Size(88, 23); - this.bExample01.TabIndex = 1; - this.bExample01.Text = "Example 01"; - this.bExample01.UseVisualStyleBackColor = true; - this.bExample01.Click += new System.EventHandler(this.bExample01_Click); - // - // bOriginal - // - this.bOriginal.Location = new System.Drawing.Point(12, 483); - this.bOriginal.Name = "bOriginal"; - this.bOriginal.Size = new System.Drawing.Size(75, 23); - this.bOriginal.TabIndex = 2; - this.bOriginal.Text = "Original"; - this.bOriginal.UseVisualStyleBackColor = true; - this.bOriginal.Click += new System.EventHandler(this.bOriginal_Click); - // - // bExample02 - // - this.bExample02.Location = new System.Drawing.Point(187, 483); - this.bExample02.Name = "bExample02"; - this.bExample02.Size = new System.Drawing.Size(88, 23); - this.bExample02.TabIndex = 3; - this.bExample02.Text = "Example 02"; - this.bExample02.UseVisualStyleBackColor = true; - this.bExample02.Click += new System.EventHandler(this.bExample02_Click); - // - // bExample03 - // - this.bExample03.Location = new System.Drawing.Point(281, 483); - this.bExample03.Name = "bExample03"; - this.bExample03.Size = new System.Drawing.Size(88, 23); - this.bExample03.TabIndex = 4; - this.bExample03.Text = "Example 03"; - this.bExample03.UseVisualStyleBackColor = true; - this.bExample03.Click += new System.EventHandler(this.bExample03_Click); - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(771, 518); - this.Controls.Add(this.bExample03); - this.Controls.Add(this.bExample02); - this.Controls.Add(this.bOriginal); - this.Controls.Add(this.bExample01); - this.Controls.Add(this.picBox); - this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MainForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Sample06"; - ((System.ComponentModel.ISupportInitialize)(this.picBox)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox picBox; - private System.Windows.Forms.Button bExample01; - private System.Windows.Forms.Button bOriginal; - private System.Windows.Forms.Button bExample02; - private System.Windows.Forms.Button bExample03; - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.cs deleted file mode 100644 index b7409bb..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.cs +++ /dev/null @@ -1,177 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; -using FreeImageAPI; -using System.Drawing.Imaging; - -namespace Sample06 -{ - public partial class MainForm : Form - { - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - - public MainForm() - { - InitializeComponent(); - } - - private void bExample01_Click(object sender, EventArgs e) - { - // Load bitmap - FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); - - // Check success - if (dib.IsNull) - { - MessageBox.Show("Could not load Sample.jpg", "Error"); - return; - } - - // Check whether bitmap is 24-bit - if (FreeImage.GetBPP(dib) != 24) - { - MessageBox.Show("Sample.jpg is not 24-bit.", "Error"); - FreeImage.UnloadEx(ref dib); - return; - } - - // Convert the 24-bit bitmap to 8-bit and forcing the result will be greyscale - dib = FreeImage.ConvertColorDepth(dib, FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP | FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE, true); - - if (FreeImage.GetBPP(dib) == 8) - { - // Convert the FreeImage-Bitmap into a .NET bitmap - Bitmap bitmap = FreeImage.GetBitmap(dib); - - // Dispose the bitmap of the pictureBox - if (picBox.Image != null) - { - picBox.Image.Dispose(); - } - - // Assign the bitmap to the picturebox - picBox.Image = bitmap; - } - - // Unload source bitmap - FreeImage.UnloadEx(ref dib); - } - - private void bOriginal_Click(object sender, EventArgs e) - { - // Load bitmap - FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); - - // Check success - if (dib.IsNull) - { - MessageBox.Show("Could not load Sample.jpg", "Error"); - return; - } - - // Convert the FreeImage-Bitmap into a .NET bitmap - Bitmap bitmap = FreeImage.GetBitmap(dib); - - // Check success - if (bitmap != null) - { - // Dispose old bitmap - if (picBox.Image != null) - { - picBox.Image.Dispose(); - } - - // Assign new bitmap - picBox.Image = bitmap; - } - - // Unload bitmap - FreeImage.UnloadEx(ref dib); - } - - private void bExample02_Click(object sender, EventArgs e) - { - FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); - - // Check success - if (dib.IsNull) - { - MessageBox.Show("Could not load Sample.jpg", "Error"); - return; - } - - // Convert bitmap to 8 bit - dib = FreeImage.ConvertColorDepth(dib, FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP, true); - - // Check whether conversion succeeded - if (FreeImage.GetBPP(dib) != 8) - { - MessageBox.Show("Converting Sample.jpg to 8-bit failed.", "Error"); - FreeImage.UnloadEx(ref dib); - return; - } - - // Convert the FreeImage-Bitmap into a .NET bitmap - Bitmap bitmap = FreeImage.GetBitmap(dib); - - // Dispose old bitmap - if (picBox.Image != null) - { - picBox.Image.Dispose(); - } - - // Assign new bitmap - picBox.Image = bitmap; - - // Unload bitmap - FreeImage.UnloadEx(ref dib); - } - - private void bExample03_Click(object sender, EventArgs e) - { - // Load bitmap - Bitmap bitmap = (Bitmap)Bitmap.FromFile("Sample.jpg"); - - // Convert the .NET bitmap into a FreeImage-Bitmap - FIBITMAP dib = FreeImage.CreateFromBitmap(bitmap); - - // Unload bitmap - bitmap.Dispose(); - - // Rescale the bitmap - FIBITMAP temp = FreeImage.Rescale(dib, 300, 300, FREE_IMAGE_FILTER.FILTER_BICUBIC); - - // Unload bitmap - FreeImage.UnloadEx(ref dib); - - Random rand = new Random(); - - // Rotate the bitmap - dib = FreeImage.Rotate(temp, rand.NextDouble() * 360d); - - // Unload bitmap - FreeImage.UnloadEx(ref temp); - - // Convert the FreeImage-Bitmap into a .NET bitmap - bitmap = FreeImage.GetBitmap(dib); - - // Unload bitmap - FreeImage.UnloadEx(ref dib); - - // Unload bitmap - if (picBox.Image != null) - { - picBox.Image.Dispose(); - } - - // Assign new bitmap - picBox.Image = bitmap; - } - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.resx b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.resx deleted file mode 100644 index 19dc0dd..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/MainForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Properties/AssemblyInfo.cs deleted file mode 100644 index fdd8539..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("69a8cbdd-43da-49e3-8d0b-2680c4ca2851")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample 06 - Converting.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample 06 - Converting.csproj deleted file mode 100644 index 179f282..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample 06 - Converting.csproj +++ /dev/null @@ -1,107 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {E2EA945D-E22C-47B3-9DD9-3A0B07FA3F81} - WinExe - Properties - Sample06 - Sample06 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - - Form - - - MainForm.cs - - - - - - Designer - MainForm.cs - - - - - Always - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample.jpg b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample.jpg deleted file mode 100644 index b537c00..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 06 - Converting/Sample.jpg and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Program.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Program.cs deleted file mode 100644 index b03d1f2..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Program.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Collections.Generic; -using FreeImageAPI; - -namespace Sample07 -{ - class Program - { - static void Main(string[] args) - { - // Check if FreeImage.dll is available (can be in %path%). - if (!FreeImage.IsAvailable()) - { - Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); - return; - } - - Sample sample = new Sample(); - // This example shows how to work with ICC-Profiles. - sample.Example(); - } - } - - public class Sample - { - public void Example() - { - // Load the sample bitmap. - FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); - - // Check success - if (dib.IsNull) - { - Console.WriteLine("Sample.jpg could not be loaded. Aborting."); - return; - } - - // Get the bitmaps ICC-Profile. - FIICCPROFILE icc = FreeImage.GetICCProfileEx(dib); - - // Print the profiles address. - Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); - - // Print the profiles size - Console.WriteLine("The profiles size is : {0} bytes", icc.Size); - - // Create data for a new profile. - byte[] data = new byte[256]; - for (int i = 0; i < data.Length; i++) - data[i] = (byte)i; - - // Create the new profile - icc = new FIICCPROFILE(dib, data); - - Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); - Console.WriteLine("The profiles size is : {0} bytes", icc.Size); - - // Create the new profile but only use the first 64 bytes - icc = new FIICCPROFILE(dib, data, 64); - - Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); - Console.WriteLine("The profiles size is : {0} bytes", icc.Size); - - // CreateICCProfileEx(...) does the same as above - icc = FreeImage.CreateICCProfileEx(dib, data, 16); - - Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); - Console.WriteLine("The profiles size is : {0} bytes", icc.Size); - - FreeImage.UnloadEx(ref dib); - } - } -} diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Properties/AssemblyInfo.cs deleted file mode 100644 index b7cddbb..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("c9991d1d-684a-4736-b088-369a216b35b6")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.csproj deleted file mode 100644 index e6e712e..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.csproj +++ /dev/null @@ -1,94 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {3B1BB976-64A7-41FD-B7E2-59104161AF7E} - Exe - Properties - Sample07 - Sample07 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - - - - Always - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample.jpg b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample.jpg deleted file mode 100644 index c9e425d..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 07 - ICC Profiles/Sample.jpg and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Properties/AssemblyInfo.cs deleted file mode 100644 index cc1b67a..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("dc891ffc-ab5c-451f-97da-2c0d5d90edcc")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample 08 - Creating a plugin.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample 08 - Creating a plugin.csproj deleted file mode 100644 index c43e1b4..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample 08 - Creating a plugin.csproj +++ /dev/null @@ -1,108 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {491042DB-495B-420C-A3BE-5D13019707C5} - WinExe - Properties - Sample08 - Sample08 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - - - Form - - - SampleForm.cs - - - - - - Always - - - - - SampleForm.cs - Designer - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample.jpg b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample.jpg deleted file mode 100644 index b537c00..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/Sample.jpg and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.Designer.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.Designer.cs deleted file mode 100644 index 135a92f..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.Designer.cs +++ /dev/null @@ -1,119 +0,0 @@ -namespace Sample08 -{ - partial class SampleForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.pictureBox = new System.Windows.Forms.PictureBox(); - this.bLoad = new System.Windows.Forms.Button(); - this.SaveToSer = new System.Windows.Forms.Button(); - this.LoadSerBitmap = new System.Windows.Forms.Button(); - this.bClearBitmap = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox - // - this.pictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; - this.pictureBox.Location = new System.Drawing.Point(12, 12); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(600, 400); - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; - // - // bLoad - // - this.bLoad.Location = new System.Drawing.Point(12, 418); - this.bLoad.Name = "bLoad"; - this.bLoad.Size = new System.Drawing.Size(98, 23); - this.bLoad.TabIndex = 1; - this.bLoad.Text = "Load any bitmap"; - this.bLoad.UseVisualStyleBackColor = true; - this.bLoad.Click += new System.EventHandler(this.bLoad_Click); - // - // SaveToSer - // - this.SaveToSer.Location = new System.Drawing.Point(324, 418); - this.SaveToSer.Name = "SaveToSer"; - this.SaveToSer.Size = new System.Drawing.Size(98, 23); - this.SaveToSer.TabIndex = 2; - this.SaveToSer.Text = "Save as .ser"; - this.SaveToSer.UseVisualStyleBackColor = true; - this.SaveToSer.Click += new System.EventHandler(this.SaveToSer_Click); - // - // LoadSerBitmap - // - this.LoadSerBitmap.Location = new System.Drawing.Point(220, 418); - this.LoadSerBitmap.Name = "LoadSerBitmap"; - this.LoadSerBitmap.Size = new System.Drawing.Size(98, 23); - this.LoadSerBitmap.TabIndex = 3; - this.LoadSerBitmap.Text = "Load .ser bitmap"; - this.LoadSerBitmap.UseVisualStyleBackColor = true; - this.LoadSerBitmap.Click += new System.EventHandler(this.LoadSerBitmap_Click); - // - // bClearBitmap - // - this.bClearBitmap.Location = new System.Drawing.Point(116, 418); - this.bClearBitmap.Name = "bClearBitmap"; - this.bClearBitmap.Size = new System.Drawing.Size(98, 23); - this.bClearBitmap.TabIndex = 4; - this.bClearBitmap.Text = "Clear screen"; - this.bClearBitmap.UseVisualStyleBackColor = true; - this.bClearBitmap.Click += new System.EventHandler(this.bClearBitmap_Click); - // - // SampleForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(627, 448); - this.Controls.Add(this.bClearBitmap); - this.Controls.Add(this.LoadSerBitmap); - this.Controls.Add(this.SaveToSer); - this.Controls.Add(this.bLoad); - this.Controls.Add(this.pictureBox); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SampleForm"; - this.ShowIcon = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Sample 08"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox; - private System.Windows.Forms.Button bLoad; - private System.Windows.Forms.Button SaveToSer; - private System.Windows.Forms.Button LoadSerBitmap; - private System.Windows.Forms.Button bClearBitmap; - } -} - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.cs deleted file mode 100644 index 87b83ed..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.cs +++ /dev/null @@ -1,217 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using FreeImageAPI; -using System.Runtime.InteropServices; -using System.Security.Permissions; - -namespace Sample08 -{ - public partial class SampleForm : Form - { - SerializationPlugin serialPlugin; - - [STAThread] - static void Main() - { - // Check if FreeImage is available - if (!FreeImage.IsAvailable()) - { - throw new Exception("FreeImage is not available!"); - } - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new SampleForm()); - } - - public SampleForm() - { - InitializeComponent(); - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - - // Creating a new instance of the plugin will register it automatically. - serialPlugin = new SerializationPlugin(); - } - - void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - // Show the message - MessageBox.Show(String.Format("Format: {0}\nMessage: {1}", fif, message), "FreeImage Message"); - } - - private void bLoad_Click(object sender, EventArgs e) - { - // Create a new dialog instance - OpenFileDialog ofd = new OpenFileDialog(); - try - { - // Apply settings - ofd.CheckPathExists = true; - ofd.CheckFileExists = true; - ofd.RestoreDirectory = true; - ofd.Filter = "All files (*.*)|*.*"; - - // Get filename - if (ofd.ShowDialog(this) == DialogResult.OK) - { - Bitmap bitmap = null; - try - { - // Try loading the selected file - // a ser-file will create an exception - bitmap = (Bitmap)Bitmap.FromFile(ofd.FileName); - } - catch - { - MessageBox.Show("Unable to load bitmap from file.", "Error"); - return; - } - - // Unload old bitmap - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - } - - // Set new bitmap - pictureBox.Image = bitmap; - MessageBox.Show("Bitmap loaded successfully", "Success"); - } - else - { - MessageBox.Show("Action aborted."); - } - } - finally - { - // Unload dialog - ofd.Dispose(); - } - } - - private void LoadSerBitmap_Click(object sender, EventArgs e) - { - // Creat a new dialog - OpenFileDialog ofd = new OpenFileDialog(); - - FIBITMAP dib = new FIBITMAP(); - try - { - // Apply settings - ofd.CheckPathExists = true; - ofd.CheckFileExists = true; - ofd.RestoreDirectory = true; - ofd.Filter = "Serialized bitmap (*.ser)|*.ser"; - - // Get filename - if (ofd.ShowDialog() == DialogResult.OK) - { - // Try loading the file forcing the new format - dib = FreeImage.Load(serialPlugin.Format, ofd.FileName, FREE_IMAGE_LOAD_FLAGS.DEFAULT); - if (dib.IsNull) - { - MessageBox.Show("Loading bitmap failed", "Error"); - return; - } - - // Convert the loaded bitmap into a .NET bitmap - Bitmap bitmap = FreeImage.GetBitmap(dib); - if (bitmap == null) - { - MessageBox.Show("Converting bitmap failed.", "Error"); - return; - } - - // Unload the picturebox - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - } - - // Apply the loaded bitmap - pictureBox.Image = bitmap; - MessageBox.Show("Bitmap loaded successfully", "Success"); - } - else - { - MessageBox.Show("Action aborted."); - } - } - finally - { - // Unload bitmap - FreeImage.UnloadEx(ref dib); - - // Unload dialog - ofd.Dispose(); - } - } - - private void SaveToSer_Click(object sender, EventArgs e) - { - // Create a new dialog - SaveFileDialog sfd = new SaveFileDialog(); - - FIBITMAP dib = new FIBITMAP(); - try - { - // Check if the picture box contains a bitmap that can be saved. - if (pictureBox.Image == null) - { - MessageBox.Show("No bitmap loaded.", "Error"); - return; - } - - // Convert the picture-boxes bitmap into a FreeImage bitmap. - dib = FreeImage.CreateFromBitmap((Bitmap)pictureBox.Image); - if (dib.IsNull) - { - MessageBox.Show("Unable to convert bitmap to FIBITMAP.", "Error"); - return; - } - - // Apply settings - sfd.Filter = "Serialized bitmap (*.ser)|*.ser"; - sfd.FileName = "Bitmap.ser"; - sfd.OverwritePrompt = true; - sfd.RestoreDirectory = true; - - // Get filename - if (sfd.ShowDialog() == DialogResult.OK) - { - // Save bitmap in the new format - if (FreeImage.SaveEx(dib, sfd.FileName, serialPlugin.Format)) - MessageBox.Show("Bitmap saved successfully.", "Success"); - else - MessageBox.Show("Saving bitmap failed.", "Failure"); - } - else - { - MessageBox.Show("Action aborted."); - } - } - finally - { - // Unload bitmap - FreeImage.UnloadEx(ref dib); - - // Unload dialog - sfd.Dispose(); - } - } - - private void bClearBitmap_Click(object sender, EventArgs e) - { - // Unload the picture-box - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - pictureBox.Image = null; - } - } - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.resx b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.resx deleted file mode 100644 index 19dc0dd..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SampleForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SerializationPlugin.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SerializationPlugin.cs deleted file mode 100644 index a8ef7d5..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 08 - Creating a plugin/SerializationPlugin.cs +++ /dev/null @@ -1,222 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Runtime.InteropServices; -using System.Runtime.Serialization.Formatters.Binary; -using System.IO; -using System.IO.Compression; -using FreeImageAPI; -using FreeImageAPI.IO; -using FreeImageAPI.Plugins; - -namespace Sample08 -{ - public sealed class SerializationPlugin : LocalPlugin - { - // Header for the file - private byte[] header = new byte[] { 0xff, 0x12, 0x0f, 0xff, 0x01, 0x00 }; - - // Structure that will store all bitmap data. - [Serializable] - private struct SerialDib - { - public uint width; - public uint height; - public int pitch; - public uint bpp; - public uint red_mask; - public uint green_mask; - public uint blue_mask; - public byte[] data; - } - - // Implementation of 'GetImplementedMethods()' - // All implemented methods are listed. - protected override LocalPlugin.MethodFlags GetImplementedMethods() - { - return - MethodFlags.DescriptionProc | - MethodFlags.SupportsExportBPPProc | - MethodFlags.SupportsExportTypeProc | - MethodFlags.SupportsICCProfilesProc | - MethodFlags.LoadProc | - MethodFlags.SaveProc | - MethodFlags.ValidateProc | - MethodFlags.ExtensionListProc; - } - - // Returns a format string. - protected override string FormatProc() - { - return "Serialization"; - } - - // Returns a more specific description - protected override string DescriptionProc() - { - return "Serializes bitmaps for .NET"; - } - - // Returns whether a color depth is supported. - protected override bool SupportsExportBPPProc(int bpp) - { - return ((bpp == 1) || - (bpp == 4) || - (bpp == 8) || - (bpp == 16) || - (bpp == 24) || - (bpp == 32)); - } - - // This plugin can only export standard bitmaps - protected override bool SupportsExportTypeProc(FREE_IMAGE_TYPE type) - { - return (type == FREE_IMAGE_TYPE.FIT_BITMAP); - } - - // This plugin does not support icc profiles - protected override bool SupportsICCProfilesProc() - { - return false; - } - - // The function reads the first bytes of the file and compares it - // with the predefined header. - protected override bool ValidateProc(ref FreeImageIO io, fi_handle handle) - { - for (int i = 0; i < header.Length; i++) - if (ReadByte(io, handle) != header[i]) - return false; - return true; - } - - // Loading function - protected override FIBITMAP LoadProc(ref FreeImageIO io, fi_handle handle, int page, int flags, IntPtr data) - { - // Check if the data has the correct format - if (!ValidateProc(ref io, handle)) - { - // Create a free-image message - FreeImage.OutputMessageProc(format, "Invalid format."); - // return 0 (operation failed) - return FIBITMAP.Zero; - } - - SerialDib sdib; - int read = 0; - System.IO.MemoryStream stream = new System.IO.MemoryStream(); - byte[] buffer = new byte[1024]; - - do - { - // Use the helper function 'Read' to read from the source - read = Read(io, handle, 1, 1024, ref buffer); - - // Store the data in a temporary buffer - stream.Write(buffer, 0, read); - } - while (read != 0); - - // Set the memory stream back to the beginning. - stream.Position = 0; - - // Unzip the stream - GZipStream zipStream = new GZipStream(stream, CompressionMode.Decompress); - - // Create a serializer - BinaryFormatter formatter = new BinaryFormatter(); - - // Deserialize the stream - sdib = (SerialDib)formatter.Deserialize(zipStream); - - // Unload the stream - zipStream.Dispose(); - - // Use 'ConvertFromRawBits and the deserialized struct to recreate the bitmap - // In this case the marshaller is used to create the needed IntPtr to the data - // array. - FIBITMAP dib = FreeImage.ConvertFromRawBits( - Marshal.UnsafeAddrOfPinnedArrayElement(sdib.data, 0), - (int)sdib.width, (int)sdib.height, sdib.pitch, sdib.bpp, - sdib.red_mask, sdib.green_mask, sdib.blue_mask, - false); - - // Unload the temporary stream - stream.Dispose(); - - // Return the created bitmap - return dib; - } - - // Saving function - protected override bool SaveProc(ref FreeImageIO io, FIBITMAP dib, fi_handle handle, int page, int flags, IntPtr data) - { - SerialDib sdib; - uint size = FreeImage.GetDIBSize(dib); - - // Store all data needed to recreate the bitmap - sdib.width = FreeImage.GetWidth(dib); - sdib.height = FreeImage.GetHeight(dib); - sdib.pitch = (int)FreeImage.GetPitch(dib); - sdib.bpp = FreeImage.GetBPP(dib); - sdib.red_mask = FreeImage.GetRedMask(dib); - sdib.green_mask = FreeImage.GetGreenMask(dib); - sdib.blue_mask = FreeImage.GetBlueMask(dib); - sdib.data = new byte[size]; - - // Copy the bitmaps data into the structures byte-array - // The marshaller is used to create an IntPtr for using - // 'ConvertToRawBits'. - FreeImage.ConvertToRawBits(Marshal.UnsafeAddrOfPinnedArrayElement(sdib.data, 0), - dib, sdib.pitch, sdib.bpp, - sdib.red_mask, sdib.green_mask, sdib.blue_mask, - false); - - // Use the healper function to write the header to the destination - if (Write(io, handle, (uint)header.Length, 1, ref header) != 1) - return false; - - // Create a serializer - BinaryFormatter formatter = new BinaryFormatter(); - - // Create a temporary stream - MemoryStream stream = new MemoryStream(); - - // Create a compression stream - GZipStream zipStream = new GZipStream(stream, CompressionMode.Compress); - - // Serialize the structure into the compression stream - formatter.Serialize(zipStream, sdib); - - // Unload the compression stream - zipStream.Dispose(); - - // Get the result data - byte[] buffer = stream.GetBuffer(); - - // Use the healper function 'Write' to write the data to the destination - if (Write(io, handle, 1, (uint)buffer.Length, ref buffer) != buffer.Length) - { - // Unload the temporary stream - stream.Dispose(); - return false; - } - - // Unload the temporary stream - stream.Dispose(); - return true; - } - - // Return a list of supported file extensions (comma seperated) - protected override string ExtensionListProc() - { - return "ser"; - } - - // Implementation of 'ToString()' - public override string ToString() - { - return DescriptionProc(); - } - } -} diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Properties/AssemblyInfo.cs deleted file mode 100644 index 979d488..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("7f29fbaa-d2b3-4011-b34f-5a109bc282af")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Sample 09 - Working with streams.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Sample 09 - Working with streams.csproj deleted file mode 100644 index dfa759d..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/Sample 09 - Working with streams.csproj +++ /dev/null @@ -1,103 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {92A454B2-67EF-4B70-99C9-F22B83B6FBFF} - WinExe - Properties - Sample09 - Sample09 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - false - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - false - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - false - prompt - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - - - - Form - - - SampleForm.cs - - - - - Designer - SampleForm.cs - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.Designer.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.Designer.cs deleted file mode 100644 index 8d90e17..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.Designer.cs +++ /dev/null @@ -1,115 +0,0 @@ -namespace Sample09 -{ - partial class SampleForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.picBox = new System.Windows.Forms.PictureBox(); - this.tbURL = new System.Windows.Forms.TextBox(); - this.lUrl = new System.Windows.Forms.Label(); - this.bLoadUrl = new System.Windows.Forms.Button(); - this.bSave = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.picBox)).BeginInit(); - this.SuspendLayout(); - // - // picBox - // - this.picBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picBox.Location = new System.Drawing.Point(12, 12); - this.picBox.Name = "picBox"; - this.picBox.Size = new System.Drawing.Size(536, 299); - this.picBox.TabIndex = 0; - this.picBox.TabStop = false; - // - // tbURL - // - this.tbURL.Location = new System.Drawing.Point(155, 317); - this.tbURL.Name = "tbURL"; - this.tbURL.Size = new System.Drawing.Size(393, 20); - this.tbURL.TabIndex = 1; - this.tbURL.Text = "http://freeimage.sourceforge.net/images/logo.jpg"; - // - // lUrl - // - this.lUrl.AutoSize = true; - this.lUrl.Location = new System.Drawing.Point(9, 320); - this.lUrl.Name = "lUrl"; - this.lUrl.Size = new System.Drawing.Size(137, 13); - this.lUrl.TabIndex = 2; - this.lUrl.Text = "Enter the URL of an Image:"; - // - // bLoadUrl - // - this.bLoadUrl.Location = new System.Drawing.Point(12, 344); - this.bLoadUrl.Name = "bLoadUrl"; - this.bLoadUrl.Size = new System.Drawing.Size(75, 23); - this.bLoadUrl.TabIndex = 3; - this.bLoadUrl.Text = "Load URL"; - this.bLoadUrl.UseVisualStyleBackColor = true; - this.bLoadUrl.Click += new System.EventHandler(this.bLoadUrl_Click); - // - // bSave - // - this.bSave.Location = new System.Drawing.Point(93, 344); - this.bSave.Name = "bSave"; - this.bSave.Size = new System.Drawing.Size(75, 23); - this.bSave.TabIndex = 4; - this.bSave.Text = "Save to disk"; - this.bSave.UseVisualStyleBackColor = true; - this.bSave.Click += new System.EventHandler(this.bSave_Click); - // - // SampleForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(560, 379); - this.Controls.Add(this.bSave); - this.Controls.Add(this.bLoadUrl); - this.Controls.Add(this.lUrl); - this.Controls.Add(this.tbURL); - this.Controls.Add(this.picBox); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "SampleForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Sample09"; - ((System.ComponentModel.ISupportInitialize)(this.picBox)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox picBox; - private System.Windows.Forms.TextBox tbURL; - private System.Windows.Forms.Label lUrl; - private System.Windows.Forms.Button bLoadUrl; - private System.Windows.Forms.Button bSave; - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.cs deleted file mode 100644 index 2440394..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using FreeImageAPI; -using System.Net; -using System.IO; - -namespace Sample09 -{ - public partial class SampleForm : Form - { - [STAThread] - static void Main() - { - // Check if FreeImage is available - if (!FreeImage.IsAvailable()) - { - throw new Exception("FreeImage is not available!"); - } - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new SampleForm()); - } - - public SampleForm() - { - InitializeComponent(); - } - - private void bLoadUrl_Click(object sender, EventArgs e) - { - // Verify url - if (String.IsNullOrEmpty(tbURL.Text)) - { - MessageBox.Show("Please enter a valid URL.", "Error"); - return; - } - FIBITMAP dib = new FIBITMAP(); - Stream sourceStream = null; - try - { - // Build a stream to read from - WebRequest request = (WebRequest)HttpWebRequest.Create(tbURL.Text); - WebResponse response = request.GetResponse(); - sourceStream = response.GetResponseStream(); - if (sourceStream == null) - { - throw new Exception(); - } - // Load the image from stream - dib = FreeImage.LoadFromStream(sourceStream); - // Check success - if (dib.IsNull) - { - throw new Exception(); - } - // Convert the bitmap into a .NET bitmap - Bitmap bitmap = FreeImage.GetBitmap(dib); - if (bitmap == null) - { - throw new Exception(); - } - // Show the bitmap - if (picBox.Image != null) - { - picBox.Image.Dispose(); - } - picBox.Image = bitmap; - } - catch - { - // Error handling - MessageBox.Show("Error loading URL.", "Error"); - } - finally - { - // Clean up memory - FreeImage.UnloadEx(ref dib); - if (sourceStream != null) sourceStream.Dispose(); - } - } - - private void bSave_Click(object sender, EventArgs e) - { - // Check if there is a loaded bitmap - if (picBox.Image == null) - { - MessageBox.Show("No image loaded.", "Error"); - return; - } - SaveFileDialog sfd = null; - FileStream fStream = null; - FIBITMAP dib = new FIBITMAP(); - try - { - sfd = new SaveFileDialog(); - sfd.CreatePrompt = false; - sfd.FileName = ""; - sfd.Filter = "TIF (*tif)|*.tif"; - sfd.OverwritePrompt = true; - sfd.RestoreDirectory = true; - if (sfd.ShowDialog() == DialogResult.OK) - { - // Convert the .NET bitmap into a FreeImage-Bitmap - dib = FreeImage.CreateFromBitmap((Bitmap)picBox.Image); - if (dib.IsNull) - { - throw new Exception(); - } - // Create a filestream to write to - fStream = new FileStream(sfd.FileName, FileMode.Create); - if (!FreeImage.SaveToStream( - ref dib, - fStream, - FREE_IMAGE_FORMAT.FIF_TIFF, - FREE_IMAGE_SAVE_FLAGS.TIFF_LZW, - FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, - false)) - { - throw new Exception(); - } - MessageBox.Show("Image saved successfully.", "Success"); - } - else - { - MessageBox.Show("Operation aborted.", "Aborted"); - } - } - catch - { - MessageBox.Show("Error saving image.", "Error"); - } - finally - { - // Clean up - if (sfd != null) sfd.Dispose(); - if (fStream != null) fStream.Dispose(); - FreeImage.UnloadEx(ref dib); - } - } - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.resx b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.resx deleted file mode 100644 index 19dc0dd..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 09 - Working with streams/SampleForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.Designer.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.Designer.cs deleted file mode 100644 index 327e378..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.Designer.cs +++ /dev/null @@ -1,87 +0,0 @@ -namespace Sample10 -{ - partial class MainForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.bLoad = new System.Windows.Forms.Button(); - this.bQuit = new System.Windows.Forms.Button(); - this.tvMetadata = new System.Windows.Forms.TreeView(); - this.SuspendLayout(); - // - // bLoad - // - this.bLoad.Location = new System.Drawing.Point(12, 336); - this.bLoad.Name = "bLoad"; - this.bLoad.Size = new System.Drawing.Size(75, 23); - this.bLoad.TabIndex = 0; - this.bLoad.Text = "Load Image"; - this.bLoad.UseVisualStyleBackColor = true; - this.bLoad.Click += new System.EventHandler(this.bLoad_Click); - // - // bQuit - // - this.bQuit.Location = new System.Drawing.Point(328, 336); - this.bQuit.Name = "bQuit"; - this.bQuit.Size = new System.Drawing.Size(75, 23); - this.bQuit.TabIndex = 1; - this.bQuit.Text = "Quit"; - this.bQuit.UseVisualStyleBackColor = true; - this.bQuit.Click += new System.EventHandler(this.bQuit_Click); - // - // tvMetadata - // - this.tvMetadata.Location = new System.Drawing.Point(12, 12); - this.tvMetadata.Name = "tvMetadata"; - this.tvMetadata.Size = new System.Drawing.Size(389, 318); - this.tvMetadata.TabIndex = 2; - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(415, 371); - this.Controls.Add(this.tvMetadata); - this.Controls.Add(this.bQuit); - this.Controls.Add(this.bLoad); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MainForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "MainForm"; - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.Button bLoad; - private System.Windows.Forms.Button bQuit; - private System.Windows.Forms.TreeView tvMetadata; - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.cs deleted file mode 100644 index d97f2ea..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; -using FreeImageAPI; -using FreeImageAPI.Metadata; - -namespace Sample10 -{ - public partial class MainForm : Form - { - [STAThread] - static void Main() - { - // Check if FreeImage.dll is available - if (!FreeImage.IsAvailable()) - { - MessageBox.Show("FreeImage is not available. Aborting.", "Error"); - } - - // Add this class to the FreeImage-Message-Callback - FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - - static void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) - { - // Display the data - MessageBox.Show( - String.Format("FreeImage-Message:\n{1}\nFormat:{0}", fif.ToString(), message), - "FreeImage-Message"); - } - - public MainForm() - { - InitializeComponent(); - } - - private void bQuit_Click(object sender, EventArgs e) - { - Application.Exit(); - } - - private void bLoad_Click(object sender, EventArgs e) - { - // Create variables - OpenFileDialog ofd = new OpenFileDialog(); - FIBITMAP dib = new FIBITMAP(); - try - { - // Apply settings - ofd.CheckFileExists = true; - ofd.CheckPathExists = true; - ofd.FileName = ""; - ofd.Filter = "All files (*.*)|*.*"; - ofd.Multiselect = false; - ofd.RestoreDirectory = true; - // Get image filename - if (ofd.ShowDialog() == DialogResult.OK) - { - // Load the image - dib = FreeImage.LoadEx(ofd.FileName); - // Check if image was loaded successfully - if (dib.IsNull) throw new Exception("Failed to load image."); - // Clear the treeview - tvMetadata.Nodes.Clear(); - // Create a wrapper for all metadata the image contains - ImageMetadata iMetadata = new ImageMetadata(dib); - // Get each metadata model - foreach (MetadataModel metadataModel in iMetadata) - { - // Create a new node for each model - TreeNode modelNode = tvMetadata.Nodes.Add(metadataModel.ToString()); - - // Get each metadata tag and create a subnode for it - foreach (MetadataTag metadataTag in metadataModel) - { - modelNode.Nodes.Add(metadataTag.Key + ": " + metadataTag.ToString()); - } - } - } - else - { - MessageBox.Show("Operation aborted.", "Aborted"); - } - } - // Display error message - catch (Exception ex) - { - while (ex.InnerException != null) - ex = ex.InnerException; - MessageBox.Show(ex.ToString(), "Exception caught"); - } - // Clean up - finally - { - ofd.Dispose(); - FreeImage.UnloadEx(ref dib); - } - } - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.resx b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.resx deleted file mode 100644 index 19dc0dd..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/MainForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Properties/AssemblyInfo.cs deleted file mode 100644 index 2e84d4c..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("e8da4fa8-cc15-4b0e-8c57-d55ceb771559")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Sample 10 - Metadata.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Sample 10 - Metadata.csproj deleted file mode 100644 index 39a580b..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 10 - Metadata/Sample 10 - Metadata.csproj +++ /dev/null @@ -1,101 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {55DCC37A-E56C-44D9-9C44-8DAB10CD3003} - WinExe - Properties - Sample10 - Sample10 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - none - true - bin\Release\ - TRACE - prompt - 4 - - - true - bin\Debug\ - DEBUG;TRACE - full - x86 - false - prompt - - - bin\Release\ - TRACE - true - - - x86 - prompt - - - true - bin\Debug\ - DEBUG;TRACE - full - x64 - false - prompt - - - bin\Release\ - TRACE - true - - - x64 - prompt - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - - - - Form - - - MainForm.cs - - - - - - Designer - MainForm.cs - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.Designer.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.Designer.cs deleted file mode 100644 index eb122c9..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.Designer.cs +++ /dev/null @@ -1,382 +0,0 @@ -namespace Sample11 -{ - partial class MainForm - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.pictureBox = new System.Windows.Forms.PictureBox(); - this.bLoadImage = new System.Windows.Forms.Button(); - this.bSaveImage = new System.Windows.Forms.Button(); - this.ofd = new System.Windows.Forms.OpenFileDialog(); - this.sfd = new System.Windows.Forms.SaveFileDialog(); - this.lWidth = new System.Windows.Forms.Label(); - this.lHeight = new System.Windows.Forms.Label(); - this.lBpp = new System.Windows.Forms.Label(); - this.lMetadataCount = new System.Windows.Forms.Label(); - this.bGreyscale = new System.Windows.Forms.Button(); - this.cbSelectFrame = new System.Windows.Forms.ComboBox(); - this.lComment = new System.Windows.Forms.Label(); - this.bAdjustGamma = new System.Windows.Forms.Button(); - this.vGamma = new System.Windows.Forms.NumericUpDown(); - this.bRedChannelOnly = new System.Windows.Forms.Button(); - this.bBlueChannel = new System.Windows.Forms.Button(); - this.bGreenChannel = new System.Windows.Forms.Button(); - this.bAllChannels = new System.Windows.Forms.Button(); - this.lSelectFrame = new System.Windows.Forms.Label(); - this.lImageFormat = new System.Windows.Forms.Label(); - this.bRotate = new System.Windows.Forms.Button(); - this.vRotate = new System.Windows.Forms.TrackBar(); - this.lRotate = new System.Windows.Forms.Label(); - this.lColors = new System.Windows.Forms.Label(); - this.nShowMetadata = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.vGamma)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.vRotate)).BeginInit(); - this.SuspendLayout(); - // - // pictureBox - // - this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.pictureBox.Location = new System.Drawing.Point(14, 15); - this.pictureBox.Margin = new System.Windows.Forms.Padding(4); - this.pictureBox.Name = "pictureBox"; - this.pictureBox.Size = new System.Drawing.Size(542, 395); - this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.pictureBox.TabIndex = 0; - this.pictureBox.TabStop = false; - // - // bLoadImage - // - this.bLoadImage.Location = new System.Drawing.Point(564, 15); - this.bLoadImage.Margin = new System.Windows.Forms.Padding(4); - this.bLoadImage.Name = "bLoadImage"; - this.bLoadImage.Size = new System.Drawing.Size(125, 28); - this.bLoadImage.TabIndex = 1; - this.bLoadImage.Text = "Load image"; - this.bLoadImage.UseVisualStyleBackColor = true; - this.bLoadImage.Click += new System.EventHandler(this.bLoadImage_Click); - // - // bSaveImage - // - this.bSaveImage.Location = new System.Drawing.Point(564, 51); - this.bSaveImage.Margin = new System.Windows.Forms.Padding(4); - this.bSaveImage.Name = "bSaveImage"; - this.bSaveImage.Size = new System.Drawing.Size(125, 28); - this.bSaveImage.TabIndex = 2; - this.bSaveImage.Text = "Save image"; - this.bSaveImage.UseVisualStyleBackColor = true; - this.bSaveImage.Click += new System.EventHandler(this.bSaveImage_Click); - // - // ofd - // - this.ofd.AddExtension = false; - this.ofd.AutoUpgradeEnabled = false; - this.ofd.Filter = "All files|*.*"; - this.ofd.RestoreDirectory = true; - this.ofd.SupportMultiDottedExtensions = true; - // - // sfd - // - this.sfd.AddExtension = false; - this.sfd.Filter = "All files|*.*"; - this.sfd.RestoreDirectory = true; - this.sfd.SupportMultiDottedExtensions = true; - // - // lWidth - // - this.lWidth.AutoSize = true; - this.lWidth.Location = new System.Drawing.Point(563, 350); - this.lWidth.Name = "lWidth"; - this.lWidth.Size = new System.Drawing.Size(57, 16); - this.lWidth.TabIndex = 6; - this.lWidth.Text = "Width: 0"; - // - // lHeight - // - this.lHeight.AutoSize = true; - this.lHeight.Location = new System.Drawing.Point(649, 350); - this.lHeight.Name = "lHeight"; - this.lHeight.Size = new System.Drawing.Size(60, 16); - this.lHeight.TabIndex = 7; - this.lHeight.Text = "Height: 0"; - // - // lBpp - // - this.lBpp.AutoSize = true; - this.lBpp.Location = new System.Drawing.Point(740, 350); - this.lBpp.Name = "lBpp"; - this.lBpp.Size = new System.Drawing.Size(45, 16); - this.lBpp.TabIndex = 8; - this.lBpp.Text = "Bpp: 0"; - // - // lMetadataCount - // - this.lMetadataCount.AutoSize = true; - this.lMetadataCount.Location = new System.Drawing.Point(809, 350); - this.lMetadataCount.Name = "lMetadataCount"; - this.lMetadataCount.Size = new System.Drawing.Size(77, 16); - this.lMetadataCount.TabIndex = 9; - this.lMetadataCount.Text = "Metadata: 0"; - // - // bGreyscale - // - this.bGreyscale.Location = new System.Drawing.Point(564, 121); - this.bGreyscale.Name = "bGreyscale"; - this.bGreyscale.Size = new System.Drawing.Size(125, 28); - this.bGreyscale.TabIndex = 10; - this.bGreyscale.Text = "Conv to greyscale"; - this.bGreyscale.UseVisualStyleBackColor = true; - this.bGreyscale.Click += new System.EventHandler(this.bGreyscale_Click); - // - // cbSelectFrame - // - this.cbSelectFrame.FormattingEnabled = true; - this.cbSelectFrame.Location = new System.Drawing.Point(695, 156); - this.cbSelectFrame.Name = "cbSelectFrame"; - this.cbSelectFrame.Size = new System.Drawing.Size(121, 24); - this.cbSelectFrame.TabIndex = 11; - this.cbSelectFrame.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); - // - // lComment - // - this.lComment.AutoSize = true; - this.lComment.Location = new System.Drawing.Point(563, 373); - this.lComment.Name = "lComment"; - this.lComment.Size = new System.Drawing.Size(107, 16); - this.lComment.TabIndex = 12; - this.lComment.Text = "Image-comment:"; - // - // bAdjustGamma - // - this.bAdjustGamma.Location = new System.Drawing.Point(564, 185); - this.bAdjustGamma.Name = "bAdjustGamma"; - this.bAdjustGamma.Size = new System.Drawing.Size(125, 28); - this.bAdjustGamma.TabIndex = 13; - this.bAdjustGamma.Text = "Adjust gamma"; - this.bAdjustGamma.UseVisualStyleBackColor = true; - this.bAdjustGamma.Click += new System.EventHandler(this.bAdjustGamma_Click); - // - // vGamma - // - this.vGamma.DecimalPlaces = 2; - this.vGamma.Increment = new decimal(new int[] { - 0, - 0, - 0, - 0}); - this.vGamma.Location = new System.Drawing.Point(695, 189); - this.vGamma.Maximum = new decimal(new int[] { - 2, - 0, - 0, - 0}); - this.vGamma.Name = "vGamma"; - this.vGamma.Size = new System.Drawing.Size(121, 23); - this.vGamma.TabIndex = 14; - // - // bRedChannelOnly - // - this.bRedChannelOnly.Location = new System.Drawing.Point(564, 219); - this.bRedChannelOnly.Name = "bRedChannelOnly"; - this.bRedChannelOnly.Size = new System.Drawing.Size(125, 28); - this.bRedChannelOnly.TabIndex = 15; - this.bRedChannelOnly.Text = "Red channel"; - this.bRedChannelOnly.UseVisualStyleBackColor = true; - this.bRedChannelOnly.Click += new System.EventHandler(this.bRedChannelOnly_Click); - // - // bBlueChannel - // - this.bBlueChannel.Location = new System.Drawing.Point(564, 287); - this.bBlueChannel.Name = "bBlueChannel"; - this.bBlueChannel.Size = new System.Drawing.Size(125, 28); - this.bBlueChannel.TabIndex = 16; - this.bBlueChannel.Text = "Blue channel"; - this.bBlueChannel.UseVisualStyleBackColor = true; - this.bBlueChannel.Click += new System.EventHandler(this.bBlueChannel_Click); - // - // bGreenChannel - // - this.bGreenChannel.Location = new System.Drawing.Point(564, 253); - this.bGreenChannel.Name = "bGreenChannel"; - this.bGreenChannel.Size = new System.Drawing.Size(125, 28); - this.bGreenChannel.TabIndex = 17; - this.bGreenChannel.Text = "Green channel"; - this.bGreenChannel.UseVisualStyleBackColor = true; - this.bGreenChannel.Click += new System.EventHandler(this.bGreenChannel_Click); - // - // bAllChannels - // - this.bAllChannels.Location = new System.Drawing.Point(563, 321); - this.bAllChannels.Name = "bAllChannels"; - this.bAllChannels.Size = new System.Drawing.Size(126, 28); - this.bAllChannels.TabIndex = 18; - this.bAllChannels.Text = "All channels"; - this.bAllChannels.UseVisualStyleBackColor = true; - this.bAllChannels.Click += new System.EventHandler(this.bAllChannels_Click); - // - // lSelectFrame - // - this.lSelectFrame.AutoSize = true; - this.lSelectFrame.Location = new System.Drawing.Point(563, 159); - this.lSelectFrame.Name = "lSelectFrame"; - this.lSelectFrame.Size = new System.Drawing.Size(86, 16); - this.lSelectFrame.TabIndex = 19; - this.lSelectFrame.Text = "Select frame:"; - // - // lImageFormat - // - this.lImageFormat.AutoSize = true; - this.lImageFormat.Location = new System.Drawing.Point(563, 395); - this.lImageFormat.Name = "lImageFormat"; - this.lImageFormat.Size = new System.Drawing.Size(92, 16); - this.lImageFormat.TabIndex = 20; - this.lImageFormat.Text = "Image-format:"; - // - // bRotate - // - this.bRotate.Location = new System.Drawing.Point(564, 86); - this.bRotate.Name = "bRotate"; - this.bRotate.Size = new System.Drawing.Size(125, 28); - this.bRotate.TabIndex = 21; - this.bRotate.Text = "Rotate"; - this.bRotate.UseVisualStyleBackColor = true; - this.bRotate.Click += new System.EventHandler(this.bRotate_Click); - // - // vRotate - // - this.vRotate.Location = new System.Drawing.Point(695, 80); - this.vRotate.Maximum = 360; - this.vRotate.Name = "vRotate"; - this.vRotate.Size = new System.Drawing.Size(170, 45); - this.vRotate.TabIndex = 22; - this.vRotate.TickFrequency = 10; - this.vRotate.TickStyle = System.Windows.Forms.TickStyle.Both; - this.vRotate.Scroll += new System.EventHandler(this.vRotate_Scroll); - // - // lRotate - // - this.lRotate.AutoSize = true; - this.lRotate.Location = new System.Drawing.Point(871, 92); - this.lRotate.Name = "lRotate"; - this.lRotate.Size = new System.Drawing.Size(15, 16); - this.lRotate.TabIndex = 23; - this.lRotate.Text = "0"; - // - // lColors - // - this.lColors.AutoSize = true; - this.lColors.Location = new System.Drawing.Point(740, 394); - this.lColors.Name = "lColors"; - this.lColors.Size = new System.Drawing.Size(60, 16); - this.lColors.TabIndex = 24; - this.lColors.Text = "Colors: 0"; - // - // nShowMetadata - // - this.nShowMetadata.Location = new System.Drawing.Point(696, 15); - this.nShowMetadata.Name = "nShowMetadata"; - this.nShowMetadata.Size = new System.Drawing.Size(125, 28); - this.nShowMetadata.TabIndex = 25; - this.nShowMetadata.Text = "Show metadata"; - this.nShowMetadata.UseVisualStyleBackColor = true; - this.nShowMetadata.Click += new System.EventHandler(this.nShowMetadata_Click); - // - // MainForm - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 16F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(908, 423); - this.Controls.Add(this.nShowMetadata); - this.Controls.Add(this.lColors); - this.Controls.Add(this.lRotate); - this.Controls.Add(this.vRotate); - this.Controls.Add(this.bRotate); - this.Controls.Add(this.lImageFormat); - this.Controls.Add(this.lSelectFrame); - this.Controls.Add(this.bAllChannels); - this.Controls.Add(this.bGreenChannel); - this.Controls.Add(this.bBlueChannel); - this.Controls.Add(this.bRedChannelOnly); - this.Controls.Add(this.vGamma); - this.Controls.Add(this.bAdjustGamma); - this.Controls.Add(this.lComment); - this.Controls.Add(this.cbSelectFrame); - this.Controls.Add(this.bGreyscale); - this.Controls.Add(this.lMetadataCount); - this.Controls.Add(this.lBpp); - this.Controls.Add(this.lHeight); - this.Controls.Add(this.lWidth); - this.Controls.Add(this.bSaveImage); - this.Controls.Add(this.bLoadImage); - this.Controls.Add(this.pictureBox); - this.DoubleBuffered = true; - this.Font = new System.Drawing.Font("Tahoma", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.Margin = new System.Windows.Forms.Padding(4); - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MainForm"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Sample 11"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.vGamma)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.vRotate)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.PictureBox pictureBox; - private System.Windows.Forms.Button bLoadImage; - private System.Windows.Forms.Button bSaveImage; - private System.Windows.Forms.OpenFileDialog ofd; - private System.Windows.Forms.SaveFileDialog sfd; - private System.Windows.Forms.Label lWidth; - private System.Windows.Forms.Label lHeight; - private System.Windows.Forms.Label lBpp; - private System.Windows.Forms.Label lMetadataCount; - private System.Windows.Forms.Button bGreyscale; - private System.Windows.Forms.ComboBox cbSelectFrame; - private System.Windows.Forms.Label lComment; - private System.Windows.Forms.Button bAdjustGamma; - private System.Windows.Forms.NumericUpDown vGamma; - private System.Windows.Forms.Button bRedChannelOnly; - private System.Windows.Forms.Button bBlueChannel; - private System.Windows.Forms.Button bGreenChannel; - private System.Windows.Forms.Button bAllChannels; - private System.Windows.Forms.Label lSelectFrame; - private System.Windows.Forms.Label lImageFormat; - private System.Windows.Forms.Button bRotate; - private System.Windows.Forms.TrackBar vRotate; - private System.Windows.Forms.Label lRotate; - private System.Windows.Forms.Label lColors; - private System.Windows.Forms.Button nShowMetadata; - } -} - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.cs deleted file mode 100644 index 0cb9973..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.cs +++ /dev/null @@ -1,412 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using FreeImageAPI; -using FreeImageAPI.Metadata; -using FreeImageAPI.Plugins; - -namespace Sample11 -{ - public partial class MainForm : Form - { - public MainForm() - { - InitializeComponent(); - } - - [STAThread] - static void Main() - { - // Capture messages generated by FreeImage - FreeImageEngine.Message += new OutputMessageFunction(FreeImageEngine_Message); - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainForm()); - } - - static void FreeImageEngine_Message(FREE_IMAGE_FORMAT fif, string message) - { - // Display the message - // FreeImage continues code executing when all - // addes subscribers of 'Message' finished returned. - MessageBox.Show(message, "FreeImage-Message", MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - // The FreeImageBitmap this sample will work with. - FreeImageBitmap bitmap = null; - - // Replaces the current bitmap with the given one. - private void ReplaceBitmap(FreeImageBitmap newBitmap) - { - // Checks whether the bitmap is usable - if (newBitmap == null || newBitmap.IsDisposed) - { - MessageBox.Show( - "Unexpected error.", - "Error", - MessageBoxButtons.OK, - MessageBoxIcon.Error); - } - - // Check whether the image type of the new bitmap is 'FIT_BITMAP'. - // If not convert to 'FIT_BITMAP'. - if (newBitmap.ImageType != FREE_IMAGE_TYPE.FIT_BITMAP) - { - if (!newBitmap.ConvertType(FREE_IMAGE_TYPE.FIT_BITMAP, true)) - { - MessageBox.Show( - "Error converting bitmap to standard type.", - "Error", - MessageBoxButtons.OK, - MessageBoxIcon.Error); - return; - } - } - - // Dispose the old bitmap only in case it exists and - // the old instance is another than the new one. - if ((bitmap != null) && !object.ReferenceEquals(bitmap, newBitmap)) - { - bitmap.Dispose(); - } - // Dispose the picturebox's bitmap in case it exists. - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - } - - // Set the new bitmap. - pictureBox.Image = (Bitmap)(bitmap = newBitmap); - - // Update gui. - UpdateBitmapInformations(); - UpdateFrameSelection(); - } - - // Get bitmap properties and display them in the gui. - private void UpdateBitmapInformations() - { - if (Bitmap) - { - // Get width - lWidth.Text = String.Format("Width: {0}", bitmap.Width); - // Get Height - lHeight.Text = String.Format("Height: {0}", bitmap.Height); - // Get color depth - lBpp.Text = String.Format("Bpp: {0}", bitmap.ColorDepth); - // Get number of metadata - ImageMetadata mData = bitmap.Metadata; - mData.HideEmptyModels = true; - int mCnt = 0; - foreach (MetadataModel model in mData.List) - { - mCnt += model.Count; - } - lMetadataCount.Text = String.Format("Metadata: {0}", mCnt); - // Get image comment - lComment.Text = String.Format("Image-comment: {0}", bitmap.Comment != null ? bitmap.Comment : String.Empty); - // Get the number of real colors in the image - lColors.Text = String.Format("Colors: {0}", bitmap.UniqueColors); - } - else - { - // Reset all values - lWidth.Text = String.Format("Width: {0}", 0); - lHeight.Text = String.Format("Height: {0}", 0); - lBpp.Text = String.Format("Bpp: {0}", 0); - lMetadataCount.Text = String.Format("Metadata: {0}", 0); - lComment.Text = String.Format("Image-comment: {0}", String.Empty); - lColors.Text = String.Format("Colors: {0}", 0); - } - } - - // Update combobox for frame selection. - private void UpdateFrameSelection() - { - cbSelectFrame.Items.Clear(); - if (Bitmap) - { - // Get number of frames in the bitmap - if (bitmap.FrameCount > 1) - { - // Add an entry for each frame to the combobox - for (int i = 0; i < bitmap.FrameCount; i++) - { - cbSelectFrame.Items.Add(String.Format("Frame {0}", i + 1)); - } - } - } - } - - // Returns true in case the variable 'bitmap' - // is set and not disposed. - private bool Bitmap - { - get { return ((bitmap != null) && (!bitmap.IsDisposed)); } - } - - private void bLoadImage_Click(object sender, EventArgs e) - { - if (ofd.ShowDialog() == DialogResult.OK) - { - try - { - // Load the file using autodetection - FreeImageBitmap fib = new FreeImageBitmap(ofd.FileName); - // Rescale the image so that it fits the picturebox - // Get the plugin that was used to load the bitmap - FreeImagePlugin plug = PluginRepository.Plugin(fib.ImageFormat); - lImageFormat.Text = String.Format("Image-format: {0}", plug.Format); - // Replace the existing bitmap with the new one - ReplaceBitmap(fib); - } - catch - { - } - } - } - - private void bSaveImage_Click(object sender, EventArgs e) - { - if (pictureBox.Image != null) - { - try - { - if (sfd.ShowDialog() == DialogResult.OK) - { - // Save the bitmap using autodetection - using (FreeImageBitmap temp = new FreeImageBitmap(pictureBox.Image)) - { - temp.Save(sfd.FileName); - } - } - } - catch - { - } - } - } - - private void bRotate_Click(object sender, EventArgs e) - { - if (Bitmap) - { - // Create a temporary rescaled bitmap - using (FreeImageBitmap temp = bitmap.GetScaledInstance( - pictureBox.DisplayRectangle.Width, pictureBox.DisplayRectangle.Height, - FREE_IMAGE_FILTER.FILTER_CATMULLROM)) - { - if (temp != null) - { - // Rotate the bitmap - temp.Rotate((double)vRotate.Value); - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - } - // Display the result - pictureBox.Image = (Bitmap)temp; - } - } - } - } - - private void bGreyscale_Click(object sender, EventArgs e) - { - if (Bitmap) - { - // Convert the bitmap to 8bpp and greyscale - ReplaceBitmap(bitmap.GetColorConvertedInstance( - FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP | - FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE)); - } - } - - private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) - { - ComboBox cb = sender as ComboBox; - if ((cb != null) && (cb.Items.Count > 0)) - { - if (Bitmap) - { - try - { - // Switch the selected frame - bitmap.SelectActiveFrame(cb.SelectedIndex); - ReplaceBitmap(bitmap); - } - catch (ArgumentOutOfRangeException) - { - MessageBox.Show("Error changing frame.", "Error"); - } - } - } - } - - private void bAdjustGamma_Click(object sender, EventArgs e) - { - if (Bitmap) - { - // Adjust the gamma value - bitmap.AdjustGamma((double)vGamma.Value); - ReplaceBitmap(bitmap); - } - } - - private void bRedChannelOnly_Click(object sender, EventArgs e) - { - // Mask out green and blue - SetColorChannels(0xFF, 0x00, 0x00); - } - - private void bGreenChannel_Click(object sender, EventArgs e) - { - // Mask out red and blue - SetColorChannels(0x00, 0xFF, 0x00); - } - - private void bBlueChannel_Click(object sender, EventArgs e) - { - // Mask out red and green - SetColorChannels(0x00, 0x00, 0xFF); - } - - private void bAllChannels_Click(object sender, EventArgs e) - { - if (Bitmap) - { - // Restore the bitmap using the original - ReplaceBitmap(bitmap); - } - } - - private void SetColorChannels(int redmask, int greenmask, int bluemask) - { - if (Bitmap) - { - // Create a temporary clone. - using (FreeImageBitmap bitmap = (FreeImageBitmap)this.bitmap.Clone()) - { - if (bitmap != null) - { - // Check whether the bitmap has a palette - if (bitmap.HasPalette) - { - // Use the Palette class to handle the bitmap's - // palette. A palette always consist of RGBQUADs. - Palette palette = bitmap.Palette; - // Apply the new values for all three color components. - for (int i = 0; i < palette.Length; i++) - { - RGBQUAD rgbq = palette[i]; - - rgbq.rgbRed = (byte)(rgbq.rgbRed & redmask); - rgbq.rgbGreen = (byte)(rgbq.rgbGreen & greenmask); - rgbq.rgbBlue = (byte)(rgbq.rgbBlue & bluemask); - - palette[i] = rgbq; - } - } - // In case the bitmap has no palette it must have a color depth - // of 16, 24 or 32. Each color depth needs a different wrapping - // structure for the bitmaps data. These structures can be accessed - // by using the foreach clause. - else if (bitmap.ColorDepth == 16) - { - // Iterate over each scanline - // For 16bpp use either Scanline or Scanline - if (bitmap.IsRGB555) - { - foreach (Scanline scanline in bitmap) - { - for (int x = 0; x < scanline.Length; x++) - { - FI16RGB555 pixel = scanline[x]; - pixel.Red = (byte)(pixel.Red & redmask); - pixel.Green = (byte)(pixel.Green & greenmask); - pixel.Blue = (byte)(pixel.Blue & bluemask); - scanline[x] = pixel; - } - } - } - else if (bitmap.IsRGB565) - { - foreach (Scanline scanline in bitmap) - { - for (int x = 0; x < scanline.Length; x++) - { - FI16RGB565 pixel = scanline[x]; - pixel.Red = (byte)(pixel.Red & redmask); - pixel.Green = (byte)(pixel.Green & greenmask); - pixel.Blue = (byte)(pixel.Blue & bluemask); - scanline[x] = pixel; - } - } - } - } - else if (bitmap.ColorDepth == 24) - { - // Iterate over each scanline - // For 24bpp Scanline must be used - foreach (Scanline scanline in bitmap) - { - for (int x = 0; x < scanline.Length; x++) - { - RGBTRIPLE pixel = scanline[x]; - pixel.rgbtRed = (byte)(pixel.rgbtRed & redmask); - pixel.rgbtGreen = (byte)(pixel.rgbtGreen & greenmask); - pixel.rgbtBlue = (byte)(pixel.rgbtBlue & bluemask); - scanline[x] = pixel; - } - } - } - else if (bitmap.ColorDepth == 32) - { - // Iterate over each scanline - // For 32bpp Scanline must be used - foreach (Scanline scanline in bitmap) - { - for (int x = 0; x < scanline.Length; x++) - { - RGBQUAD pixel = scanline[x]; - pixel.rgbRed = (byte)(pixel.rgbRed & redmask); - pixel.rgbGreen = (byte)(pixel.rgbGreen & greenmask); - pixel.rgbBlue = (byte)(pixel.rgbBlue & bluemask); - scanline[x] = pixel; - } - } - } - // Dispose only the picturebox's bitmap - if (pictureBox.Image != null) - { - pictureBox.Image.Dispose(); - } - pictureBox.Image = (Bitmap)bitmap; - } - } - } - } - - private void vRotate_Scroll(object sender, EventArgs e) - { - TrackBar bar = sender as TrackBar; - if (bar != null) - { - lRotate.Text = bar.Value.ToString(); - } - } - - private void nShowMetadata_Click(object sender, EventArgs e) - { - if (Bitmap) - { - MetaDataFrame mFrame = new MetaDataFrame(); - mFrame.Tag = bitmap.Metadata; - mFrame.ShowDialog(this); - } - } - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.resx b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.resx deleted file mode 100644 index 836dd69..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MainForm.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 84, 17 - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.Designer.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.Designer.cs deleted file mode 100644 index 15077c9..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace Sample11 -{ - partial class MetaDataFrame - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.tvMetadata = new System.Windows.Forms.TreeView(); - this.SuspendLayout(); - // - // tvMetadata - // - this.tvMetadata.Location = new System.Drawing.Point(12, 12); - this.tvMetadata.Name = "tvMetadata"; - this.tvMetadata.Size = new System.Drawing.Size(389, 318); - this.tvMetadata.TabIndex = 3; - // - // MetaDataFrame - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(417, 349); - this.Controls.Add(this.tvMetadata); - this.DoubleBuffered = true; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "MetaDataFrame"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; - this.Text = "Metadata"; - this.Load += new System.EventHandler(this.MetaDataFrame_Load); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TreeView tvMetadata; - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.cs deleted file mode 100644 index 57ba257..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.ComponentModel; -using System.Windows.Forms; -using FreeImageAPI; -using FreeImageAPI.Metadata; - -namespace Sample11 -{ - public partial class MetaDataFrame : Form - { - public MetaDataFrame() - { - InitializeComponent(); - } - - private void MetaDataFrame_Load(object sender, EventArgs e) - { - ImageMetadata iMetadata = this.Tag as ImageMetadata; - if (iMetadata != null) - { - bool backup = iMetadata.HideEmptyModels; - iMetadata.HideEmptyModels = false; - try - { - // Get each metadata model - foreach (MetadataModel metadataModel in iMetadata) - { - // Create a new node for each model - TreeNode modelNode = tvMetadata.Nodes.Add(metadataModel.ToString()); - - // Get each metadata tag and create a subnode for it - foreach (MetadataTag metadataTag in metadataModel) - { - modelNode.Nodes.Add(metadataTag.Key + ": " + metadataTag.ToString()); - } - } - } - // Display error message - catch (Exception ex) - { - while (ex.InnerException != null) - ex = ex.InnerException; - MessageBox.Show(ex.ToString(), "Exception caught"); - } - iMetadata.HideEmptyModels = backup; - } - } - } -} \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.resx b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.resx deleted file mode 100644 index 19dc0dd..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Properties/AssemblyInfo.cs b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Properties/AssemblyInfo.cs deleted file mode 100644 index 645371f..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: ComVisible(false)] -[assembly: Guid("219019e1-9a57-46c7-b9d7-3928a9277fd6")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Sample 11 - Using the FreeImageBitmap class.csproj b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Sample 11 - Using the FreeImageBitmap class.csproj deleted file mode 100644 index 8946cc8..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Samples/Sample 11 - Using the FreeImageBitmap class/Sample 11 - Using the FreeImageBitmap class.csproj +++ /dev/null @@ -1,113 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - 2.0 - {996068CD-D07A-42E0-856F-ACC71E8565EF} - WinExe - Properties - Sample11 - Sample11 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - none - 4 - 512 - false - - - none - true - bin\Release\ - TRACE - none - 4 - 512 - - - true - bin\Debug\ - DEBUG;TRACE - 512 - full - x86 - false - none - - - bin\Release\ - TRACE - true - 512 - - - x86 - none - - - true - bin\Debug\ - DEBUG;TRACE - 512 - full - x64 - false - none - - - bin\Release\ - TRACE - true - 512 - - - x64 - none - - - - False - ..\..\Bin\FreeImageNET.dll - - - - - - - - Form - - - MainForm.cs - - - Form - - - MetaDataFrame.cs - - - - Designer - MainForm.cs - - - Designer - MetaDataFrame.cs - - - - - \ No newline at end of file diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Whats_New.NET.txt b/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Whats_New.NET.txt deleted file mode 100644 index 2db5103..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImage.NET/cs/Whats_New.NET.txt +++ /dev/null @@ -1,114 +0,0 @@ -What's New for FreeImage.NET - -* : fixed -- : removed -! : changed -+ : added - -December 21, 2009 - 3.13.1.1 -* [Carsten Klein] Fixed a threading bug in OpenMultiBitmapFromStream and CloseMultiBitmap. Access to the streamHandles Dictionary is now thread safe. - -September 15, 2009 - 3.13.0.1 -+ [Jean-Philippe Goerke] Added PFM, PICT and RAW file formats. -+ [Jean-Philippe Goerke] Added loading flag JPEG_EXIFROTATE. -+ [Jean-Philippe Goerke] Added method GetNativeVersion() to the FreeImage class. -! [Jean-Philippe Goerke] Changed FreeImage.IsAvailable() now returning false in case the native library is out of date or unusable. -- [Jean-Philippe Goerke] Removed FREEIMAGE_MAJOR_VERSION, FREEIMAGE_MINOR_VERSION and FREEIMAGE_RELEASE_SERIAL constants from class FreeImage. -+ [Jean-Philippe Goerke] Added enumeration FREE_IMAGE_COLOR_OPTIONS. -+ [Jean-Philippe Goerke] Added new overloads for FreeImage.Allocate() and FreeImage.AllocateT(). -+ [Jean-Philippe Goerke] Added methods AllocateEx(), AllocateExT(), FillBackground() and EnlargeCanvas() to class FreeImage. -+ [Jean-Philippe Goerke] Added methods FillBackground(), EnlargeCanvas() and GetEnlargedInstance() to class FreeImageBitmap. -- [Jean-Philippe Goerke] Removed unused ConvertLineXtoY() methods. -* [kruno13] Fixed a bug in the FreeImageBitmap constructors. -- [Jean-Philippe Goerke] Removed unneeded GCHandles used with delegates. -+ [Jean-Philippe Goerke] Added overloaded method OpenMultiBitmapFromStream to class FreeImage. -+ [Jean-Philippe Goerke] FreeImageBitmap now supports loading multipage bitmaps from streams. Warning: The stream must remain open for the bitmap's lifetime. -* [mshanke] Fixed some IPTC metadata incorrect namings. -! [Jean-Philippe Goerke] Method FreeImage.RotateClassic is now deprecated. -+ [Jean-Philippe Goerke] Added method Rotate() to the FreeImage class. -! [Jean-Philippe Goerke] FreeImageBitmap now uses the method Rotate instead of RotateClassic. - -April 20, 2009 - 1.10 -! [Jean-Philippe Goerke] Updated wrapper-version to 1.10 including some minor changes. - -February 27, 2009 - 1.09 -+ [Jean-Philippe Goerke] Help file creation now uses the Version Builder plugin of Sandcastle Help File Builder to generate an MSDN-like Version Information paragraph in the help file. -+ [Jean-Philippe Goerke] Added new metadata model class MDM_EXIF_MAIN to replace MDM_MAIN. Class MDM_MAIN still exists but is marked obsolete and will be removed in a future release. -+ [Jean-Philippe Goerke] Added various properties to access the value of metadata tags directly to all MDM_* classes expect MDM_CUSTOM, MDM_NODATA and MDM_MAKERNOTE. -! [Jean-Philippe Goerke] Now classes deriving from MetadataModel, expect obsoltete class MDM_MAIN, are no longer sealed. -! [Jean-Philippe Goerke] Class GifInformation now derives from MDM_ANIMATION. Moved properties into base class MDM_ANIMATION. -+ [Jean-Philippe Goerke] Added enumerations AltitudeType, DirectionReference, InteroperabilityMode, LatitudeType, LongitudeType, ImageOrientation and VelocityUnit to class MetadataModel. -* [Jean-Philippe Goerke] Fixed a bug in MetadataTag.Count, MetadataTag.Length and MetadataTag.Value. -+ [Jean-Philippe Goerke] Added attribute DebuggerBrowsable(DebuggerBrowsableState.Never) to some protected and private fields. - -February 23, 2009 - 1.08 -! [Jean-Philippe Goerke] FreeImage.NET now uses Sandcastle Help File Builder 1.8.0.1 -+ [Jean-Philippe Goerke] Added new Sandcastle Help File Builder project file FreeImage.NET.shfbproj. -* [headkaze] Fixed a bug in FreeImage.CreateFromBitmap, which now incorporates any transparency information from palletized .NET Bitmaps. -+ [Jean-Philippe Goerke] Added new overloaded method CreateGlobalPalette() to class GifInformation to create global palettes from local palettes. -! [Jean-Philippe Goerke] Renamed internal method FreeImage.SetTransparencyTable_ to FreeImage.SetTransparencyTable. -+ [Jean-Philippe Goerke] Added attribute DebuggerBrowsable(DebuggerBrowsableState.Never) to many protected and private fields. - -February 20, 2009 - 1.07 -* [Jean-Philippe Goerke] Fixed a bug in FreeImage.IsFilenameValidForFIF and FreeImage.IsExtensionValidForFIF. -* [Jean-Philippe Goerke] Fixed a bug in FreeImage.SaveEx that could prevent saving supported non-bitmap types. -* [Jean-Philippe Goerke] Fixed a small bug in FreeImage.CompareData. -+ [Jean-Philippe Goerke] Added two overloads of ColorQuantizeEx() in class FreeImage to return images with a color depth smaller than 8. -! [Jean-Philippe Goerke] Updated FreeImage.ConvertColorDepth to support 1- and 4-bpp color conversions (FreeImage_ConvertTo4Bits only creates grayscale results). -* [headkaze] Fixed a bug in FreeImage.GetBitmap, which now adds any transparency information to palletized .NET Bitmaps. -* [headkaze] Fixed a bug in FreeImage.GetBitmap and FreeImage.CreateFromBitmap to support palettes with sizes different from 2, 16 and 256 entries. -! [Jean-Philippe Goerke] Improved handling of multipage bitmaps in FreeImageBitmap class. -+ [Jean-Philippe Goerke] Added new overloads for FreeImageBitmap.SaveAdd() to allow inserting frames at a specified page index. -+ [Jean-Philippe Goerke] Added new class GifInformation which provides access to GIF format specific metadata (GlobalPalette, Animation, etc.). -+ [Jean-Philippe Goerke] Added enumeration DisposalMethodType. -! [Jean-Philippe Goerke] Updated class MemoryArray, which now is Disposable and has a new static constructor. -! [Jean-Philippe Goerke] Removed code using reflection from class ImageMetadata. -+ [Jean-Philippe Goerke] Added new ctor(FITAG) and ctor(MetadataTag) to class Palette to support palettes stored in metadata tags. -+ [Jean-Philippe Goerke] Added new ctor(RGBQUAD[]), ctor(Color[]) and ctor(int) to create new stand-alone palettes to class Palette. -+ [Jean-Philippe Goerke] Added overloaded CreateGrayscalePalette(), Reverse() and CopyFrom() to class Palette. -! [Jean-Philippe Goerke] Changed the behavior of MetadataTag.Value. byte and byte[] are now stored as FREE_IMAGE_MDTYPE.FIDT_BYTE instead of FREE_IMAGE_MDTYPE.FIDT_UNDEFINED. -+ [Jean-Philippe Goerke] Added a type check to MetadataTag.SetValue(object), MetadataTag.SetValue(object, FREE_IMAGE_MDTYPE) and the setter of MetadataTag.Value. - -November 18, 2008 - 1.06 -* [Jean-Philippe Goerke] Fixed a bug in FreeImage.SaveEx. -! [Jean-Philippe Goerke] Improved method FreeImage.IsFilenameValidForFIF. - -November 5, 2008 - 1.05 -! [Jean-Philippe Goerke] Updated documentation of FreeImage.ConvertFromRawBits and FreeImage.ConvertToRawBits. -+ [Jean-Philippe Goerke] Added new overload ConvertFromRawBits(byte[],int,int,int,uint,uint,uint,uint,bool) to the FreeImage class. -+ [Jean-Philippe Goerke] Added new overload ConvertFromRawBits(byte[],FREE_IMAGE_TYPE,int,int,int,uint,uint,uint,uint bool) to the FreeImage class. -+ [Jean-Philippe Goerke] Added new overload ConvertToRawBits(byte[],FIBITMAP,int,uint,uint,uint,uint,bool) to the FreeImage class. -! [Jean-Philippe Goerke] Improved method FreeImage.CreatePropertyItem. -+ [Jean-Philippe Goerke] Added overloads for CopyMemory to class FreeImage which support direct usage of arrays. -! [Jean-Philippe Goerke] Replaced calls to FreeImage.MoveMemory with FreeImage.CopyMemory. -! [Jean-Philippe Goerke] Class FreeImageBitmap now derives from MarshalByRefObject. -+ [Jean-Philippe Goerke] Added new ctor(int,int,int,PixelFormat,byte[]) and ctor(int,int,int,int,FREE_IMAGE_TYPE,byte[]) to the FreeImageBitmap class. - -August 29, 2008 - 1.04 -+ [Jean-Philippe Goerke] Added new target architectures x86 and x64 to the Visual Studio 2005 solution and project files. -+ [Jean-Philippe Goerke] Added static readonly field Zero to FIBITMAP, FIMEMORY, FIMETADATA, FIMULTIBITMAP and FITAG. -! [Jean-Philippe Goerke] Changed CreateFromBitmap to handle all formats contained by System.Drawing.Imaging.PixelFormat. -+ [Jean-Philippe Goerke] Added overload for ConvertFromRawBits to class FreeImage which supports creating images of any FREE_IMAGE_TYPE from raw bits. -+ [Jean-Philippe Goerke] Added method GetTypeParameters to class FreeImage. -! [Jean-Philippe Goerke] Both constructors FreeImageBitmap.ctor(int,int,PixelFormat) and FreeImageBitmap.ctor(int,int,int,PixelFormat,IntPtr) now work with all formats defined in PixelFormat. -+ [Jean-Philippe Goerke] Added new constructor FreeImageBitmap.ctor(int,int,int,int,FREE_IMAGE_TYPE,IntPtr) to FreeImageBitmap class. - -August 18, 2008 - 1.03 -* [Eric T. Wilson] Added GC.AddMemoryPressure and GC.RemoveMemoryPressure to FreeImageBitmap class. -+ [Eric T. Wilson] Added ToBitmap method to FreeImageBitmap class. -! [Eric T. Wilson] Changed implicit conversion operators to and from System.Drawing.Bitmap to explicit operators. -- [Eric T. Wilson] Removed Message event from FreeImage class. Use event FreeImageEngine.Message instead. -- [Eric T. Wilson] Removed contructors ctor(int) and ctor(IntPtr) from FIBITMAP, FIMULTIBITMAP, FIMEMORY, FIMETADATA and FITAG. -- [Eric T. Wilson] Removed implicit conversion operators from and to int and IntPtr from FIBITMAP, FIMULTIBITMAP, FIMEMORY, FIMETADATA and FITAG. -+ [Jean-Philippe Goerke] Added SetNull method to FIBITMAP, FIMULTIBITMAP, FIMEMORY, FIMETADATA and FITAG. -! [Jean-Philippe Goerke] Changed handling of multipage images in FreeImageBitmap: As with System.Drawing.Bitmap, any changes applied to an active frame are no longer written back to the multipage image loaded. -* [Jean-Philippe Goerke] Fixed a bug in FreeImage.SaveToStream(ref FIBITMAP, Stream, FREE_IMAGE_FORMAT, FREE_IMAGE_SAVE_FLAGS, FREE_IMAGE_COLOR_DEPTH, bool): changed catch block into a finally block. - -July 25, 2008 - 1.02 -+ [Jean-Philippe Goerke] Improved handling of XMP metadata in MetadataTag.cs: Key is now set to "XMLPacket" not changeable if Model is FREE_IMAGE_MDMODEL.FIMD_XMP. - -July 01, 2008 - 1.01 -+ [Jean-Philippe Goerke] Added methods Quantize and GetQuantizedInstance to the FreeImageBitmap class. - -November 12, 2007 - 1.00 -+ [Jean-Philippe Goerke] Initial release. diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2003.sln b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2003.sln deleted file mode 100644 index 4317117..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2003.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "FreeImagePlus.2003.vcproj", "{94F36908-A4E2-4533-939D-64FF6EADA5A1}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug.ActiveCfg = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug.Build.0 = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release.ActiveCfg = Release|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2003.vcproj b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2003.vcproj deleted file mode 100644 index 188ebb5..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2003.vcproj +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.sln b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.sln deleted file mode 100644 index c8ca720..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.sln +++ /dev/null @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "FreeImagePlus.2005.vcproj", "{94F36908-A4E2-4533-939D-64FF6EADA5A1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.ActiveCfg = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.Build.0 = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.ActiveCfg = Release|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.vcproj b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.vcproj deleted file mode 100644 index 2d65ea2..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2005.vcproj +++ /dev/null @@ -1,480 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.sln b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.sln deleted file mode 100644 index f4539a4..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.sln +++ /dev/null @@ -1,19 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeImagePlus", "FreeImagePlus.2008.vcproj", "{94F36908-A4E2-4533-939D-64FF6EADA5A1}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.ActiveCfg = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Debug|Win32.Build.0 = Debug|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.ActiveCfg = Release|Win32 - {94F36908-A4E2-4533-939D-64FF6EADA5A1}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.vcproj b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.vcproj deleted file mode 100644 index e95b307..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.2008.vcproj +++ /dev/null @@ -1,477 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.h b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.h deleted file mode 100644 index 7c1a157..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.h +++ /dev/null @@ -1,1639 +0,0 @@ -// ========================================================== -// FreeImagePlus 3 -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef FREEIMAGEPLUS_H -#define FREEIMAGEPLUS_H - -#ifdef _WIN32 -#include -#endif // _WIN32 -#include "FreeImage.h" - - -// Compiler options --------------------------------------------------------- - -#if defined(FREEIMAGE_LIB) - #define FIP_API - #define FIP_CALLCONV -#else - #if defined(_WIN32) || defined(__WIN32__) - #define WIN32_LEAN_AND_MEAN - #define FIP_CALLCONV __stdcall - // The following ifdef block is the standard way of creating macros which make exporting - // from a DLL simpler. All files within this DLL are compiled with the FIP_EXPORTS - // symbol defined on the command line. this symbol should not be defined on any project - // that uses this DLL. This way any other project whose source files include this file see - // FIP_API functions as being imported from a DLL, wheras this DLL sees symbols - // defined with this macro as being exported. - #ifdef FIP_EXPORTS - #define FIP_API __declspec(dllexport) - #else - #define FIP_API __declspec(dllimport) - #endif // FIP_EXPORTS - #else - // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility) - #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - #ifndef GCC_HASCLASSVISIBILITY - #define GCC_HASCLASSVISIBILITY - #endif - #endif - #define FIP_CALLCONV - #if defined(GCC_HASCLASSVISIBILITY) - #define FIP_API __attribute__ ((visibility("default"))) - #else - #define FIP_API - #endif - #endif // WIN32 / !WIN32 -#endif // FREEIMAGE_LIB - -/////////////////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------- - -/** Abstract base class for all objects used by the library. - @version FreeImage 3 - @author Herv Drolon -*/ - -class FIP_API fipObject -{ -public: - /// Destructor - virtual ~fipObject(){}; - - /**@name Information functions */ - //@{ - /// Returns TRUE if the object is allocated, FALSE otherwise - virtual BOOL isValid() const = 0; - //@} -}; - -// ---------------------------------------------------------- - -class fipMemoryIO; -class fipMultiPage; -class fipTag; - -/** A class used to manage all photo related images and all image types used by the library. - - fipImage encapsulates the FIBITMAP format. It relies on the FreeImage library, especially for - loading / saving images and for bit depth conversion. - @version FreeImage 3 - @author Herv Drolon -*/ - -class FIP_API fipImage : public fipObject -{ -protected: - /// DIB data - FIBITMAP *_dib; - /// Original (or last saved) fif format if available, FIF_UNKNOWN otherwise - FREE_IMAGE_FORMAT _fif; - /// TRUE whenever the display need to be refreshed - mutable BOOL _bHasChanged; - -public: - friend class fipMultiPage; - -public: - - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_AllocateT - */ - fipImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - /// Destructor - virtual ~fipImage(); - /** - Image allocator - @see FreeImage_AllocateT - */ - BOOL setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask = 0, unsigned green_mask = 0, unsigned blue_mask = 0); - /// Destroy image data - virtual void clear(); - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage(const fipImage& src); - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage& operator=(const fipImage& src); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FIBITMAP*() - */ - fipImage& operator=(FIBITMAP *dib); - - - /** - @brief Copy a sub part of the current image and returns it as a fipImage object. - - This method works with any bitmap type. - @param dst Output subimage - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Copy - */ - BOOL copySubImage(fipImage& dst, int left, int top, int right, int bottom) const; - - /** - @brief Alpha blend or combine a sub part image with the current image. - - The bit depth of dst bitmap must be greater than or equal to the bit depth of src. - Upper promotion of src is done internally. Supported bit depth equals to 4, 8, 16, 24 or 32. - @param src Source subimage - @param left Specifies the left position of the sub image. - @param top Specifies the top position of the sub image. - @param alpha Alpha blend factor. The source and destination images are alpha blended if - alpha = 0..255. If alpha > 255, then the source image is combined to the destination image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Paste - */ - BOOL pasteSubImage(fipImage& src, int left, int top, int alpha = 256); - - /** - @brief Crop a sub part of the current image and update it accordingly. - - This method works with any bitmap type. - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - */ - BOOL crop(int left, int top, int right, int bottom); - - //@} - - /** @name File type identification - */ - //@{ - /** - @brief Identifies an image from disk, given its file name - @param lpszPathName Path and file name of the image to identify. - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIF(const char* lpszPathName); - - /** - UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS) - @see FreeImage_GetFileTypeU, FreeImage_GetFIFFromFilenameU, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFU(const wchar_t* lpszPathName); - - /** - @brief Identifies an image using the specified FreeImageIO struct and fi_handle. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromHandle, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle); - - /** - @brief Identifies an image using the specified memory stream. - @param hmem FreeImage memory stream - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromMemory, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem); - - //@} - - - /** @name Loading & Saving - * Loading and saving is handled by the FreeImage library. - */ - //@{ - /** - @brief Loads an image from disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to load. - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Load, FreeImage documentation - */ - BOOL load(const char* lpszPathName, int flag = 0); - - /** - UNICODE version of load (this function only works under WIN32 and does nothing on other OS) - @see load - */ - BOOL loadU(const wchar_t* lpszPathName, int flag = 0); - - /** - @brief Loads an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromHandle, FreeImage documentation - */ - BOOL loadFromHandle(FreeImageIO *io, fi_handle handle, int flag = 0); - - /** - @brief Loads an image using the specified memory stream and an optional flag. - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromMemory, FreeImage documentation - */ - BOOL loadFromMemory(fipMemoryIO& memIO, int flag = 0); - - /** - @brief Saves an image to disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to save. - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Save, FreeImage documentation - */ - BOOL save(const char* lpszPathName, int flag = 0) const; - - /** - UNICODE version of save (this function only works under WIN32 and does nothing on other OS) - @see save - */ - BOOL saveU(const wchar_t* lpszPathName, int flag = 0) const; - - /** - @brief Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag = 0) const; - - /** - @brief Saves an image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0) const; - - //@} - - /** @name Information functions - * Accessors to the DIB BITMAPINFO structure. - */ - //@{ - - /** - Returns the data type of the image - @see FreeImage_GetImageType - */ - FREE_IMAGE_TYPE getImageType() const; - - /** - Returns the image width in pixels - @see FreeImage_GetWidth - */ - unsigned getWidth() const; - - /** - Returns the image height in pixels - @see FreeImage_GetHeight - */ - unsigned getHeight() const; - - /** - Returns the width of the bitmap in bytes rounded to the nearest DWORD. - @see FreeImage_GetPitch - */ - unsigned getScanWidth() const; - - /** - Returns a pointer to the FIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions.
- Sample use :
-
-	fipImage src, dst;
-	src.load("test.png");
-	dst = FreeImage_ConvertTo8Bits(src);
-	FreeImage_Save(FIF_TIFF, dst, "test.tif", 0);
-	
- @see operator=(FIBITMAP *dib) - */ - operator FIBITMAP*() { - return _dib; - } - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - - /** - Returns a pointer to the bitmap's BITMAPINFO header. - @see FreeImage_GetInfo - */ - BITMAPINFO* getInfo() const; - - /** - Returns a pointer to the bitmap's BITMAPINFOHEADER. - @see FreeImage_GetInfoHeader - */ - BITMAPINFOHEADER* getInfoHeader() const; - - /** - Returns the size of the bitmap in bytes. - The size of the bitmap is the BITMAPINFOHEADER + the size of the palette + the size of the bitmap data. - @see FreeImage_GetDIBSize - */ - LONG getImageSize() const; - - /** - Returns the bitdepth of the bitmap.
- When the image type is FIT_BITMAP, valid bitdepth can be 1, 4, 8, 16, 24 or 32. - @see FreeImage_GetBPP, getImageType - */ - unsigned getBitsPerPixel() const; - - /** - Returns the width of the bitmap in bytes.
- This is not the size of the scanline. - @see FreeImage_GetLine, getScanWidth - */ - unsigned getLine() const; - - /** - Returns the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetDotsPerMeterX - */ - double getHorizontalResolution() const; - - /** - Returns the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetDotsPerMeterY - */ - double getVerticalResolution() const; - - /** - set the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setHorizontalResolution(double value); - - /** - set the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setVerticalResolution(double value); - - //@} - - /**@name Palette operations */ - //@{ - /** - Returns a pointer to the bitmap's palette. If the bitmap doesn't have a palette, getPalette returns NULL. - @see FreeImage_GetPalette - */ - RGBQUAD* getPalette() const; - - /** - Returns the palette size in bytes. - @see FreeImage_GetColorsUsed - */ - unsigned getPaletteSize() const; - - /** - Retrieves the number of colours used in the bitmap. If the bitmap is non-palletised, 0 is returned. - @see FreeImage_GetColorsUsed - */ - unsigned getColorsUsed() const; - - /** - Investigates the colour type of the bitmap. - @see FreeImage_GetColorType, FREE_IMAGE_COLOR_TYPE - */ - FREE_IMAGE_COLOR_TYPE getColorType() const; - - /** - Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise - @see FreeImage_GetBPP, FreeImage_GetColorType - */ - BOOL isGrayscale() const; - //@} - - /**@name Pixel access */ - //@{ - - /** @brief Returns a pointer to the bitmap bits. - - It is up to you to interpret these bytes correctly, - according to the results of FreeImage_GetBPP and - GetRedMask, FreeImage_GetGreenMask and FreeImage_GetBlueMask.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetBits - */ - BYTE* accessPixels() const; - - /** @brief Returns a pointer to the start of the given scanline in the bitmaps data-bits. - This pointer can be cast according to the result returned by getImageType.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetScanLine, FreeImage documentation - */ - BYTE* getScanLine(unsigned scanline) const; - - /** - Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index (returned value) - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_GetPixelIndex - */ - BOOL getPixelIndex(unsigned x, unsigned y, BYTE *value) const; - - /** - Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color (returned value) - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_GetPixelColor - */ - BOOL getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const; - - /** - Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_SetPixelIndex - */ - BOOL setPixelIndex(unsigned x, unsigned y, BYTE *value); - - /** - Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_SetPixelColor - */ - BOOL setPixelColor(unsigned x, unsigned y, RGBQUAD *value); - - //@} - - /** @name Conversion routines - * Bitmaps are always loaded in their default bit depth. If you want the bitmap to be stored in another bit depth, the class provides several conversion functions. - */ - //@{ - /** - Converts an image to a type supported by FreeImage. - @param image_type New image type - @param scale_linear TRUE if image pixels must be scaled linearly when converting to a standard bitmap - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertToType, FreeImage_ConvertToStandardType - */ - BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear = TRUE); - - /** - Converts the bitmap to 1 bit using a threshold T. - @param T Threshold value in [0..255] - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_Threshold - */ - BOOL threshold(BYTE T); - - /** - Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm. - @param algorithm Dithering algorithm to use. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_Dither, FREE_IMAGE_DITHER - */ - BOOL dither(FREE_IMAGE_DITHER algorithm); - - /** - Converts the bitmap to 4 bits. Unless the bitmap is a 1-bit palettized bitmap, colour values are converted to greyscale. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo4Bits - */ - BOOL convertTo4Bits(); - - /** - Converts the bitmap to 8 bits. If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo8Bits - */ - BOOL convertTo8Bits(); - - /** - Converts the bitmap to 8 bits.
- For palletized bitmaps, the color map is converted to a greyscale ramp. - @see FreeImage_ConvertToGreyscale - @return Returns TRUE if successfull, FALSE otherwise. - */ - BOOL convertToGrayscale(); - - /** - Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
- The quantize parameter specifies which colour reduction algorithm should be used. - @param algorithm Color quantization algorithm to use. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ColorQuantize, FREE_IMAGE_QUANTIZE - */ - BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 5 bits green, 5 bits blue and 1 unused bit. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo16Bits555 - */ - BOOL convertTo16Bits555(); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits blue. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo16Bits565 - */ - BOOL convertTo16Bits565(); - - /** - Converts the bitmap to 24 bits. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo24Bits - */ - BOOL convertTo24Bits(); - - /** - Converts the bitmap to 32 bits. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo32Bits - */ - BOOL convertTo32Bits(); - - /** - Converts the bitmap to a 96-bit RGBF image. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertToRGBF - */ - BOOL convertToRGBF(); - - /** - Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter (algorithm dependant) - @param second_param Second tone mapping algorithm parameter (algorithm dependant) - @param third_param Third tone mapping algorithm parameter (algorithm dependant) - @param fourth_param Fourth tone mapping algorithm parameter (algorithm dependant) - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ToneMapping, FreeImage_TmoReinhard05Ex - */ - BOOL toneMapping(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - //@} - - /** @name Transparency support: background colour and alpha channel */ - //@{ - - /** - Returns TRUE if the image is transparent, returns FALSE otherwise - @see FreeImage_IsTransparent - */ - BOOL isTransparent() const; - - /** - 8-bit transparency : get the number of transparent colors. - @return Returns the number of transparent colors in a palletised bitmap. - @see FreeImage_GetTransparencyCount - */ - unsigned getTransparencyCount() const; - - /** - 8-bit transparency : get the bitmaps transparency table. - @return Returns a pointer to the bitmaps transparency table. - @see FreeImage_GetTransparencyTable - */ - BYTE* getTransparencyTable() const; - - /** - 8-bit transparency : set the bitmaps transparency table. - @see FreeImage_SetTransparencyTable - */ - void setTransparencyTable(BYTE *table, int count); - - /** - Returns TRUE when the image has a file background color, FALSE otherwise. - @see FreeImage_HasBackgroundColor - */ - BOOL hasFileBkColor() const; - - /** - @brief Retrieves the file background color of an image. - - For 8-bit images, the color index - in the palette is returned in the rgbReserved member of the bkcolor parameter. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetBackgroundColor - */ - BOOL getFileBkColor(RGBQUAD *bkcolor) const; - - /** - @brief Set the file background color of an image. - - When saving an image to PNG, this background color is transparently saved to the PNG file. - When the bkcolor parameter is NULL, the background color is removed from the image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetBackgroundColor - */ - BOOL setFileBkColor(RGBQUAD *bkcolor); - //@} - - /**@name Channel processing support */ - //@{ - /** @brief Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] image. - @param image Output image to be extracted - @param channel Color channel to extract - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const; - - /** - @brief Insert a 8-bit dib into a 24- or 32-bit image. - @param image Input 8-bit image to insert - @param channel Color channel to replace - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Split a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels. - @param RedChannel Output red channel. - @param GreenChannel Output green channel. - @param BlueChannel Output blue channel. - @return Returns FALSE if the dib isn't a valid image, if it's not a 24-bit image or if - one of the output channel can't be allocated. Returns TRUE otherwise. - @see FreeImage_GetChannel - */ - BOOL splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel); - - /** @brief Builds a 24-bit RGB image given its red, green and blue channel. - @param red Input red channel. - @param green Input green channel. - @param blue Input blue channel. - @return Returns FALSE if the dib can't be allocated, if the input channels are not 8-bit images. Returns TRUE otherwise. - @see FreeImage_SetChannel - */ - BOOL combineChannels(fipImage& red, fipImage& green, fipImage& blue); - //@} - - /**@name Rotation and flipping */ - //@{ - /** - Image translation and rotation using B-Splines. - @param angle Image rotation angle, in degree - @param x_shift Image horizontal shift - @param y_shift Image vertical shift - @param x_origin Origin of the x-axis - @param y_origin Origin of the y-axis - @param use_mask Whether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE - @return Returns the translated & rotated dib if successful, returns NULL otherwise - @see FreeImage_RotateEx - */ - BOOL rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); - - /** - Image rotation by means of three shears. - @param angle Image rotation angle, in degree - @param bkcolor Background color (image type dependent), default to black background - @return Returns rotated dib if successful, returns NULL otherwise - @see FreeImage_Rotate - */ - BOOL rotate(double angle, const void *bkcolor = NULL); - - /** - Flip the image horizontally along the vertical axis - @see FreeImage_FlipHorizontal - */ - BOOL flipHorizontal(); - - /** - Flip the image vertically along the horizontal axis - @see FreeImage_FlipVertical - */ - BOOL flipVertical(); - //@} - - /**@name Color manipulation routines */ - //@{ - /** - Inverts each pixel data. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Invert - */ - BOOL invert(); - - /** @brief Perfoms an histogram transformation on a 8, 24 or 32-bit image - according to the values of a lookup table (LUT). - - The transformation is done as follows.
- Image 8-bit : if the image has a color palette, the LUT is applied to this palette, - otherwise, it is applied to the grey values.
- Image 24-bit & 32-bit : if channel == IPL_CC_RGB, the same LUT is applied to each color - plane (R,G, and B). Otherwise, the LUT is applied to the specified channel only. - @param LUT Lookup table. The size of 'LUT' is assumed to be 256. - @param channel The color channel to be processed (only used with 24 & 32-bit DIB). - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustCurve, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Performs gamma correction on a 8, 24 or 32-bit image. - @param gamma Gamma value to use. A value of 1.0 leaves the image alone, - less than one darkens it, and greater than one lightens it. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustGamma, adjustCurve - */ - BOOL adjustGamma(double gamma); - - /** @brief Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will make the image darker - and greater than 0 will make the image brighter. - @return Returns TRUE if the operation was succesful, FALSE otherwise - @see FreeImage_AdjustBrightness, adjustCurve - */ - BOOL adjustBrightness(double percentage); - - /** @brief Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_AdjustContrast, adjustCurve - */ - BOOL adjustContrast(double percentage); - - /** - Adjusts an image's brightness, contrast and gamma within a single operation. - If more than one of these image display properties need to be adjusted, - using this function should be preferred over calling each adjustment function separately. - That's particularly true for huge images or if performance is an issue. - @see adjustBrightness - @see adjustContrast - @see adjustGamma - @see FreeImage_AdjustColors - */ - BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma); - - /** @brief Computes image histogram - - For 24-bit and 32-bit images, histogram can be computed from red, green, blue and - black channels. For 8-bit images, histogram is computed from the black channel. Other - bit depth is not supported. - @param histo pointer to an histogram array. Size of this array is assumed to be 256. - @param channel Color channel to use - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetHistogram - */ - BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel = FICC_BLACK) const; - //@} - - /**@name Upsampling / downsampling */ - //@{ - - /** @brief Rescale the image to a new width / height. - - @param new_width New image width - @param new_height New image height - @param filter The filter parameter specifies which resampling filter should be used. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_Rescale, FREE_IMAGE_FILTER - */ - BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter); - - /** @brief Creates a thumbnail image keeping aspect ratio - - @param max_size Maximum width or height in pixel units - @param convert When set to TRUE, converts the image to a standard type - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_MakeThumbnail - */ - BOOL makeThumbnail(unsigned max_size, BOOL convert = TRUE); - //@} - - /**@name Image status */ - //@{ - /** - Set the image status as 'modified'.
- When using the fipWinImage class, the image status is used to refresh the display. - It is changed to FALSE whenever the display has just been refreshed. - @param bStatus TRUE if the image should be marked as modified, FALSE otherwise - @see isModified - */ - void setModified(BOOL bStatus = TRUE) { - _bHasChanged = bStatus; - } - - /** - Get the image status - @return Returns TRUE if the image is marked as modified, FALSE otherwise - @see setModified - */ - BOOL isModified() { - return _bHasChanged; - } - //@} - - /**@name Metadata */ - //@{ - /** - Returns the number of tags contained in the model metadata model - attached to the dib - @param model Metadata model to look for - */ - unsigned getMetadataCount(FREE_IMAGE_MDMODEL model) const; - /** - Retrieve a metadata attached to the dib - @param model Metadata model to look for - @param key Metadata field name - @param tag Returned tag - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetMetadata - */ - BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const; - /** - Attach a new FreeImage tag to the dib.
- Sample use :
-
-	fipImage image;
-	// ...
-	fipTag tag;
-	tag.setKeyValue("Caption/Abstract", "my caption");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	tag.setKeyValue("Keywords", "FreeImage;Library;Images;Compression");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	
- - @param model Metadata model used to store the tag - @param key Tag field name - @param tag Tag to be attached - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_SetMetadata - */ - BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag); - //@} - - - protected: - /**@name Internal use */ - //@{ - BOOL replace(FIBITMAP *new_dib); - //@} - -}; - -// ---------------------------------------------------------- - -/** A class designed for MS Windows (TM) platforms. - - fipWinImage provides methods used to : -
    -
  • Display a DIB on the screen -
  • Copy / Paste a DIB to/from Windows devices (HANDLE, HBITMAP, Clipboard) -
  • Capture a window (HWND) and convert it to an image -
- @version FreeImage 3 - @author Herv Drolon -*/ -#ifdef _WIN32 - -class FIP_API fipWinImage : public fipImage -{ -public: - /**@name Creation & Destruction */ - //@{ - /// Constructor - fipWinImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - - /// Destructor - virtual ~fipWinImage(); - - /// Destroy image data - virtual void clear(); - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - //@} - - /**@name Copying */ - //@{ - - /** - Copy constructor. - Delete internal _display_dib data and copy the base class image data. - Tone mapping parameters are left unchanged. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipImage& src); - - /** - Copy constructor - Delete internal _display_dib data and copy tone mapping parameters. - Copy also the base class image data. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipWinImage& src); - - /** Clone function used for clipboard copy.
- Convert the FIBITMAP image to a DIB, - and transfer the DIB in a global bitmap handle.
- For non standard bitmaps, the BITMAPINFOHEADER->biCompression field is set to 0xFF + FreeImage_GetImageType(_dib), - in order to recognize the bitmap as non standard. - */ - HANDLE copyToHandle() const; - - /** Copy constructor used for clipboard paste.
- Converts a global object to a FIBITMAP. The clipboard format must be CF_DIB.
- When the BITMAPINFOHEADER->biCompression field is set to 0xFF + [one of the predefined FREE_IMAGE_TYPE], - the bitmap is recognized as non standard and correctly copied. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromHandle(HANDLE hMem); - - /** Copy constructor.
- Converts a HBITMAP object to a FIBITMAP. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromBitmap(HBITMAP hbmp); - //@} - - /**@name Clipboard operations */ - //@{ - /** - Clipboard copy. - @param hWndNewOwner Handle to the window to be associated with the open clipboard. - In MFC, you can use AfxGetApp()->m_pMainWnd->GetSafeHwnd(). - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyToClipboard(HWND hWndNewOwner) const; - - /** - Retrieves data from the clipboard. The clipboard format must be CF_DIB. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL pasteFromClipboard(); - //@} - - /**@name Screen capture */ - //@{ - /** Capture a window and convert it to an image - @param hWndApplicationWindow Handle to the application main window - @param hWndSelectedWindow Handle to the window to be captured - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow); - //@} - - - /**@name Painting operations */ - //@{ - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function composite - the foreground image against a checkerboard background image. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @see FreeImage_Composite - */ - void draw(HDC hDC, RECT& rcDest) const { - drawEx(hDC, rcDest, FALSE, NULL, NULL); - } - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function can composite - the foreground image against a checkerboard background image, against a single background color or - against a user background image.
- When the image is a High Dynamic Range image (48-bit or RGB float), this function will apply a - tone mapping operator before drawing the image.
- The original image (located in the fipImage class) will not be affected by any of the operations - that could be done in order to display it. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @param useFileBkg When set to TRUE, the function uses the file color background if there is one - @param appBkColor When a color is given, the function uses it as the background color - @param bg When a FIBITMAP is given, the function uses it as the background image - @see FreeImage_Composite - @see setToneMappingOperator - */ - void drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg = FALSE, RGBQUAD *appBkColor = NULL, FIBITMAP *bg = NULL) const; - - /** - Select a tone mapping algorithm used for drawing and set the image as modified - so that the display will be refreshed. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - /** - Get the tone mapping algorithm used for drawing, with its parameters. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const; - - //@} - -protected: - /// DIB used for display (this allow to display non-standard bitmaps) - mutable FIBITMAP *_display_dib; - /// remember to delete _display_dib - mutable BOOL _bDeleteMe; - /// tone mapping operator - FREE_IMAGE_TMO _tmo; - /// first tone mapping algorithm parameter - double _tmo_param_1; - /// second tone mapping algorithm parameter - double _tmo_param_2; - /// third tone mapping algorithm parameter - double _tmo_param_3; - /// fourth tone mapping algorithm parameter - double _tmo_param_4; -}; - -#endif // _WIN32 - -// ---------------------------------------------------------- - -/** Memory handle - - fipMemoryIO is a class that allows you to load / save images from / to a memory stream. - @version FreeImage 3 - @author Herv Drolon -*/ -class FIP_API fipMemoryIO : public fipObject -{ -protected: - /// Pointer to a memory stream - FIMEMORY *_hmem; - -public : - /** Constructor. - Wrap a memory buffer containing image data.
- The memory buffer is read only and has to be freed by the user - when no longer in use.
- When default arguments are used, open a memory file as read/write. - @param data Pointer to the memory buffer - @param size_in_bytes Buffer size in bytes - @see FreeImage_OpenMemory - */ - fipMemoryIO(BYTE *data = NULL, DWORD size_in_bytes = 0); - - /** Destructor. - Free any allocated memory - @see FreeImage_CloseMemory - */ - virtual ~fipMemoryIO(); - - /** Destructor. - Free any allocated memory and invalidate the stream - @see FreeImage_CloseMemory - */ - void close(); - - /** Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise - */ - BOOL isValid() const; - - /** Returns the buffer image format - @see FreeImage_GetFileTypeFromMemory - */ - FREE_IMAGE_FORMAT getFileType() const; - - /** - Returns a pointer to the FIMEMORY data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMEMORY*() { - return _hmem; - } - - /**@name Memory IO routines */ - //@{ - /** - Loads a dib from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the image to be loaded. - @return Returns the loaded dib if successful, returns NULL otherwise - @see FreeImage_LoadFromMemory - */ - FIBITMAP* load(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Loads a multi-page bitmap from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the multi-page to be loaded. - @return Returns the loaded multi-page if successful, returns NULL otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - FIMULTIBITMAP* loadMultiPage(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Saves a dib to a memory stream - @param fif Format identifier (FreeImage format) - @param dib Image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveToMemory - */ - BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags = 0); - /** - Saves a multi-page bitmap to a memory stream - @param fif Format identifier (FreeImage format) - @param bitmap Multi-page image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveMultiBitmapToMemory - */ - BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags = 0); - /** - Reads data from a memory stream - @param buffer Storage location for data - @param size Item size in bytes - @param count Maximum number of items to be read - @return Returns the number of full items actually read, which may be less than count if an error occurs - @see FreeImage_ReadMemory - */ - unsigned read(void *buffer, unsigned size, unsigned count) const; - /** - Writes data to a memory stream - @param buffer Pointer to data to be written - @param size Item size in bytes - @param count Maximum number of items to be written - @return Returns the number of full items actually written, which may be less than count if an error occurs - @see FreeImage_WriteMemory - */ - unsigned write(const void *buffer, unsigned size, unsigned count); - /** - Gets the current position of a memory pointer - @see FreeImage_TellMemory - */ - long tell() const; - /** - Moves the memory pointer to a specified location - @see FreeImage_SeekMemory - */ - BOOL seek(long offset, int origin); - /** - Provides a direct buffer access to a memory stream - @param data Pointer to the memory buffer (returned value) - @param size_in_bytes Buffer size in bytes (returned value) - @see FreeImage_AcquireMemory - */ - BOOL acquire(BYTE **data, DWORD *size_in_bytes); - //@} - -private: - /// Disable copy - fipMemoryIO(const fipMemoryIO& src); - /// Disable copy - fipMemoryIO& operator=(const fipMemoryIO& src); - -}; - -// ---------------------------------------------------------- - -/** Multi-page file stream - - fipMultiPage encapsulates the multi-page API. It supports reading/writing - multi-page TIFF, ICO and GIF files. -*/ -class FIP_API fipMultiPage : public fipObject -{ -protected: - /// Pointer to a multi-page file stream - FIMULTIBITMAP *_mpage; - /// TRUE when using a memory cache, FALSE otherwise - BOOL _bMemoryCache; - -public: - /** - Constructor - @param keep_cache_in_memory When it is TRUE, all gathered bitmap data in the page manipulation process is kept in memory, otherwise it is lazily flushed to a temporary file on the hard disk in 64 Kb blocks. - */ - fipMultiPage(BOOL keep_cache_in_memory = FALSE); - - /** - Destructor - Close the file stream if not already done. - */ - virtual ~fipMultiPage(); - - /// Returns TRUE if the multi-page stream is opened - BOOL isValid() const; - - /** - Returns a pointer to the FIMULTIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMULTIBITMAP*() { - return _mpage; - } - - /** - Open a multi-page file stream - @param lpszPathName Name of the multi-page bitmap file - @param create_new When TRUE, it means that a new bitmap will be created rather than an existing one being opened - @param read_only When TRUE the bitmap is opened read-only - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_OpenMultiBitmap - */ - BOOL open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags = 0); - - /** - Open a multi-page memory stream as read/write. - @param memIO Memory stream. The memory stream MUST BE a wrapped user buffer. - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - BOOL open(fipMemoryIO& memIO, int flags = 0); - - /** - Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_OpenMultiBitmapFromHandle - */ - BOOL open(FreeImageIO *io, fi_handle handle, int flags = 0); - - /** - Close a file stream - @param flags Save flags. The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CloseMultiBitmap - */ - BOOL close(int flags = 0); - - /** - Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the multi-page image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags = 0) const; - - /** - Saves a multi-page image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags = 0) const; - - /** - Returns the number of pages currently available in the multi-paged bitmap - @see FreeImage_GetPageCount - */ - int getPageCount() const; - - /** - Appends a new page to the end of the bitmap - @param image Image to append - @see FreeImage_AppendPage - */ - void appendPage(fipImage& image); - - /** - Inserts a new page before the given position in the bitmap - @param page Page number. Page has to be a number smaller than the current number of pages available in the bitmap. - @param image Image to insert - @see FreeImage_InsertPage - */ - void insertPage(int page, fipImage& image); - - /** - Deletes the page on the given position - @param page Page number - @see FreeImage_DeletePage - */ - void deletePage(int page); - - /** - Moves the source page to the position of the target page. - @param target Target page position - @param source Source page position - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_MovePage - */ - BOOL movePage(int target, int source); - - /** - Locks a page in memory for editing. You must call unlockPage to free the page
- Usage :
-
-	fipMultiPage mpage;
-	// ...
-	fipImage image;		// You must declare this before
-	image = mpage.lockPage(2);
-	if(image.isValid()) {
-	  // ...
-	  mpage.unlockPage(image, TRUE);
-	}
-	
- @param page Page number - @return Returns the page if successful, returns NULL otherwise - @see FreeImage_LockPage - */ - FIBITMAP* lockPage(int page); - - /** - Unlocks a previously locked page and gives it back to the multi-page engine - @param image Page to unlock - @param changed When TRUE, the page is marked changed and the new page data is applied in the multi-page bitmap. - @see FreeImage_UnlockPage - */ - void unlockPage(fipImage& image, BOOL changed); - - /** - Returns an array of page-numbers that are currently locked in memory. - When the pages parameter is NULL, the size of the array is returned in the count variable. - You can then allocate the array of the desired size and call - getLockedPageNumbers again to populate the array. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_GetLockedPageNumbers - */ - BOOL getLockedPageNumbers(int *pages, int *count) const; -}; - -// ---------------------------------------------------------- - -/** -FreeImage Tag - -FreeImage uses this structure to store metadata information. -*/ -class FIP_API fipTag : public fipObject -{ -protected: - /// Pointer to a FreeImage tag - FITAG *_tag; - -public: - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_CreateTag - */ - fipTag(); - /** - Destructor - @see FreeImage_DeleteTag - */ - virtual ~fipTag(); - /** - Construct a FIDT_ASCII tag (ASCII string).
- This method is useful to store comments or IPTC tags. - @param name Field name - @param value Field value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CreateTag - */ - BOOL setKeyValue(const char *key, const char *value); - - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag(const fipTag& tag); - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag& operator=(const fipTag& tag); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FITAG*() - */ - fipTag& operator=(FITAG *tag); - //@} - - /** - Returns a pointer to the FITAG data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - @see operator=(FITAG *tag) - */ - operator FITAG*() { - return _tag; - } - - /// Returns TRUE if the tag is allocated, FALSE otherwise - BOOL isValid() const; - - /**@name Tag accessors */ - //@{ - /** - Returns the tag field name (unique inside a metadata model). - @see FreeImage_GetTagKey - */ - const char *getKey() const; - /** - Returns the tag description if available, returns NULL otherwise - @see FreeImage_GetTagDescription - */ - const char *getDescription() const; - /** - Returns the tag ID if available, returns 0 otherwise - @see FreeImage_GetTagID - */ - WORD getID() const; - /** - Returns the tag data type - @see FreeImage_GetTagType - */ - FREE_IMAGE_MDTYPE getType() const; - /** - Returns the number of components in the tag (in tag type units) - @see FreeImage_GetTagCount - */ - DWORD getCount() const; - /** - Returns the length of the tag value in bytes - @see FreeImage_GetTagLength - */ - DWORD getLength() const; - /** - Returns the tag value - @see FreeImage_GetTagValue - */ - const void *getValue() const; - /** - Set the tag field name - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagKey - */ - BOOL setKey(const char *key); - /** - Set the (usually optional) tag description - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagDescription - */ - BOOL setDescription(const char *description); - /** - Set the (usually optional) tad ID - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagID - */ - BOOL setID(WORD id); - /** - Set the tag data type - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagType - */ - BOOL setType(FREE_IMAGE_MDTYPE type); - /** - Set the number of data in the tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagCount - */ - BOOL setCount(DWORD count); - /** - Set the length of the tag value, in bytes - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagLength - */ - BOOL setLength(DWORD length); - /** - Set the tag value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagValue - */ - BOOL setValue(const void *value); - - //@} - - /** - Converts a FreeImage tag structure to a string that represents the interpreted tag value - @param model Metadata model specification (metadata model from which the tag was extracted) - @param Make Camera model (not used yet) - */ - const char* toString(FREE_IMAGE_MDMODEL model, char *Make = NULL) const; - -}; - -/** -Metadata iterator - -Usage :
-
-fipImage image;
-// ...
-fipTag tag;
-fipMetadataFind finder;
-if( finder.findFirstMetadata(FIMD_EXIF_MAIN, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-// the class can be called again with another metadata model
-if( finder.findFirstMetadata(FIMD_EXIF_EXIF, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-
-*/ -class FIP_API fipMetadataFind : public fipObject -{ -protected: - /// Pointer to a search handle - FIMETADATA *_mdhandle; - -public: - /// Returns TRUE if the search handle is allocated, FALSE otherwise - BOOL isValid() const; - - /// Constructor - fipMetadataFind(); - /** - Destructor - @see FreeImage_FindCloseMetadata - */ - virtual ~fipMetadataFind(); - /** - Provides information about the first instance of a tag that matches - the metadata model specified in the model argument. - @param model Metadata model - @param image Input image - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_FindFirstMetadata - */ - BOOL findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag); - /** - Find the next tag, if any, that matches the metadata model argument - in a previous call to findFirstMetadata - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise, indicating that no more matching tags could be found - @see FreeImage_FindNextMetadata - */ - BOOL findNextMetadata(fipTag& tag); - -}; - -#endif // FREEIMAGEPLUS_H diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.rc b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.rc deleted file mode 100644 index 1080092..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/FreeImagePlus.rc +++ /dev/null @@ -1,95 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 3,14,1,0 - PRODUCTVERSION 3,14,1,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e2" - BEGIN - VALUE "Comments", "FreeImage is an Open Source library project for developers who would like to support popular graphics image formats like PNG, BMP, JPEG, TIFF and others as needed by today's multimedia applications.\0" - VALUE "CompanyName", "FreeImage\0" - VALUE "FileDescription", "FreeImagePlus library\0" - VALUE "FileVersion", "3, 14, 1, 0\0" - VALUE "InternalName", "FreeImagePlus\0" - VALUE "LegalCopyright", "Copyright 2003-2010 by FreeImage\0" - VALUE "LegalTrademarks", "See http://freeimage.sourceforge.net\0" - VALUE "OriginalFilename", "FreeImagePlus.dll\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "FreeImagePlus\0" - VALUE "ProductVersion", "3, 14, 1, 0\0" - VALUE "SpecialBuild", "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1250 - END -END - -#endif // !_MAC - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/WhatsNew_FIP.txt b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/WhatsNew_FIP.txt deleted file mode 100644 index 72736ea..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/WhatsNew_FIP.txt +++ /dev/null @@ -1,163 +0,0 @@ -What's New for FreeImagePlus - -* : fixed -- : removed -! : changed -+ : added - -April 18th, 2010 -+ [Herve Drolon] added new multi-page functions - added fipMemoryIO:close - added fipMemoryIO:loadMultiPage - added fipMemoryIO:saveMultiPage - added fipMultiPage:FIMULTIBITMAP* - added fipMultiPage:open(FreeImageIO *io, fi_handle handle, int flags = 0) - added fipMultiPage:saveToHandle - added fipMultiPage:saveToMemory - -October 24th, 2009 -! [Herve Drolon] fixed the '65535' width/height/pitch size limitation (need recompilation as several prototypes changed) - -September 1rd, 2009 -! [Herve Drolon] changed prototypes for fipWinImage::setToneMappingOperator and fipWinImage::getToneMappingOperator -! [Herve Drolon] changed prototype for fipImage::toneMapping -! [Herve Drolon] changed prototype for fipImage::rotate (now support optional supplied background color) -+ [Herve Drolon] added FreeImage_TmoReinhard05Ex capability to fipImage & fipWinImage - -August 11th, 2009 -* [Mihail Naydenov] fixed fipImage::operator=(FIBITMAP *dib) for cases where dib == _dib - -July 10th, 2009 -+ [Herve Drolon] added fipImage::adjustBrightnessContrastGamma(double brightness, double contrast, double gamma) - -October 27th, 2008 -+ [Herve Drolon] added FIF static identification functions to fipImage - -August 3rd, 2008 -* [dimitriy.b] fixed warnings about "non virtual destructor with virtual class members" with gcc 4.1.2 -* [Herve Drolon] fixed display of RGBAF EXR images in fipWinImage::drawEx - -October 10th, 2007 -* [Terry Russell] fixed a memory leak in fipWinImage::captureWindow - -January 20th, 2007 -+ [Herve Drolon] added support for 64-bit RGBA images - -January 11th, 2007 -+ [Herve Drolon] added setKeyValue method (a ASCII tag constructor) to fipTag -+ [Herve Drolon] added PSD format support to fipMultiPage::open - -October 30th, 2006 - 3.9.2 -+ [Herve Drolon] added BOOL fipMultiPage::open(fipMemoryIO& memIO, int flags) -+ [Herve Drolon] added fipMemoryIO::operator FIMEMORY*() -* [Herve Drolon] fixed missing 'isValid' method in fipMetadataFind - -July 16th, 2006 - 3.9.1 -* [Herve Drolon] fixed a bug in fipWinImage::copyFromBitmap occuring with palettized images - -July 6th, 2006 - 3.9.0 -! [Herve Drolon] renamed fipMemoryIO::read to fipMemoryIO::load -! [Herve Drolon] renamed fipMemoryIO::write to fipMemoryIO::save -+ [Herve Drolon] added fipMemoryIO::read (wrapper for FreeImage_ReadMemory) -+ [Herve Drolon] added fipMemoryIO::write (wrapper for FreeImage_WriteMemory) -+ [Herve Drolon] added version info to the DLL -+ [Herve Drolon] added fipImage::crop -+ [Herve Drolon] added support for most image types to fipImage::rescale -+ [Herve Drolon] added fipImage::makeThumbnail -+ [Herve Drolon] added fipTag -+ [Herve Drolon] added fipMetadataFind -* [Sandor Szalacsi] improved fipWinWimage::drawEx behavior with non transparent PNG having a file background -* [Herve Drolon] fixed a bug in fipWinImage::setToneMappingOperator -* [Conrado PLG] added const keyword to fip methods -* [Conrado PLG] made the copy constructors of fipMemoryIO private - -September 5, 2005 - 3.8.0 -[Herve Drolon] -! fipImage::convertToGrayscale now uses FreeImage_ConvertToGreyscale -! fipWinImage::captureWindow now converts 32-bit images to 24-bit -+ added UNICODE function fipImage::loadU -+ added UNICODE function fipImage::saveU -+ added load flags to fipMultiPage::open -+ fipWinImage::copyTo/FromHandle now work with non-standard bitmap types -+ added copy constructors to fipWinImage -+ added fipImage::clear() and fipWinImage::clear() -* fixed a bug in fipWinWimage::drawEx with non transparent PNG having a file background -* fixed fipMultiPage not reading GIF files -* fixed a bug in fipImage::rescale whan handling FIT_UINT16 bitmaps - -May 3rd, 2005 -[Herve Drolon] -+ added accessors fipImage::setModified and fipImage::isModified -+ added fipImage::convertToRGBF -+ added fipImage::toneMapping -+ added tone mapping functions to fipWinImage (see get/setToneMappingOperator) -+ added tone mapping capabilities to fipWinImage::drawEx - -January 5th, 2005 -[Herve Drolon] -! changed the prototype of get/set Resolution functions - -December 19th, 2004 -[Herve Drolon] -! updated fipImage::rotate to handle 1-bit images - -November 18th, 2004 -[Herve Drolon] -+ added fipImage::convertTo4Bits - -August 18th, 2004 -[Herve Drolon] -- removed fipInternetIO -- removed copy constructor fipImage::fipImage(const FIBITMAP*) -- removed copy constructor fipWinImage::fipWinImage(const FIBITMAP*) -! fipMemoryIO rewritten. It now wraps the FreeImage memory stream API -! fipGenericImage is now called fipObject -+ added fipImage::loadFromMemory -+ added fipImage::saveToMemory -+ added fipMultiPage - -March, 17th, 2004 -[Herve Drolon] -! fipImage::setSize now accepts color masks -* fixed fipWinImage::copyFromHandle not working with DIB having color masks - -February 11th, 2004 -[Herve Drolon] -- removed fipImage::getRedChannel -- removed fipImage::getGreenChannel -- removed fipImage::getBlueChannel -- removed fipImage::getAlphaChannel -- removed fipImage::setAlphaChannel -+ added fipImage::setChannel -+ added fipImage::isTransparent -+ added fipImage::getTransparencyCount -+ added fipImage::getTransparencyTable -+ added fipImage::setTransparencyTable -+ added fipImage::hasFileBkColor -+ added fipImage::getFileBkColor -+ added fipImage::setFileBkColor -+ added fipWinImage::drawEx -! fipWinImage::draw now works with transparent images - -January 26th, 2004 -[Herve Drolon] -+ added fipMemoryIO -+ added fipInternetIO (WIN32 only) -+ added fipImage::getImageType -+ added fipImage::convertToType -+ added fipWinImage::copyToClipboard -+ added fipWinImage::pasteFromClipboard -+ added fipWinImage::captureWindow - -! changed fipImage constructor -! fipWinImage::copyFromHandle now returns a BOOL -! fipWinImage::copyFromBitmap now returns a BOOL - -November 2, 2003 -+ [Herve Drolon] added fipImage::getScanLine - -October 20, 2003 -* [Dennis Lim] fixed a bug in fipImage constructor -! [Herve Drolon] fixed a bug with fipImage::saveToHandle prototype - -September 8th 2003 - Wrapper for FreeImage 3.0.0 diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/clean.bat b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/clean.bat deleted file mode 100644 index 95e745f..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/clean.bat +++ /dev/null @@ -1,15 +0,0 @@ -rd Release /s /q -rd Debug /s /q -del dist\*.dll /s /q -del dist\*.lib /s /q -del dist\*.h /s /q -del *.ncb /s /q -del *.plg /s /q -del *.opt /s /q -del *.suo /s /q /a:h -rd test\Debug /s /q -del test\page*.tiff -del test\*.png -del test\mpage*.tif -del test\clone*.tif -del test\redirect-stream.tif diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/FreeImagePlus.dll b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/FreeImagePlus.dll deleted file mode 100644 index c8efc59..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/FreeImagePlus.dll and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/FreeImagePlus.h b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/FreeImagePlus.h deleted file mode 100644 index 7c1a157..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/FreeImagePlus.h +++ /dev/null @@ -1,1639 +0,0 @@ -// ========================================================== -// FreeImagePlus 3 -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef FREEIMAGEPLUS_H -#define FREEIMAGEPLUS_H - -#ifdef _WIN32 -#include -#endif // _WIN32 -#include "FreeImage.h" - - -// Compiler options --------------------------------------------------------- - -#if defined(FREEIMAGE_LIB) - #define FIP_API - #define FIP_CALLCONV -#else - #if defined(_WIN32) || defined(__WIN32__) - #define WIN32_LEAN_AND_MEAN - #define FIP_CALLCONV __stdcall - // The following ifdef block is the standard way of creating macros which make exporting - // from a DLL simpler. All files within this DLL are compiled with the FIP_EXPORTS - // symbol defined on the command line. this symbol should not be defined on any project - // that uses this DLL. This way any other project whose source files include this file see - // FIP_API functions as being imported from a DLL, wheras this DLL sees symbols - // defined with this macro as being exported. - #ifdef FIP_EXPORTS - #define FIP_API __declspec(dllexport) - #else - #define FIP_API __declspec(dllimport) - #endif // FIP_EXPORTS - #else - // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility) - #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) - #ifndef GCC_HASCLASSVISIBILITY - #define GCC_HASCLASSVISIBILITY - #endif - #endif - #define FIP_CALLCONV - #if defined(GCC_HASCLASSVISIBILITY) - #define FIP_API __attribute__ ((visibility("default"))) - #else - #define FIP_API - #endif - #endif // WIN32 / !WIN32 -#endif // FREEIMAGE_LIB - -/////////////////////////////////////////////////////////////////////////////////////////// - -// ---------------------------------------------------------- - -/** Abstract base class for all objects used by the library. - @version FreeImage 3 - @author Herv Drolon -*/ - -class FIP_API fipObject -{ -public: - /// Destructor - virtual ~fipObject(){}; - - /**@name Information functions */ - //@{ - /// Returns TRUE if the object is allocated, FALSE otherwise - virtual BOOL isValid() const = 0; - //@} -}; - -// ---------------------------------------------------------- - -class fipMemoryIO; -class fipMultiPage; -class fipTag; - -/** A class used to manage all photo related images and all image types used by the library. - - fipImage encapsulates the FIBITMAP format. It relies on the FreeImage library, especially for - loading / saving images and for bit depth conversion. - @version FreeImage 3 - @author Herv Drolon -*/ - -class FIP_API fipImage : public fipObject -{ -protected: - /// DIB data - FIBITMAP *_dib; - /// Original (or last saved) fif format if available, FIF_UNKNOWN otherwise - FREE_IMAGE_FORMAT _fif; - /// TRUE whenever the display need to be refreshed - mutable BOOL _bHasChanged; - -public: - friend class fipMultiPage; - -public: - - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_AllocateT - */ - fipImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - /// Destructor - virtual ~fipImage(); - /** - Image allocator - @see FreeImage_AllocateT - */ - BOOL setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask = 0, unsigned green_mask = 0, unsigned blue_mask = 0); - /// Destroy image data - virtual void clear(); - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage(const fipImage& src); - /** - Copy constructor - @see FreeImage_Clone - */ - fipImage& operator=(const fipImage& src); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FIBITMAP*() - */ - fipImage& operator=(FIBITMAP *dib); - - - /** - @brief Copy a sub part of the current image and returns it as a fipImage object. - - This method works with any bitmap type. - @param dst Output subimage - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Copy - */ - BOOL copySubImage(fipImage& dst, int left, int top, int right, int bottom) const; - - /** - @brief Alpha blend or combine a sub part image with the current image. - - The bit depth of dst bitmap must be greater than or equal to the bit depth of src. - Upper promotion of src is done internally. Supported bit depth equals to 4, 8, 16, 24 or 32. - @param src Source subimage - @param left Specifies the left position of the sub image. - @param top Specifies the top position of the sub image. - @param alpha Alpha blend factor. The source and destination images are alpha blended if - alpha = 0..255. If alpha > 255, then the source image is combined to the destination image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Paste - */ - BOOL pasteSubImage(fipImage& src, int left, int top, int alpha = 256); - - /** - @brief Crop a sub part of the current image and update it accordingly. - - This method works with any bitmap type. - @param left Specifies the left position of the cropped rectangle. - @param top Specifies the top position of the cropped rectangle. - @param right Specifies the right position of the cropped rectangle. - @param bottom Specifies the bottom position of the cropped rectangle. - @return Returns TRUE if successful, FALSE otherwise. - */ - BOOL crop(int left, int top, int right, int bottom); - - //@} - - /** @name File type identification - */ - //@{ - /** - @brief Identifies an image from disk, given its file name - @param lpszPathName Path and file name of the image to identify. - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIF(const char* lpszPathName); - - /** - UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS) - @see FreeImage_GetFileTypeU, FreeImage_GetFIFFromFilenameU, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFU(const wchar_t* lpszPathName); - - /** - @brief Identifies an image using the specified FreeImageIO struct and fi_handle. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromHandle, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle); - - /** - @brief Identifies an image using the specified memory stream. - @param hmem FreeImage memory stream - @return Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise. - @see FreeImage_GetFileTypeFromMemory, FreeImage documentation - */ - static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem); - - //@} - - - /** @name Loading & Saving - * Loading and saving is handled by the FreeImage library. - */ - //@{ - /** - @brief Loads an image from disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to load. - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Load, FreeImage documentation - */ - BOOL load(const char* lpszPathName, int flag = 0); - - /** - UNICODE version of load (this function only works under WIN32 and does nothing on other OS) - @see load - */ - BOOL loadU(const wchar_t* lpszPathName, int flag = 0); - - /** - @brief Loads an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromHandle, FreeImage documentation - */ - BOOL loadFromHandle(FreeImageIO *io, fi_handle handle, int flag = 0); - - /** - @brief Loads an image using the specified memory stream and an optional flag. - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_LoadFromMemory, FreeImage documentation - */ - BOOL loadFromMemory(fipMemoryIO& memIO, int flag = 0); - - /** - @brief Saves an image to disk, given its file name and an optional flag. - @param lpszPathName Path and file name of the image to save. - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Save, FreeImage documentation - */ - BOOL save(const char* lpszPathName, int flag = 0) const; - - /** - UNICODE version of save (this function only works under WIN32 and does nothing on other OS) - @see save - */ - BOOL saveU(const wchar_t* lpszPathName, int flag = 0) const; - - /** - @brief Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag = 0) const; - - /** - @brief Saves an image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0) const; - - //@} - - /** @name Information functions - * Accessors to the DIB BITMAPINFO structure. - */ - //@{ - - /** - Returns the data type of the image - @see FreeImage_GetImageType - */ - FREE_IMAGE_TYPE getImageType() const; - - /** - Returns the image width in pixels - @see FreeImage_GetWidth - */ - unsigned getWidth() const; - - /** - Returns the image height in pixels - @see FreeImage_GetHeight - */ - unsigned getHeight() const; - - /** - Returns the width of the bitmap in bytes rounded to the nearest DWORD. - @see FreeImage_GetPitch - */ - unsigned getScanWidth() const; - - /** - Returns a pointer to the FIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions.
- Sample use :
-
-	fipImage src, dst;
-	src.load("test.png");
-	dst = FreeImage_ConvertTo8Bits(src);
-	FreeImage_Save(FIF_TIFF, dst, "test.tif", 0);
-	
- @see operator=(FIBITMAP *dib) - */ - operator FIBITMAP*() { - return _dib; - } - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - - /** - Returns a pointer to the bitmap's BITMAPINFO header. - @see FreeImage_GetInfo - */ - BITMAPINFO* getInfo() const; - - /** - Returns a pointer to the bitmap's BITMAPINFOHEADER. - @see FreeImage_GetInfoHeader - */ - BITMAPINFOHEADER* getInfoHeader() const; - - /** - Returns the size of the bitmap in bytes. - The size of the bitmap is the BITMAPINFOHEADER + the size of the palette + the size of the bitmap data. - @see FreeImage_GetDIBSize - */ - LONG getImageSize() const; - - /** - Returns the bitdepth of the bitmap.
- When the image type is FIT_BITMAP, valid bitdepth can be 1, 4, 8, 16, 24 or 32. - @see FreeImage_GetBPP, getImageType - */ - unsigned getBitsPerPixel() const; - - /** - Returns the width of the bitmap in bytes.
- This is not the size of the scanline. - @see FreeImage_GetLine, getScanWidth - */ - unsigned getLine() const; - - /** - Returns the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetDotsPerMeterX - */ - double getHorizontalResolution() const; - - /** - Returns the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetDotsPerMeterY - */ - double getVerticalResolution() const; - - /** - set the bitmap resolution along the X axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setHorizontalResolution(double value); - - /** - set the bitmap resolution along the Y axis, in pixels / cm - @see FreeImage_GetInfoHeader - */ - void setVerticalResolution(double value); - - //@} - - /**@name Palette operations */ - //@{ - /** - Returns a pointer to the bitmap's palette. If the bitmap doesn't have a palette, getPalette returns NULL. - @see FreeImage_GetPalette - */ - RGBQUAD* getPalette() const; - - /** - Returns the palette size in bytes. - @see FreeImage_GetColorsUsed - */ - unsigned getPaletteSize() const; - - /** - Retrieves the number of colours used in the bitmap. If the bitmap is non-palletised, 0 is returned. - @see FreeImage_GetColorsUsed - */ - unsigned getColorsUsed() const; - - /** - Investigates the colour type of the bitmap. - @see FreeImage_GetColorType, FREE_IMAGE_COLOR_TYPE - */ - FREE_IMAGE_COLOR_TYPE getColorType() const; - - /** - Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise - @see FreeImage_GetBPP, FreeImage_GetColorType - */ - BOOL isGrayscale() const; - //@} - - /**@name Pixel access */ - //@{ - - /** @brief Returns a pointer to the bitmap bits. - - It is up to you to interpret these bytes correctly, - according to the results of FreeImage_GetBPP and - GetRedMask, FreeImage_GetGreenMask and FreeImage_GetBlueMask.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetBits - */ - BYTE* accessPixels() const; - - /** @brief Returns a pointer to the start of the given scanline in the bitmaps data-bits. - This pointer can be cast according to the result returned by getImageType.
- Use this function with getScanWidth to iterates through the pixels. - @see FreeImage_GetScanLine, FreeImage documentation - */ - BYTE* getScanLine(unsigned scanline) const; - - /** - Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index (returned value) - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_GetPixelIndex - */ - BOOL getPixelIndex(unsigned x, unsigned y, BYTE *value) const; - - /** - Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color (returned value) - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_GetPixelColor - */ - BOOL getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const; - - /** - Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel index - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_SetPixelIndex - */ - BOOL setPixelIndex(unsigned x, unsigned y, BYTE *value); - - /** - Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). - @param x Pixel position in horizontal direction - @param y Pixel position in vertical direction - @param value Pixel color - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_SetPixelColor - */ - BOOL setPixelColor(unsigned x, unsigned y, RGBQUAD *value); - - //@} - - /** @name Conversion routines - * Bitmaps are always loaded in their default bit depth. If you want the bitmap to be stored in another bit depth, the class provides several conversion functions. - */ - //@{ - /** - Converts an image to a type supported by FreeImage. - @param image_type New image type - @param scale_linear TRUE if image pixels must be scaled linearly when converting to a standard bitmap - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertToType, FreeImage_ConvertToStandardType - */ - BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear = TRUE); - - /** - Converts the bitmap to 1 bit using a threshold T. - @param T Threshold value in [0..255] - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_Threshold - */ - BOOL threshold(BYTE T); - - /** - Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm. - @param algorithm Dithering algorithm to use. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_Dither, FREE_IMAGE_DITHER - */ - BOOL dither(FREE_IMAGE_DITHER algorithm); - - /** - Converts the bitmap to 4 bits. Unless the bitmap is a 1-bit palettized bitmap, colour values are converted to greyscale. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo4Bits - */ - BOOL convertTo4Bits(); - - /** - Converts the bitmap to 8 bits. If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo8Bits - */ - BOOL convertTo8Bits(); - - /** - Converts the bitmap to 8 bits.
- For palletized bitmaps, the color map is converted to a greyscale ramp. - @see FreeImage_ConvertToGreyscale - @return Returns TRUE if successfull, FALSE otherwise. - */ - BOOL convertToGrayscale(); - - /** - Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
- The quantize parameter specifies which colour reduction algorithm should be used. - @param algorithm Color quantization algorithm to use. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ColorQuantize, FREE_IMAGE_QUANTIZE - */ - BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 5 bits green, 5 bits blue and 1 unused bit. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo16Bits555 - */ - BOOL convertTo16Bits555(); - - /** - Converts the bitmap to 16 bits. The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits blue. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo16Bits565 - */ - BOOL convertTo16Bits565(); - - /** - Converts the bitmap to 24 bits. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo24Bits - */ - BOOL convertTo24Bits(); - - /** - Converts the bitmap to 32 bits. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertTo32Bits - */ - BOOL convertTo32Bits(); - - /** - Converts the bitmap to a 96-bit RGBF image. - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ConvertToRGBF - */ - BOOL convertToRGBF(); - - /** - Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter (algorithm dependant) - @param second_param Second tone mapping algorithm parameter (algorithm dependant) - @param third_param Third tone mapping algorithm parameter (algorithm dependant) - @param fourth_param Fourth tone mapping algorithm parameter (algorithm dependant) - @return Returns TRUE if successfull, FALSE otherwise. - @see FreeImage_ToneMapping, FreeImage_TmoReinhard05Ex - */ - BOOL toneMapping(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - //@} - - /** @name Transparency support: background colour and alpha channel */ - //@{ - - /** - Returns TRUE if the image is transparent, returns FALSE otherwise - @see FreeImage_IsTransparent - */ - BOOL isTransparent() const; - - /** - 8-bit transparency : get the number of transparent colors. - @return Returns the number of transparent colors in a palletised bitmap. - @see FreeImage_GetTransparencyCount - */ - unsigned getTransparencyCount() const; - - /** - 8-bit transparency : get the bitmaps transparency table. - @return Returns a pointer to the bitmaps transparency table. - @see FreeImage_GetTransparencyTable - */ - BYTE* getTransparencyTable() const; - - /** - 8-bit transparency : set the bitmaps transparency table. - @see FreeImage_SetTransparencyTable - */ - void setTransparencyTable(BYTE *table, int count); - - /** - Returns TRUE when the image has a file background color, FALSE otherwise. - @see FreeImage_HasBackgroundColor - */ - BOOL hasFileBkColor() const; - - /** - @brief Retrieves the file background color of an image. - - For 8-bit images, the color index - in the palette is returned in the rgbReserved member of the bkcolor parameter. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetBackgroundColor - */ - BOOL getFileBkColor(RGBQUAD *bkcolor) const; - - /** - @brief Set the file background color of an image. - - When saving an image to PNG, this background color is transparently saved to the PNG file. - When the bkcolor parameter is NULL, the background color is removed from the image. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetBackgroundColor - */ - BOOL setFileBkColor(RGBQUAD *bkcolor); - //@} - - /**@name Channel processing support */ - //@{ - /** @brief Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] image. - @param image Output image to be extracted - @param channel Color channel to extract - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_GetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const; - - /** - @brief Insert a 8-bit dib into a 24- or 32-bit image. - @param image Input 8-bit image to insert - @param channel Color channel to replace - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SetChannel, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Split a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels. - @param RedChannel Output red channel. - @param GreenChannel Output green channel. - @param BlueChannel Output blue channel. - @return Returns FALSE if the dib isn't a valid image, if it's not a 24-bit image or if - one of the output channel can't be allocated. Returns TRUE otherwise. - @see FreeImage_GetChannel - */ - BOOL splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel); - - /** @brief Builds a 24-bit RGB image given its red, green and blue channel. - @param red Input red channel. - @param green Input green channel. - @param blue Input blue channel. - @return Returns FALSE if the dib can't be allocated, if the input channels are not 8-bit images. Returns TRUE otherwise. - @see FreeImage_SetChannel - */ - BOOL combineChannels(fipImage& red, fipImage& green, fipImage& blue); - //@} - - /**@name Rotation and flipping */ - //@{ - /** - Image translation and rotation using B-Splines. - @param angle Image rotation angle, in degree - @param x_shift Image horizontal shift - @param y_shift Image vertical shift - @param x_origin Origin of the x-axis - @param y_origin Origin of the y-axis - @param use_mask Whether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE - @return Returns the translated & rotated dib if successful, returns NULL otherwise - @see FreeImage_RotateEx - */ - BOOL rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask); - - /** - Image rotation by means of three shears. - @param angle Image rotation angle, in degree - @param bkcolor Background color (image type dependent), default to black background - @return Returns rotated dib if successful, returns NULL otherwise - @see FreeImage_Rotate - */ - BOOL rotate(double angle, const void *bkcolor = NULL); - - /** - Flip the image horizontally along the vertical axis - @see FreeImage_FlipHorizontal - */ - BOOL flipHorizontal(); - - /** - Flip the image vertically along the horizontal axis - @see FreeImage_FlipVertical - */ - BOOL flipVertical(); - //@} - - /**@name Color manipulation routines */ - //@{ - /** - Inverts each pixel data. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_Invert - */ - BOOL invert(); - - /** @brief Perfoms an histogram transformation on a 8, 24 or 32-bit image - according to the values of a lookup table (LUT). - - The transformation is done as follows.
- Image 8-bit : if the image has a color palette, the LUT is applied to this palette, - otherwise, it is applied to the grey values.
- Image 24-bit & 32-bit : if channel == IPL_CC_RGB, the same LUT is applied to each color - plane (R,G, and B). Otherwise, the LUT is applied to the specified channel only. - @param LUT Lookup table. The size of 'LUT' is assumed to be 256. - @param channel The color channel to be processed (only used with 24 & 32-bit DIB). - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustCurve, FREE_IMAGE_COLOR_CHANNEL - */ - BOOL adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); - - /** @brief Performs gamma correction on a 8, 24 or 32-bit image. - @param gamma Gamma value to use. A value of 1.0 leaves the image alone, - less than one darkens it, and greater than one lightens it. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_AdjustGamma, adjustCurve - */ - BOOL adjustGamma(double gamma); - - /** @brief Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will make the image darker - and greater than 0 will make the image brighter. - @return Returns TRUE if the operation was succesful, FALSE otherwise - @see FreeImage_AdjustBrightness, adjustCurve - */ - BOOL adjustBrightness(double percentage); - - /** @brief Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount. - @param percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will decrease the contrast - and greater than 0 will increase the contrast of the image. - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_AdjustContrast, adjustCurve - */ - BOOL adjustContrast(double percentage); - - /** - Adjusts an image's brightness, contrast and gamma within a single operation. - If more than one of these image display properties need to be adjusted, - using this function should be preferred over calling each adjustment function separately. - That's particularly true for huge images or if performance is an issue. - @see adjustBrightness - @see adjustContrast - @see adjustGamma - @see FreeImage_AdjustColors - */ - BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma); - - /** @brief Computes image histogram - - For 24-bit and 32-bit images, histogram can be computed from red, green, blue and - black channels. For 8-bit images, histogram is computed from the black channel. Other - bit depth is not supported. - @param histo pointer to an histogram array. Size of this array is assumed to be 256. - @param channel Color channel to use - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetHistogram - */ - BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel = FICC_BLACK) const; - //@} - - /**@name Upsampling / downsampling */ - //@{ - - /** @brief Rescale the image to a new width / height. - - @param new_width New image width - @param new_height New image height - @param filter The filter parameter specifies which resampling filter should be used. - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_Rescale, FREE_IMAGE_FILTER - */ - BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter); - - /** @brief Creates a thumbnail image keeping aspect ratio - - @param max_size Maximum width or height in pixel units - @param convert When set to TRUE, converts the image to a standard type - @return Returns TRUE if the operation was successful, FALSE otherwise - @see FreeImage_MakeThumbnail - */ - BOOL makeThumbnail(unsigned max_size, BOOL convert = TRUE); - //@} - - /**@name Image status */ - //@{ - /** - Set the image status as 'modified'.
- When using the fipWinImage class, the image status is used to refresh the display. - It is changed to FALSE whenever the display has just been refreshed. - @param bStatus TRUE if the image should be marked as modified, FALSE otherwise - @see isModified - */ - void setModified(BOOL bStatus = TRUE) { - _bHasChanged = bStatus; - } - - /** - Get the image status - @return Returns TRUE if the image is marked as modified, FALSE otherwise - @see setModified - */ - BOOL isModified() { - return _bHasChanged; - } - //@} - - /**@name Metadata */ - //@{ - /** - Returns the number of tags contained in the model metadata model - attached to the dib - @param model Metadata model to look for - */ - unsigned getMetadataCount(FREE_IMAGE_MDMODEL model) const; - /** - Retrieve a metadata attached to the dib - @param model Metadata model to look for - @param key Metadata field name - @param tag Returned tag - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_GetMetadata - */ - BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const; - /** - Attach a new FreeImage tag to the dib.
- Sample use :
-
-	fipImage image;
-	// ...
-	fipTag tag;
-	tag.setKeyValue("Caption/Abstract", "my caption");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	tag.setKeyValue("Keywords", "FreeImage;Library;Images;Compression");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	
- - @param model Metadata model used to store the tag - @param key Tag field name - @param tag Tag to be attached - @return Returns TRUE if the operation was succesfull, FALSE otherwise - @see FreeImage_SetMetadata - */ - BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag); - //@} - - - protected: - /**@name Internal use */ - //@{ - BOOL replace(FIBITMAP *new_dib); - //@} - -}; - -// ---------------------------------------------------------- - -/** A class designed for MS Windows (TM) platforms. - - fipWinImage provides methods used to : -
    -
  • Display a DIB on the screen -
  • Copy / Paste a DIB to/from Windows devices (HANDLE, HBITMAP, Clipboard) -
  • Capture a window (HWND) and convert it to an image -
- @version FreeImage 3 - @author Herv Drolon -*/ -#ifdef _WIN32 - -class FIP_API fipWinImage : public fipImage -{ -public: - /**@name Creation & Destruction */ - //@{ - /// Constructor - fipWinImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0); - - /// Destructor - virtual ~fipWinImage(); - - /// Destroy image data - virtual void clear(); - - /// Returns TRUE if the image is allocated, FALSE otherwise - BOOL isValid() const; - //@} - - /**@name Copying */ - //@{ - - /** - Copy constructor. - Delete internal _display_dib data and copy the base class image data. - Tone mapping parameters are left unchanged. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipImage& src); - - /** - Copy constructor - Delete internal _display_dib data and copy tone mapping parameters. - Copy also the base class image data. - @see FreeImage_Clone - */ - fipWinImage& operator=(const fipWinImage& src); - - /** Clone function used for clipboard copy.
- Convert the FIBITMAP image to a DIB, - and transfer the DIB in a global bitmap handle.
- For non standard bitmaps, the BITMAPINFOHEADER->biCompression field is set to 0xFF + FreeImage_GetImageType(_dib), - in order to recognize the bitmap as non standard. - */ - HANDLE copyToHandle() const; - - /** Copy constructor used for clipboard paste.
- Converts a global object to a FIBITMAP. The clipboard format must be CF_DIB.
- When the BITMAPINFOHEADER->biCompression field is set to 0xFF + [one of the predefined FREE_IMAGE_TYPE], - the bitmap is recognized as non standard and correctly copied. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromHandle(HANDLE hMem); - - /** Copy constructor.
- Converts a HBITMAP object to a FIBITMAP. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyFromBitmap(HBITMAP hbmp); - //@} - - /**@name Clipboard operations */ - //@{ - /** - Clipboard copy. - @param hWndNewOwner Handle to the window to be associated with the open clipboard. - In MFC, you can use AfxGetApp()->m_pMainWnd->GetSafeHwnd(). - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL copyToClipboard(HWND hWndNewOwner) const; - - /** - Retrieves data from the clipboard. The clipboard format must be CF_DIB. - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL pasteFromClipboard(); - //@} - - /**@name Screen capture */ - //@{ - /** Capture a window and convert it to an image - @param hWndApplicationWindow Handle to the application main window - @param hWndSelectedWindow Handle to the window to be captured - @return Returns TRUE if successful, returns FALSE otherwise - */ - BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow); - //@} - - - /**@name Painting operations */ - //@{ - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function composite - the foreground image against a checkerboard background image. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @see FreeImage_Composite - */ - void draw(HDC hDC, RECT& rcDest) const { - drawEx(hDC, rcDest, FALSE, NULL, NULL); - } - - /** @brief Draw (stretch) the image on a HDC, using StretchDIBits. - - When the image is transparent or has a file background, this function can composite - the foreground image against a checkerboard background image, against a single background color or - against a user background image.
- When the image is a High Dynamic Range image (48-bit or RGB float), this function will apply a - tone mapping operator before drawing the image.
- The original image (located in the fipImage class) will not be affected by any of the operations - that could be done in order to display it. - @param hDC Handle to the device context - @param rcDest Destination rectangle - @param useFileBkg When set to TRUE, the function uses the file color background if there is one - @param appBkColor When a color is given, the function uses it as the background color - @param bg When a FIBITMAP is given, the function uses it as the background image - @see FreeImage_Composite - @see setToneMappingOperator - */ - void drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg = FALSE, RGBQUAD *appBkColor = NULL, FIBITMAP *bg = NULL) const; - - /** - Select a tone mapping algorithm used for drawing and set the image as modified - so that the display will be refreshed. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0); - - /** - Get the tone mapping algorithm used for drawing, with its parameters. - @param tmo Tone mapping operator - @param first_param First tone mapping algorithm parameter - @param second_param Second tone mapping algorithm parameter - @param third_param Third tone mapping algorithm parameter - @param fourth_param Fourth tone mapping algorithm parameter - @see FreeImage_ToneMapping - */ - void getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const; - - //@} - -protected: - /// DIB used for display (this allow to display non-standard bitmaps) - mutable FIBITMAP *_display_dib; - /// remember to delete _display_dib - mutable BOOL _bDeleteMe; - /// tone mapping operator - FREE_IMAGE_TMO _tmo; - /// first tone mapping algorithm parameter - double _tmo_param_1; - /// second tone mapping algorithm parameter - double _tmo_param_2; - /// third tone mapping algorithm parameter - double _tmo_param_3; - /// fourth tone mapping algorithm parameter - double _tmo_param_4; -}; - -#endif // _WIN32 - -// ---------------------------------------------------------- - -/** Memory handle - - fipMemoryIO is a class that allows you to load / save images from / to a memory stream. - @version FreeImage 3 - @author Herv Drolon -*/ -class FIP_API fipMemoryIO : public fipObject -{ -protected: - /// Pointer to a memory stream - FIMEMORY *_hmem; - -public : - /** Constructor. - Wrap a memory buffer containing image data.
- The memory buffer is read only and has to be freed by the user - when no longer in use.
- When default arguments are used, open a memory file as read/write. - @param data Pointer to the memory buffer - @param size_in_bytes Buffer size in bytes - @see FreeImage_OpenMemory - */ - fipMemoryIO(BYTE *data = NULL, DWORD size_in_bytes = 0); - - /** Destructor. - Free any allocated memory - @see FreeImage_CloseMemory - */ - virtual ~fipMemoryIO(); - - /** Destructor. - Free any allocated memory and invalidate the stream - @see FreeImage_CloseMemory - */ - void close(); - - /** Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise - */ - BOOL isValid() const; - - /** Returns the buffer image format - @see FreeImage_GetFileTypeFromMemory - */ - FREE_IMAGE_FORMAT getFileType() const; - - /** - Returns a pointer to the FIMEMORY data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMEMORY*() { - return _hmem; - } - - /**@name Memory IO routines */ - //@{ - /** - Loads a dib from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the image to be loaded. - @return Returns the loaded dib if successful, returns NULL otherwise - @see FreeImage_LoadFromMemory - */ - FIBITMAP* load(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Loads a multi-page bitmap from a memory stream - @param fif Format identifier (FreeImage format) - @param flags The signification of this flag depends on the multi-page to be loaded. - @return Returns the loaded multi-page if successful, returns NULL otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - FIMULTIBITMAP* loadMultiPage(FREE_IMAGE_FORMAT fif, int flags = 0) const; - /** - Saves a dib to a memory stream - @param fif Format identifier (FreeImage format) - @param dib Image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveToMemory - */ - BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags = 0); - /** - Saves a multi-page bitmap to a memory stream - @param fif Format identifier (FreeImage format) - @param bitmap Multi-page image to be saved - @param flags The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SaveMultiBitmapToMemory - */ - BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags = 0); - /** - Reads data from a memory stream - @param buffer Storage location for data - @param size Item size in bytes - @param count Maximum number of items to be read - @return Returns the number of full items actually read, which may be less than count if an error occurs - @see FreeImage_ReadMemory - */ - unsigned read(void *buffer, unsigned size, unsigned count) const; - /** - Writes data to a memory stream - @param buffer Pointer to data to be written - @param size Item size in bytes - @param count Maximum number of items to be written - @return Returns the number of full items actually written, which may be less than count if an error occurs - @see FreeImage_WriteMemory - */ - unsigned write(const void *buffer, unsigned size, unsigned count); - /** - Gets the current position of a memory pointer - @see FreeImage_TellMemory - */ - long tell() const; - /** - Moves the memory pointer to a specified location - @see FreeImage_SeekMemory - */ - BOOL seek(long offset, int origin); - /** - Provides a direct buffer access to a memory stream - @param data Pointer to the memory buffer (returned value) - @param size_in_bytes Buffer size in bytes (returned value) - @see FreeImage_AcquireMemory - */ - BOOL acquire(BYTE **data, DWORD *size_in_bytes); - //@} - -private: - /// Disable copy - fipMemoryIO(const fipMemoryIO& src); - /// Disable copy - fipMemoryIO& operator=(const fipMemoryIO& src); - -}; - -// ---------------------------------------------------------- - -/** Multi-page file stream - - fipMultiPage encapsulates the multi-page API. It supports reading/writing - multi-page TIFF, ICO and GIF files. -*/ -class FIP_API fipMultiPage : public fipObject -{ -protected: - /// Pointer to a multi-page file stream - FIMULTIBITMAP *_mpage; - /// TRUE when using a memory cache, FALSE otherwise - BOOL _bMemoryCache; - -public: - /** - Constructor - @param keep_cache_in_memory When it is TRUE, all gathered bitmap data in the page manipulation process is kept in memory, otherwise it is lazily flushed to a temporary file on the hard disk in 64 Kb blocks. - */ - fipMultiPage(BOOL keep_cache_in_memory = FALSE); - - /** - Destructor - Close the file stream if not already done. - */ - virtual ~fipMultiPage(); - - /// Returns TRUE if the multi-page stream is opened - BOOL isValid() const; - - /** - Returns a pointer to the FIMULTIBITMAP data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - */ - operator FIMULTIBITMAP*() { - return _mpage; - } - - /** - Open a multi-page file stream - @param lpszPathName Name of the multi-page bitmap file - @param create_new When TRUE, it means that a new bitmap will be created rather than an existing one being opened - @param read_only When TRUE the bitmap is opened read-only - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_OpenMultiBitmap - */ - BOOL open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags = 0); - - /** - Open a multi-page memory stream as read/write. - @param memIO Memory stream. The memory stream MUST BE a wrapped user buffer. - @param flags Load flags. The signification of this flag depends on the image to be loaded. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_LoadMultiBitmapFromMemory - */ - BOOL open(fipMemoryIO& memIO, int flags = 0); - - /** - Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the image to be read. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_OpenMultiBitmapFromHandle - */ - BOOL open(FreeImageIO *io, fi_handle handle, int flags = 0); - - /** - Close a file stream - @param flags Save flags. The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CloseMultiBitmap - */ - BOOL close(int flags = 0); - - /** - Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag. - @param fif Format identifier (FreeImage format) - @param io FreeImageIO structure - @param handle FreeImage fi_handle - @param flag The signification of this flag depends on the multi-page image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToHandle, FreeImage documentation - */ - BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags = 0) const; - - /** - Saves a multi-page image using the specified memory stream and an optional flag. - @param fif Format identifier (FreeImage format) - @param memIO FreeImage memory stream - @param flag The signification of this flag depends on the image to be saved. - @return Returns TRUE if successful, FALSE otherwise. - @see FreeImage_SaveMultiBitmapToMemory, FreeImage documentation - */ - BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags = 0) const; - - /** - Returns the number of pages currently available in the multi-paged bitmap - @see FreeImage_GetPageCount - */ - int getPageCount() const; - - /** - Appends a new page to the end of the bitmap - @param image Image to append - @see FreeImage_AppendPage - */ - void appendPage(fipImage& image); - - /** - Inserts a new page before the given position in the bitmap - @param page Page number. Page has to be a number smaller than the current number of pages available in the bitmap. - @param image Image to insert - @see FreeImage_InsertPage - */ - void insertPage(int page, fipImage& image); - - /** - Deletes the page on the given position - @param page Page number - @see FreeImage_DeletePage - */ - void deletePage(int page); - - /** - Moves the source page to the position of the target page. - @param target Target page position - @param source Source page position - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_MovePage - */ - BOOL movePage(int target, int source); - - /** - Locks a page in memory for editing. You must call unlockPage to free the page
- Usage :
-
-	fipMultiPage mpage;
-	// ...
-	fipImage image;		// You must declare this before
-	image = mpage.lockPage(2);
-	if(image.isValid()) {
-	  // ...
-	  mpage.unlockPage(image, TRUE);
-	}
-	
- @param page Page number - @return Returns the page if successful, returns NULL otherwise - @see FreeImage_LockPage - */ - FIBITMAP* lockPage(int page); - - /** - Unlocks a previously locked page and gives it back to the multi-page engine - @param image Page to unlock - @param changed When TRUE, the page is marked changed and the new page data is applied in the multi-page bitmap. - @see FreeImage_UnlockPage - */ - void unlockPage(fipImage& image, BOOL changed); - - /** - Returns an array of page-numbers that are currently locked in memory. - When the pages parameter is NULL, the size of the array is returned in the count variable. - You can then allocate the array of the desired size and call - getLockedPageNumbers again to populate the array. - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_GetLockedPageNumbers - */ - BOOL getLockedPageNumbers(int *pages, int *count) const; -}; - -// ---------------------------------------------------------- - -/** -FreeImage Tag - -FreeImage uses this structure to store metadata information. -*/ -class FIP_API fipTag : public fipObject -{ -protected: - /// Pointer to a FreeImage tag - FITAG *_tag; - -public: - /**@name Creation & Destruction */ - //@{ - /** - Constructor - @see FreeImage_CreateTag - */ - fipTag(); - /** - Destructor - @see FreeImage_DeleteTag - */ - virtual ~fipTag(); - /** - Construct a FIDT_ASCII tag (ASCII string).
- This method is useful to store comments or IPTC tags. - @param name Field name - @param value Field value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_CreateTag - */ - BOOL setKeyValue(const char *key, const char *value); - - //@} - - /**@name Copying */ - //@{ - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag(const fipTag& tag); - /** - Copy constructor - @see FreeImage_CloneTag - */ - fipTag& operator=(const fipTag& tag); - /** - Assignement operator
- Copy the input pointer and manage its destruction - @see operator FITAG*() - */ - fipTag& operator=(FITAG *tag); - //@} - - /** - Returns a pointer to the FITAG data. Used for direct access from FREEIMAGE functions - or from your own low level C functions. - @see operator=(FITAG *tag) - */ - operator FITAG*() { - return _tag; - } - - /// Returns TRUE if the tag is allocated, FALSE otherwise - BOOL isValid() const; - - /**@name Tag accessors */ - //@{ - /** - Returns the tag field name (unique inside a metadata model). - @see FreeImage_GetTagKey - */ - const char *getKey() const; - /** - Returns the tag description if available, returns NULL otherwise - @see FreeImage_GetTagDescription - */ - const char *getDescription() const; - /** - Returns the tag ID if available, returns 0 otherwise - @see FreeImage_GetTagID - */ - WORD getID() const; - /** - Returns the tag data type - @see FreeImage_GetTagType - */ - FREE_IMAGE_MDTYPE getType() const; - /** - Returns the number of components in the tag (in tag type units) - @see FreeImage_GetTagCount - */ - DWORD getCount() const; - /** - Returns the length of the tag value in bytes - @see FreeImage_GetTagLength - */ - DWORD getLength() const; - /** - Returns the tag value - @see FreeImage_GetTagValue - */ - const void *getValue() const; - /** - Set the tag field name - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagKey - */ - BOOL setKey(const char *key); - /** - Set the (usually optional) tag description - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagDescription - */ - BOOL setDescription(const char *description); - /** - Set the (usually optional) tad ID - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagID - */ - BOOL setID(WORD id); - /** - Set the tag data type - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagType - */ - BOOL setType(FREE_IMAGE_MDTYPE type); - /** - Set the number of data in the tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagCount - */ - BOOL setCount(DWORD count); - /** - Set the length of the tag value, in bytes - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagLength - */ - BOOL setLength(DWORD length); - /** - Set the tag value - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_SetTagValue - */ - BOOL setValue(const void *value); - - //@} - - /** - Converts a FreeImage tag structure to a string that represents the interpreted tag value - @param model Metadata model specification (metadata model from which the tag was extracted) - @param Make Camera model (not used yet) - */ - const char* toString(FREE_IMAGE_MDMODEL model, char *Make = NULL) const; - -}; - -/** -Metadata iterator - -Usage :
-
-fipImage image;
-// ...
-fipTag tag;
-fipMetadataFind finder;
-if( finder.findFirstMetadata(FIMD_EXIF_MAIN, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-// the class can be called again with another metadata model
-if( finder.findFirstMetadata(FIMD_EXIF_EXIF, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";
-
-  } while( finder.findNextMetadata(tag) );
-}
-
-*/ -class FIP_API fipMetadataFind : public fipObject -{ -protected: - /// Pointer to a search handle - FIMETADATA *_mdhandle; - -public: - /// Returns TRUE if the search handle is allocated, FALSE otherwise - BOOL isValid() const; - - /// Constructor - fipMetadataFind(); - /** - Destructor - @see FreeImage_FindCloseMetadata - */ - virtual ~fipMetadataFind(); - /** - Provides information about the first instance of a tag that matches - the metadata model specified in the model argument. - @param model Metadata model - @param image Input image - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise - @see FreeImage_FindFirstMetadata - */ - BOOL findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag); - /** - Find the next tag, if any, that matches the metadata model argument - in a previous call to findFirstMetadata - @param tag Returned tag - @return Returns TRUE if successful, returns FALSE otherwise, indicating that no more matching tags could be found - @see FreeImage_FindNextMetadata - */ - BOOL findNextMetadata(fipTag& tag); - -}; - -#endif // FREEIMAGEPLUS_H diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/FreeImagePlus.lib b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/FreeImagePlus.lib deleted file mode 100644 index aaf532b..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/FreeImagePlus.lib and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/delete.me b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/dist/delete.me deleted file mode 100644 index e69de29..0000000 diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/FreeImagePlus_8h-source.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/FreeImagePlus_8h-source.html deleted file mode 100644 index 555b37a..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/FreeImagePlus_8h-source.html +++ /dev/null @@ -1,518 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
-

FreeImagePlus.h

00001 // ==========================================================
-00002 // FreeImagePlus 3
-00003 //
-00004 // Design and implementation by
-00005 // - Herv Drolon (drolon@infonie.fr)
-00006 //
-00007 // This file is part of FreeImage 3
-00008 //
-00009 // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
-00010 // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
-00011 // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
-00012 // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
-00013 // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
-00014 // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
-00015 // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
-00016 // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
-00017 // THIS DISCLAIMER.
-00018 //
-00019 // Use at your own risk!
-00020 // ==========================================================
-00021 
-00022 #ifndef FREEIMAGEPLUS_H
-00023 #define FREEIMAGEPLUS_H
-00024 
-00025 #ifdef _WIN32
-00026 #include <windows.h>
-00027 #endif // _WIN32
-00028 #include "FreeImage.h"
-00029 
-00030 
-00031 // Compiler options ---------------------------------------------------------
-00032 
-00033 #if defined(FREEIMAGE_LIB)
-00034         #define FIP_API
-00035         #define FIP_CALLCONV
-00036 #else
-00037         #if defined(_WIN32) || defined(__WIN32__)
-00038                 #define WIN32_LEAN_AND_MEAN
-00039                 #define FIP_CALLCONV __stdcall
-00040                 // The following ifdef block is the standard way of creating macros which make exporting 
-00041                 // from a DLL simpler. All files within this DLL are compiled with the FIP_EXPORTS
-00042                 // symbol defined on the command line. this symbol should not be defined on any project
-00043                 // that uses this DLL. This way any other project whose source files include this file see 
-00044                 // FIP_API functions as being imported from a DLL, wheras this DLL sees symbols
-00045                 // defined with this macro as being exported.
-00046                 #ifdef FIP_EXPORTS
-00047                         #define FIP_API __declspec(dllexport)
-00048                 #else
-00049                         #define FIP_API __declspec(dllimport)
-00050                 #endif // FIP_EXPORTS
-00051         #else
-00052                 // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility)
-00053                 #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-00054                         #ifndef GCC_HASCLASSVISIBILITY
-00055                                 #define GCC_HASCLASSVISIBILITY
-00056                         #endif
-00057                 #endif  
-00058                 #define FIP_CALLCONV
-00059                 #if defined(GCC_HASCLASSVISIBILITY)
-00060                         #define FIP_API __attribute__ ((visibility("default")))
-00061                 #else
-00062                         #define FIP_API
-00063                 #endif
-00064         #endif // WIN32 / !WIN32
-00065 #endif // FREEIMAGE_LIB
-00066 
-00068 
-00069 // ----------------------------------------------------------
-00070 
-00076 class FIP_API fipObject
-00077 {
-00078 public:
-00080         virtual ~fipObject(){};
-00081         
-00084 
-00085         virtual BOOL isValid() const = 0;
-00087 };
-00088 
-00089 // ----------------------------------------------------------
-00090 
-00091 class fipMemoryIO;
-00092 class fipMultiPage;
-00093 class fipTag;
-00094 
-00103 class FIP_API fipImage : public fipObject
-00104 {
-00105 protected:
-00107         FIBITMAP *_dib;
-00109         FREE_IMAGE_FORMAT _fif;
-00111         mutable BOOL _bHasChanged;
-00112 
-00113 public:
-00114         friend class fipMultiPage;
-00115 
-00116 public:
-00117 
-00124         fipImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0);
-00126         virtual ~fipImage();
-00131         BOOL setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask = 0, unsigned green_mask = 0, unsigned blue_mask = 0);
-00133         virtual void clear();
-00135 
-00142         fipImage(const fipImage& src);
-00147         fipImage& operator=(const fipImage& src);
-00153         fipImage& operator=(FIBITMAP *dib);
-00154 
-00155 
-00168         BOOL copySubImage(fipImage& dst, int left, int top, int right, int bottom) const;
-00169 
-00183         BOOL pasteSubImage(fipImage& src, int left, int top, int alpha = 256);
-00184 
-00195         BOOL crop(int left, int top, int right, int bottom);
-00196 
-00198 
-00208         static FREE_IMAGE_FORMAT identifyFIF(const char* lpszPathName);
-00209 
-00214         static FREE_IMAGE_FORMAT identifyFIFU(const wchar_t* lpszPathName);
-00215 
-00223         static FREE_IMAGE_FORMAT identifyFIFFromHandle(FreeImageIO *io, fi_handle handle);
-00224 
-00231         static FREE_IMAGE_FORMAT identifyFIFFromMemory(FIMEMORY *hmem);
-00232 
-00234 
-00235 
-00247         BOOL load(const char* lpszPathName, int flag = 0);
-00248 
-00253         BOOL loadU(const wchar_t* lpszPathName, int flag = 0);
-00254 
-00263         BOOL loadFromHandle(FreeImageIO *io, fi_handle handle, int flag = 0);
-00264 
-00272         BOOL loadFromMemory(fipMemoryIO& memIO, int flag = 0);
-00273 
-00281         BOOL save(const char* lpszPathName, int flag = 0) const;
-00282 
-00287         BOOL saveU(const wchar_t* lpszPathName, int flag = 0) const;
-00288 
-00298         BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag = 0) const;
-00299 
-00308         BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag = 0) const;
-00309 
-00311 
-00316 
-00321         FREE_IMAGE_TYPE getImageType() const;
-00322 
-00327         unsigned getWidth() const;
-00328         
-00333         unsigned getHeight() const;
-00334         
-00339         unsigned getScanWidth() const;
-00340 
-00353         operator FIBITMAP*() { 
-00354                 return _dib; 
-00355         }
-00356 
-00358         BOOL isValid() const;
-00359 
-00364         BITMAPINFO* getInfo() const;
-00365 
-00370     BITMAPINFOHEADER* getInfoHeader() const;
-00371 
-00377         LONG getImageSize() const;
-00378         
-00384         unsigned getBitsPerPixel() const;
-00385 
-00391         unsigned getLine() const;
-00392 
-00397         double getHorizontalResolution() const;
-00398         
-00403         double getVerticalResolution() const;
-00404 
-00409         void setHorizontalResolution(double value);
-00410         
-00415         void setVerticalResolution(double value);
-00416 
-00418 
-00425         RGBQUAD* getPalette() const;
-00426         
-00431         unsigned getPaletteSize() const;
-00432 
-00437         unsigned getColorsUsed() const;
-00438 
-00443         FREE_IMAGE_COLOR_TYPE getColorType() const;
-00444 
-00449         BOOL isGrayscale() const;
-00451 
-00454 
-00463         BYTE* accessPixels() const;
-00464 
-00470         BYTE* getScanLine(unsigned scanline) const;
-00471 
-00480         BOOL getPixelIndex(unsigned x, unsigned y, BYTE *value) const;
-00481 
-00490         BOOL getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const;
-00491 
-00500         BOOL setPixelIndex(unsigned x, unsigned y, BYTE *value);
-00501 
-00510         BOOL setPixelColor(unsigned x, unsigned y, RGBQUAD *value);
-00511 
-00513 
-00525         BOOL convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear = TRUE);
-00526 
-00533         BOOL threshold(BYTE T);
-00534         
-00541         BOOL dither(FREE_IMAGE_DITHER algorithm);
-00542 
-00548         BOOL convertTo4Bits();
-00549 
-00555         BOOL convertTo8Bits();
-00556 
-00563         BOOL convertToGrayscale();
-00564         
-00572         BOOL colorQuantize(FREE_IMAGE_QUANTIZE algorithm);
-00573 
-00579         BOOL convertTo16Bits555();
-00580         
-00586         BOOL convertTo16Bits565();
-00587         
-00593         BOOL convertTo24Bits();
-00594         
-00600         BOOL convertTo32Bits();
-00601 
-00607         BOOL convertToRGBF();
-00608 
-00619         BOOL toneMapping(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0);
-00620 
-00622 
-00625 
-00630         BOOL isTransparent() const;
-00631 
-00637         unsigned getTransparencyCount() const;
-00638 
-00644         BYTE* getTransparencyTable() const;
-00645 
-00650         void setTransparencyTable(BYTE *table, int count);
-00651 
-00656         BOOL hasFileBkColor() const;
-00657 
-00666         BOOL getFileBkColor(RGBQUAD *bkcolor) const;
-00667 
-00676         BOOL setFileBkColor(RGBQUAD *bkcolor);
-00678 
-00687         BOOL getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const;
-00688 
-00696         BOOL setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel);
-00697 
-00706         BOOL splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel);
-00707 
-00715         BOOL combineChannels(fipImage& red, fipImage& green, fipImage& blue);
-00717 
-00731         BOOL rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask);
-00732 
-00740         BOOL rotate(double angle, const void *bkcolor = NULL);
-00741 
-00746         BOOL flipHorizontal();
-00747 
-00752         BOOL flipVertical();
-00754 
-00762         BOOL invert();
-00763         
-00777         BOOL adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel);
-00778 
-00785         BOOL adjustGamma(double gamma);
-00786 
-00794         BOOL adjustBrightness(double percentage);
-00795 
-00803         BOOL adjustContrast(double percentage);
-00804 
-00815         BOOL adjustBrightnessContrastGamma(double brightness, double contrast, double gamma);
-00816 
-00827         BOOL getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel = FICC_BLACK) const;
-00829 
-00832 
-00841         BOOL rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter);
-00842 
-00850         BOOL makeThumbnail(unsigned max_size, BOOL convert = TRUE);
-00852 
-00862         void setModified(BOOL bStatus = TRUE) {
-00863                 _bHasChanged = bStatus;
-00864         }
-00865 
-00871         BOOL isModified() {
-00872                 return _bHasChanged;
-00873         }
-00875 
-00883         unsigned getMetadataCount(FREE_IMAGE_MDMODEL model) const;
-00892         BOOL getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const;
-00912         BOOL setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag);
-00914 
-00915 
-00916   protected:
-00919           BOOL replace(FIBITMAP *new_dib);
-00921 
-00922 };
-00923 
-00924 // ----------------------------------------------------------
-00925 
-00937 #ifdef _WIN32
-00938 
-00939 class FIP_API fipWinImage : public fipImage
-00940 {
-00941 public:
-00944 
-00945         fipWinImage(FREE_IMAGE_TYPE image_type = FIT_BITMAP, unsigned width = 0, unsigned height = 0, unsigned bpp = 0);
-00946 
-00948         virtual ~fipWinImage();
-00949 
-00951         virtual void clear();
-00952 
-00954         BOOL isValid() const;
-00956 
-00959 
-00966         fipWinImage& operator=(const fipImage& src);
-00967 
-00974         fipWinImage& operator=(const fipWinImage& src);
-00975 
-00982         HANDLE copyToHandle() const;
-00983 
-00990         BOOL copyFromHandle(HANDLE hMem);
-00991 
-00996         BOOL copyFromBitmap(HBITMAP hbmp);
-00998 
-01007         BOOL copyToClipboard(HWND hWndNewOwner) const;
-01008 
-01013         BOOL pasteFromClipboard();
-01015 
-01023         BOOL captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow);
-01025 
-01026 
-01029 
-01038         void draw(HDC hDC, RECT& rcDest) const {
-01039                 drawEx(hDC, rcDest, FALSE, NULL, NULL);
-01040         }
-01041 
-01059         void drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg = FALSE, RGBQUAD *appBkColor = NULL, FIBITMAP *bg = NULL) const;
-01060 
-01071         void setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param = 0, double second_param = 0, double third_param = 1, double fourth_param = 0);
-01072 
-01082         void getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const;
-01083 
-01085 
-01086 protected:
-01088         mutable FIBITMAP *_display_dib;
-01090         mutable BOOL _bDeleteMe;
-01092         FREE_IMAGE_TMO _tmo;
-01094         double _tmo_param_1;
-01096         double _tmo_param_2;
-01098         double _tmo_param_3;
-01100         double _tmo_param_4;
-01101 };
-01102 
-01103 #endif // _WIN32
-01104 
-01105 // ----------------------------------------------------------
-01106 
-01113 class FIP_API fipMemoryIO : public fipObject
-01114 {
-01115 protected:
-01117         FIMEMORY *_hmem;
-01118 
-01119 public :
-01129     fipMemoryIO(BYTE *data = NULL, DWORD size_in_bytes = 0);
-01130 
-01135         virtual ~fipMemoryIO();
-01136 
-01141         void close();
-01142 
-01145         BOOL isValid() const;
-01146 
-01150         FREE_IMAGE_FORMAT getFileType() const;
-01151 
-01156         operator FIMEMORY*() { 
-01157                 return _hmem; 
-01158         }
-01159 
-01169         FIBITMAP* load(FREE_IMAGE_FORMAT fif, int flags = 0) const;
-01177         FIMULTIBITMAP* loadMultiPage(FREE_IMAGE_FORMAT fif, int flags = 0) const;
-01186         BOOL save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags = 0);
-01195         BOOL saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags = 0);
-01204         unsigned read(void *buffer, unsigned size, unsigned count) const;
-01213         unsigned write(const void *buffer, unsigned size, unsigned count);
-01218         long tell() const;
-01223         BOOL seek(long offset, int origin);
-01230         BOOL acquire(BYTE **data, DWORD *size_in_bytes);
-01232 
-01233 private:
-01235         fipMemoryIO(const fipMemoryIO& src);
-01237         fipMemoryIO& operator=(const fipMemoryIO& src);
-01238 
-01239 };
-01240 
-01241 // ----------------------------------------------------------
-01242 
-01248 class FIP_API fipMultiPage : public fipObject 
-01249 {
-01250 protected:
-01252         FIMULTIBITMAP *_mpage;
-01254         BOOL _bMemoryCache;
-01255 
-01256 public:
-01261         fipMultiPage(BOOL keep_cache_in_memory = FALSE);
-01262 
-01267         virtual ~fipMultiPage();
-01268 
-01270         BOOL isValid() const;
-01271 
-01276         operator FIMULTIBITMAP*() { 
-01277                 return _mpage; 
-01278         }
-01279 
-01289         BOOL open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags = 0);
-01290 
-01298         BOOL open(fipMemoryIO& memIO, int flags = 0);
-01299 
-01308         BOOL open(FreeImageIO *io, fi_handle handle, int flags = 0);
-01309 
-01316         BOOL close(int flags = 0);
-01317 
-01327         BOOL saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags = 0) const;
-01328 
-01337         BOOL saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags = 0) const;
-01338 
-01343         int getPageCount() const;
-01344 
-01350         void appendPage(fipImage& image);
-01351 
-01358         void insertPage(int page, fipImage& image);
-01359 
-01365         void deletePage(int page);
-01366 
-01374         BOOL movePage(int target, int source);
-01375 
-01393         FIBITMAP* lockPage(int page);
-01394 
-01401         void unlockPage(fipImage& image, BOOL changed);
-01402 
-01411         BOOL getLockedPageNumbers(int *pages, int *count) const;
-01412 };
-01413 
-01414 // ----------------------------------------------------------
-01415 
-01421 class FIP_API fipTag : public fipObject
-01422 {
-01423 protected:
-01425         FITAG *_tag;
-01426 
-01427 public:
-01434         fipTag();
-01439         virtual ~fipTag();
-01448         BOOL setKeyValue(const char *key, const char *value);
-01449 
-01451 
-01458         fipTag(const fipTag& tag);
-01463         fipTag& operator=(const fipTag& tag);
-01469         fipTag& operator=(FITAG *tag);
-01471 
-01477         operator FITAG*() { 
-01478                 return _tag; 
-01479         }
-01480 
-01482         BOOL isValid() const;
-01483 
-01490         const char *getKey() const;
-01495         const char *getDescription() const;
-01500         WORD getID() const;
-01505         FREE_IMAGE_MDTYPE getType() const;
-01510         DWORD getCount() const;
-01515         DWORD getLength() const;
-01520         const void *getValue() const;
-01526         BOOL setKey(const char *key);
-01532         BOOL setDescription(const char *description);
-01538         BOOL setID(WORD id);
-01544         BOOL setType(FREE_IMAGE_MDTYPE type);
-01550         BOOL setCount(DWORD count);
-01556         BOOL setLength(DWORD length);
-01562         BOOL setValue(const void *value);
-01563 
-01565 
-01571         const char* toString(FREE_IMAGE_MDMODEL model, char *Make = NULL) const;
-01572 
-01573 };
-01574 
-01601 class FIP_API fipMetadataFind : public fipObject
-01602 {
-01603 protected:
-01605         FIMETADATA *_mdhandle;
-01606 
-01607 public:
-01609         BOOL isValid() const;
-01610 
-01612         fipMetadataFind();
-01617         virtual ~fipMetadataFind();
-01627         BOOL findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag);
-01635         BOOL findNextMetadata(fipTag& tag);
-01636 
-01637 };
-01638 
-01639 #endif  // FREEIMAGEPLUS_H
-

-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/FreeImage_8h-source.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/FreeImage_8h-source.html deleted file mode 100644 index 775050e..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/FreeImage_8h-source.html +++ /dev/null @@ -1,1058 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
-

FreeImage.h

00001 // ==========================================================
-00002 // FreeImage 3
-00003 //
-00004 // Design and implementation by
-00005 // - Floris van den Berg (flvdberg@wxs.nl)
-00006 // - Herv Drolon (drolon@infonie.fr)
-00007 //
-00008 // Contributors:
-00009 // - see changes log named 'Whatsnew.txt', see header of each .h and .cpp file
-00010 //
-00011 // This file is part of FreeImage 3
-00012 //
-00013 // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
-00014 // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
-00015 // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
-00016 // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
-00017 // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
-00018 // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
-00019 // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
-00020 // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
-00021 // THIS DISCLAIMER.
-00022 //
-00023 // Use at your own risk!
-00024 // ==========================================================
-00025 
-00026 #ifndef FREEIMAGE_H
-00027 #define FREEIMAGE_H
-00028 
-00029 // Version information ------------------------------------------------------
-00030 
-00031 #define FREEIMAGE_MAJOR_VERSION   3
-00032 #define FREEIMAGE_MINOR_VERSION   14
-00033 #define FREEIMAGE_RELEASE_SERIAL  0
-00034 
-00035 // Compiler options ---------------------------------------------------------
-00036 
-00037 #include <wchar.h>      // needed for UNICODE functions
-00038 
-00039 #if defined(FREEIMAGE_LIB)
-00040         #define DLL_API
-00041         #define DLL_CALLCONV
-00042 #else
-00043         #if defined(_WIN32) || defined(__WIN32__)
-00044                 #define DLL_CALLCONV __stdcall
-00045                 // The following ifdef block is the standard way of creating macros which make exporting 
-00046                 // from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS
-00047                 // symbol defined on the command line. this symbol should not be defined on any project
-00048                 // that uses this DLL. This way any other project whose source files include this file see 
-00049                 // DLL_API functions as being imported from a DLL, wheras this DLL sees symbols
-00050                 // defined with this macro as being exported.
-00051                 #ifdef FREEIMAGE_EXPORTS
-00052                         #define DLL_API __declspec(dllexport)
-00053                 #else
-00054                         #define DLL_API __declspec(dllimport)
-00055                 #endif // FREEIMAGE_EXPORTS
-00056         #else 
-00057                 // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility)
-00058                 #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-00059                         #ifndef GCC_HASCLASSVISIBILITY
-00060                                 #define GCC_HASCLASSVISIBILITY
-00061                         #endif
-00062                 #endif // __GNUC__
-00063                 #define DLL_CALLCONV
-00064                 #if defined(GCC_HASCLASSVISIBILITY)
-00065                         #define DLL_API __attribute__ ((visibility("default")))
-00066                 #else
-00067                         #define DLL_API
-00068                 #endif          
-00069         #endif // WIN32 / !WIN32
-00070 #endif // FREEIMAGE_LIB
-00071 
-00072 // Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined
-00073 // If your big endian system isn't being detected, add an OS specific check
-00074 #if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \
-00075         (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \
-00076         defined(__BIG_ENDIAN__)
-00077 #define FREEIMAGE_BIGENDIAN
-00078 #endif // BYTE_ORDER
-00079 
-00080 // This really only affects 24 and 32 bit formats, the rest are always RGB order.
-00081 #define FREEIMAGE_COLORORDER_BGR        0
-00082 #define FREEIMAGE_COLORORDER_RGB        1
-00083 #if defined(FREEIMAGE_BIGENDIAN)
-00084 #define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB
-00085 #else
-00086 #define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR
-00087 #endif
-00088 
-00089 // Ensure 4-byte enums if we're using Borland C++ compilers
-00090 #if defined(__BORLANDC__)
-00091 #pragma option push -b
-00092 #endif
-00093 
-00094 // For C compatibility --------------------------------------------------------
-00095 
-00096 #ifdef __cplusplus
-00097 #define FI_DEFAULT(x)   = x
-00098 #define FI_ENUM(x)      enum x
-00099 #define FI_STRUCT(x)    struct x
-00100 #else
-00101 #define FI_DEFAULT(x)
-00102 #define FI_ENUM(x)      typedef int x; enum x
-00103 #define FI_STRUCT(x)    typedef struct x x; struct x
-00104 #endif
-00105 
-00106 // Bitmap types -------------------------------------------------------------
-00107 
-00108 FI_STRUCT (FIBITMAP) { void *data; };
-00109 FI_STRUCT (FIMULTIBITMAP) { void *data; };
-00110 
-00111 // Types used in the library (directly copied from Windows) -----------------
-00112 
-00113 #if defined(__MINGW32__) && defined(_WINDOWS_H)
-00114 #define _WINDOWS_       // prevent a bug in MinGW32
-00115 #endif // __MINGW32__
-00116 
-00117 #ifndef _WINDOWS_
-00118 #define _WINDOWS_
-00119 
-00120 #ifndef FALSE
-00121 #define FALSE 0
-00122 #endif
-00123 #ifndef TRUE
-00124 #define TRUE 1
-00125 #endif
-00126 #ifndef NULL
-00127 #define NULL 0
-00128 #endif
-00129 
-00130 #ifndef SEEK_SET
-00131 #define SEEK_SET  0
-00132 #define SEEK_CUR  1
-00133 #define SEEK_END  2
-00134 #endif
-00135 
-00136 #ifndef _MSC_VER
-00137 // define portable types for 32-bit / 64-bit OS
-00138 #include <inttypes.h>
-00139 typedef int32_t BOOL;
-00140 typedef uint8_t BYTE;
-00141 typedef uint16_t WORD;
-00142 typedef uint32_t DWORD;
-00143 typedef int32_t LONG;
-00144 #else
-00145 // MS is not C99 ISO compliant
-00146 typedef long BOOL;
-00147 typedef unsigned char BYTE;
-00148 typedef unsigned short WORD;
-00149 typedef unsigned long DWORD;
-00150 typedef long LONG;
-00151 #endif // _MSC_VER
-00152 
-00153 #if (defined(_WIN32) || defined(__WIN32__))
-00154 #pragma pack(push, 1)
-00155 #else
-00156 #pragma pack(1)
-00157 #endif // WIN32
-00158 
-00159 typedef struct tagRGBQUAD {
-00160 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
-00161   BYTE rgbBlue;
-00162   BYTE rgbGreen;
-00163   BYTE rgbRed;
-00164 #else
-00165   BYTE rgbRed;
-00166   BYTE rgbGreen;
-00167   BYTE rgbBlue;
-00168 #endif // FREEIMAGE_COLORORDER
-00169   BYTE rgbReserved;
-00170 } RGBQUAD;
-00171 
-00172 typedef struct tagRGBTRIPLE {
-00173 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
-00174   BYTE rgbtBlue;
-00175   BYTE rgbtGreen;
-00176   BYTE rgbtRed;
-00177 #else
-00178   BYTE rgbtRed;
-00179   BYTE rgbtGreen;
-00180   BYTE rgbtBlue;
-00181 #endif // FREEIMAGE_COLORORDER
-00182 } RGBTRIPLE;
-00183 
-00184 #if (defined(_WIN32) || defined(__WIN32__))
-00185 #pragma pack(pop)
-00186 #else
-00187 #pragma pack()
-00188 #endif // WIN32
-00189 
-00190 typedef struct tagBITMAPINFOHEADER{
-00191   DWORD biSize;
-00192   LONG  biWidth; 
-00193   LONG  biHeight; 
-00194   WORD  biPlanes; 
-00195   WORD  biBitCount;
-00196   DWORD biCompression; 
-00197   DWORD biSizeImage; 
-00198   LONG  biXPelsPerMeter; 
-00199   LONG  biYPelsPerMeter; 
-00200   DWORD biClrUsed; 
-00201   DWORD biClrImportant;
-00202 } BITMAPINFOHEADER, *PBITMAPINFOHEADER; 
-00203 
-00204 typedef struct tagBITMAPINFO { 
-00205   BITMAPINFOHEADER bmiHeader; 
-00206   RGBQUAD          bmiColors[1];
-00207 } BITMAPINFO, *PBITMAPINFO;
-00208 
-00209 #endif // _WINDOWS_
-00210 
-00211 // Types used in the library (specific to FreeImage) ------------------------
-00212 
-00213 #if (defined(_WIN32) || defined(__WIN32__))
-00214 #pragma pack(push, 1)
-00215 #else
-00216 #pragma pack(1)
-00217 #endif // WIN32
-00218 
-00221 typedef struct tagFIRGB16 {
-00222         WORD red;
-00223         WORD green;
-00224         WORD blue;
-00225 } FIRGB16;
-00226 
-00229 typedef struct tagFIRGBA16 {
-00230         WORD red;
-00231         WORD green;
-00232         WORD blue;
-00233         WORD alpha;
-00234 } FIRGBA16;
-00235 
-00238 typedef struct tagFIRGBF {
-00239         float red;
-00240         float green;
-00241         float blue;
-00242 } FIRGBF;
-00243 
-00246 typedef struct tagFIRGBAF {
-00247         float red;
-00248         float green;
-00249         float blue;
-00250         float alpha;
-00251 } FIRGBAF;
-00252 
-00255 typedef struct tagFICOMPLEX {
-00257         double r;
-00259     double i;
-00260 } FICOMPLEX;
-00261 
-00262 #if (defined(_WIN32) || defined(__WIN32__))
-00263 #pragma pack(pop)
-00264 #else
-00265 #pragma pack()
-00266 #endif // WIN32
-00267 
-00268 // Indexes for byte arrays, masks and shifts for treating pixels as words ---
-00269 // These coincide with the order of RGBQUAD and RGBTRIPLE -------------------
-00270 
-00271 #ifndef FREEIMAGE_BIGENDIAN
-00272 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
-00273 // Little Endian (x86 / MS Windows, Linux) : BGR(A) order
-00274 #define FI_RGBA_RED                             2
-00275 #define FI_RGBA_GREEN                   1
-00276 #define FI_RGBA_BLUE                    0
-00277 #define FI_RGBA_ALPHA                   3
-00278 #define FI_RGBA_RED_MASK                0x00FF0000
-00279 #define FI_RGBA_GREEN_MASK              0x0000FF00
-00280 #define FI_RGBA_BLUE_MASK               0x000000FF
-00281 #define FI_RGBA_ALPHA_MASK              0xFF000000
-00282 #define FI_RGBA_RED_SHIFT               16
-00283 #define FI_RGBA_GREEN_SHIFT             8
-00284 #define FI_RGBA_BLUE_SHIFT              0
-00285 #define FI_RGBA_ALPHA_SHIFT             24
-00286 #else
-00287 // Little Endian (x86 / MaxOSX) : RGB(A) order
-00288 #define FI_RGBA_RED                             0
-00289 #define FI_RGBA_GREEN                   1
-00290 #define FI_RGBA_BLUE                    2
-00291 #define FI_RGBA_ALPHA                   3
-00292 #define FI_RGBA_RED_MASK                0x000000FF
-00293 #define FI_RGBA_GREEN_MASK              0x0000FF00
-00294 #define FI_RGBA_BLUE_MASK               0x00FF0000
-00295 #define FI_RGBA_ALPHA_MASK              0xFF000000
-00296 #define FI_RGBA_RED_SHIFT               0
-00297 #define FI_RGBA_GREEN_SHIFT             8
-00298 #define FI_RGBA_BLUE_SHIFT              16
-00299 #define FI_RGBA_ALPHA_SHIFT             24
-00300 #endif // FREEIMAGE_COLORORDER
-00301 #else
-00302 #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
-00303 // Big Endian (PPC / none) : BGR(A) order
-00304 #define FI_RGBA_RED                             2
-00305 #define FI_RGBA_GREEN                   1
-00306 #define FI_RGBA_BLUE                    0
-00307 #define FI_RGBA_ALPHA                   3
-00308 #define FI_RGBA_RED_MASK                0x0000FF00
-00309 #define FI_RGBA_GREEN_MASK              0x00FF0000
-00310 #define FI_RGBA_BLUE_MASK               0xFF000000
-00311 #define FI_RGBA_ALPHA_MASK              0x000000FF
-00312 #define FI_RGBA_RED_SHIFT               8
-00313 #define FI_RGBA_GREEN_SHIFT             16
-00314 #define FI_RGBA_BLUE_SHIFT              24
-00315 #define FI_RGBA_ALPHA_SHIFT             0
-00316 #else
-00317 // Big Endian (PPC / Linux, MaxOSX) : RGB(A) order
-00318 #define FI_RGBA_RED                             0
-00319 #define FI_RGBA_GREEN                   1
-00320 #define FI_RGBA_BLUE                    2
-00321 #define FI_RGBA_ALPHA                   3
-00322 #define FI_RGBA_RED_MASK                0xFF000000
-00323 #define FI_RGBA_GREEN_MASK              0x00FF0000
-00324 #define FI_RGBA_BLUE_MASK               0x0000FF00
-00325 #define FI_RGBA_ALPHA_MASK              0x000000FF
-00326 #define FI_RGBA_RED_SHIFT               24
-00327 #define FI_RGBA_GREEN_SHIFT             16
-00328 #define FI_RGBA_BLUE_SHIFT              8
-00329 #define FI_RGBA_ALPHA_SHIFT             0
-00330 #endif // FREEIMAGE_COLORORDER
-00331 #endif // FREEIMAGE_BIGENDIAN
-00332 
-00333 #define FI_RGBA_RGB_MASK                (FI_RGBA_RED_MASK|FI_RGBA_GREEN_MASK|FI_RGBA_BLUE_MASK)
-00334 
-00335 // The 16bit macros only include masks and shifts, since each color element is not byte aligned
-00336 
-00337 #define FI16_555_RED_MASK               0x7C00
-00338 #define FI16_555_GREEN_MASK             0x03E0
-00339 #define FI16_555_BLUE_MASK              0x001F
-00340 #define FI16_555_RED_SHIFT              10
-00341 #define FI16_555_GREEN_SHIFT    5
-00342 #define FI16_555_BLUE_SHIFT             0
-00343 #define FI16_565_RED_MASK               0xF800
-00344 #define FI16_565_GREEN_MASK             0x07E0
-00345 #define FI16_565_BLUE_MASK              0x001F
-00346 #define FI16_565_RED_SHIFT              11
-00347 #define FI16_565_GREEN_SHIFT    5
-00348 #define FI16_565_BLUE_SHIFT             0
-00349 
-00350 // ICC profile support ------------------------------------------------------
-00351 
-00352 #define FIICC_DEFAULT                   0x00
-00353 #define FIICC_COLOR_IS_CMYK             0x01
-00354 
-00355 FI_STRUCT (FIICCPROFILE) { 
-00356         WORD    flags;  // info flag
-00357         DWORD   size;   // profile's size measured in bytes
-00358         void   *data;   // points to a block of contiguous memory containing the profile
-00359 };
-00360 
-00361 // Important enums ----------------------------------------------------------
-00362 
-00365 FI_ENUM(FREE_IMAGE_FORMAT) {
-00366         FIF_UNKNOWN = -1,
-00367         FIF_BMP         = 0,
-00368         FIF_ICO         = 1,
-00369         FIF_JPEG        = 2,
-00370         FIF_JNG         = 3,
-00371         FIF_KOALA       = 4,
-00372         FIF_LBM         = 5,
-00373         FIF_IFF = FIF_LBM,
-00374         FIF_MNG         = 6,
-00375         FIF_PBM         = 7,
-00376         FIF_PBMRAW      = 8,
-00377         FIF_PCD         = 9,
-00378         FIF_PCX         = 10,
-00379         FIF_PGM         = 11,
-00380         FIF_PGMRAW      = 12,
-00381         FIF_PNG         = 13,
-00382         FIF_PPM         = 14,
-00383         FIF_PPMRAW      = 15,
-00384         FIF_RAS         = 16,
-00385         FIF_TARGA       = 17,
-00386         FIF_TIFF        = 18,
-00387         FIF_WBMP        = 19,
-00388         FIF_PSD         = 20,
-00389         FIF_CUT         = 21,
-00390         FIF_XBM         = 22,
-00391         FIF_XPM         = 23,
-00392         FIF_DDS         = 24,
-00393         FIF_GIF     = 25,
-00394         FIF_HDR         = 26,
-00395         FIF_FAXG3       = 27,
-00396         FIF_SGI         = 28,
-00397         FIF_EXR         = 29,
-00398         FIF_J2K         = 30,
-00399         FIF_JP2         = 31,
-00400         FIF_PFM         = 32,
-00401         FIF_PICT        = 33,
-00402         FIF_RAW         = 34
-00403 };
-00404 
-00407 FI_ENUM(FREE_IMAGE_TYPE) {
-00408         FIT_UNKNOWN = 0,        // unknown type
-00409         FIT_BITMAP  = 1,        // standard image                       : 1-, 4-, 8-, 16-, 24-, 32-bit
-00410         FIT_UINT16      = 2,    // array of unsigned short      : unsigned 16-bit
-00411         FIT_INT16       = 3,    // array of short                       : signed 16-bit
-00412         FIT_UINT32      = 4,    // array of unsigned long       : unsigned 32-bit
-00413         FIT_INT32       = 5,    // array of long                        : signed 32-bit
-00414         FIT_FLOAT       = 6,    // array of float                       : 32-bit IEEE floating point
-00415         FIT_DOUBLE      = 7,    // array of double                      : 64-bit IEEE floating point
-00416         FIT_COMPLEX     = 8,    // array of FICOMPLEX           : 2 x 64-bit IEEE floating point
-00417         FIT_RGB16       = 9,    // 48-bit RGB image                     : 3 x 16-bit
-00418         FIT_RGBA16      = 10,   // 64-bit RGBA image            : 4 x 16-bit
-00419         FIT_RGBF        = 11,   // 96-bit RGB float image       : 3 x 32-bit IEEE floating point
-00420         FIT_RGBAF       = 12    // 128-bit RGBA float image     : 4 x 32-bit IEEE floating point
-00421 };
-00422 
-00425 FI_ENUM(FREE_IMAGE_COLOR_TYPE) {
-00426         FIC_MINISWHITE = 0,             // min value is white
-00427     FIC_MINISBLACK = 1,         // min value is black
-00428     FIC_RGB        = 2,         // RGB color model
-00429     FIC_PALETTE    = 3,         // color map indexed
-00430         FIC_RGBALPHA   = 4,             // RGB color model with alpha channel
-00431         FIC_CMYK       = 5              // CMYK color model
-00432 };
-00433 
-00437 FI_ENUM(FREE_IMAGE_QUANTIZE) {
-00438     FIQ_WUQUANT = 0,            // Xiaolin Wu color quantization algorithm
-00439     FIQ_NNQUANT = 1                     // NeuQuant neural-net quantization algorithm by Anthony Dekker
-00440 };
-00441 
-00445 FI_ENUM(FREE_IMAGE_DITHER) {
-00446     FID_FS                      = 0,    // Floyd & Steinberg error diffusion
-00447         FID_BAYER4x4    = 1,    // Bayer ordered dispersed dot dithering (order 2 dithering matrix)
-00448         FID_BAYER8x8    = 2,    // Bayer ordered dispersed dot dithering (order 3 dithering matrix)
-00449         FID_CLUSTER6x6  = 3,    // Ordered clustered dot dithering (order 3 - 6x6 matrix)
-00450         FID_CLUSTER8x8  = 4,    // Ordered clustered dot dithering (order 4 - 8x8 matrix)
-00451         FID_CLUSTER16x16= 5,    // Ordered clustered dot dithering (order 8 - 16x16 matrix)
-00452         FID_BAYER16x16  = 6             // Bayer ordered dispersed dot dithering (order 4 dithering matrix)
-00453 };
-00454 
-00458 FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
-00459         FIJPEG_OP_NONE                  = 0,    // no transformation
-00460         FIJPEG_OP_FLIP_H                = 1,    // horizontal flip
-00461         FIJPEG_OP_FLIP_V                = 2,    // vertical flip
-00462         FIJPEG_OP_TRANSPOSE             = 3,    // transpose across UL-to-LR axis
-00463         FIJPEG_OP_TRANSVERSE    = 4,    // transpose across UR-to-LL axis
-00464         FIJPEG_OP_ROTATE_90             = 5,    // 90-degree clockwise rotation
-00465         FIJPEG_OP_ROTATE_180    = 6,    // 180-degree rotation
-00466         FIJPEG_OP_ROTATE_270    = 7             // 270-degree clockwise (or 90 ccw)
-00467 };
-00468 
-00472 FI_ENUM(FREE_IMAGE_TMO) {
-00473     FITMO_DRAGO03        = 0,   // Adaptive logarithmic mapping (F. Drago, 2003)
-00474         FITMO_REINHARD05 = 1,   // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005)
-00475         FITMO_FATTAL02   = 2    // Gradient domain high dynamic range compression (R. Fattal, 2002)
-00476 };
-00477 
-00481 FI_ENUM(FREE_IMAGE_FILTER) {
-00482         FILTER_BOX                = 0,  // Box, pulse, Fourier window, 1st order (constant) b-spline
-00483         FILTER_BICUBIC    = 1,  // Mitchell & Netravali's two-param cubic filter
-00484         FILTER_BILINEAR   = 2,  // Bilinear filter
-00485         FILTER_BSPLINE    = 3,  // 4th order (cubic) b-spline
-00486         FILTER_CATMULLROM = 4,  // Catmull-Rom spline, Overhauser spline
-00487         FILTER_LANCZOS3   = 5   // Lanczos3 filter
-00488 };
-00489 
-00493 FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) {
-00494         FICC_RGB        = 0,    // Use red, green and blue channels
-00495         FICC_RED        = 1,    // Use red channel
-00496         FICC_GREEN      = 2,    // Use green channel
-00497         FICC_BLUE       = 3,    // Use blue channel
-00498         FICC_ALPHA      = 4,    // Use alpha channel
-00499         FICC_BLACK      = 5,    // Use black channel
-00500         FICC_REAL       = 6,    // Complex images: use real part
-00501         FICC_IMAG       = 7,    // Complex images: use imaginary part
-00502         FICC_MAG        = 8,    // Complex images: use magnitude
-00503         FICC_PHASE      = 9             // Complex images: use phase
-00504 };
-00505 
-00506 // Metadata support ---------------------------------------------------------
-00507 
-00513 FI_ENUM(FREE_IMAGE_MDTYPE) {
-00514         FIDT_NOTYPE             = 0,    // placeholder 
-00515         FIDT_BYTE               = 1,    // 8-bit unsigned integer 
-00516         FIDT_ASCII              = 2,    // 8-bit bytes w/ last byte null 
-00517         FIDT_SHORT              = 3,    // 16-bit unsigned integer 
-00518         FIDT_LONG               = 4,    // 32-bit unsigned integer 
-00519         FIDT_RATIONAL   = 5,    // 64-bit unsigned fraction 
-00520         FIDT_SBYTE              = 6,    // 8-bit signed integer 
-00521         FIDT_UNDEFINED  = 7,    // 8-bit untyped data 
-00522         FIDT_SSHORT             = 8,    // 16-bit signed integer 
-00523         FIDT_SLONG              = 9,    // 32-bit signed integer 
-00524         FIDT_SRATIONAL  = 10,   // 64-bit signed fraction 
-00525         FIDT_FLOAT              = 11,   // 32-bit IEEE floating point 
-00526         FIDT_DOUBLE             = 12,   // 64-bit IEEE floating point 
-00527         FIDT_IFD                = 13,   // 32-bit unsigned integer (offset) 
-00528         FIDT_PALETTE    = 14    // 32-bit RGBQUAD 
-00529 };
-00530 
-00534 FI_ENUM(FREE_IMAGE_MDMODEL) {
-00535         FIMD_NODATA                     = -1,
-00536         FIMD_COMMENTS           = 0,    // single comment or keywords
-00537         FIMD_EXIF_MAIN          = 1,    // Exif-TIFF metadata
-00538         FIMD_EXIF_EXIF          = 2,    // Exif-specific metadata
-00539         FIMD_EXIF_GPS           = 3,    // Exif GPS metadata
-00540         FIMD_EXIF_MAKERNOTE = 4,        // Exif maker note metadata
-00541         FIMD_EXIF_INTEROP       = 5,    // Exif interoperability metadata
-00542         FIMD_IPTC                       = 6,    // IPTC/NAA metadata
-00543         FIMD_XMP                        = 7,    // Abobe XMP metadata
-00544         FIMD_GEOTIFF            = 8,    // GeoTIFF metadata
-00545         FIMD_ANIMATION          = 9,    // Animation metadata
-00546         FIMD_CUSTOM                     = 10,   // Used to attach other metadata types to a dib
-00547         FIMD_EXIF_RAW           = 11    // Exif metadata as a raw buffer
-00548 };
-00549 
-00553 FI_STRUCT (FIMETADATA) { void *data; };
-00554 
-00558 FI_STRUCT (FITAG) { void *data; };
-00559 
-00560 // File IO routines ---------------------------------------------------------
-00561 
-00562 #ifndef FREEIMAGE_IO
-00563 #define FREEIMAGE_IO
-00564 
-00565 typedef void* fi_handle;
-00566 typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
-00567 typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
-00568 typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin);
-00569 typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle);
-00570 
-00571 #if (defined(_WIN32) || defined(__WIN32__))
-00572 #pragma pack(push, 1)
-00573 #else
-00574 #pragma pack(1)
-00575 #endif // WIN32
-00576 
-00577 FI_STRUCT(FreeImageIO) {
-00578         FI_ReadProc  read_proc;     // pointer to the function used to read data
-00579     FI_WriteProc write_proc;    // pointer to the function used to write data
-00580     FI_SeekProc  seek_proc;     // pointer to the function used to seek
-00581     FI_TellProc  tell_proc;     // pointer to the function used to aquire the current position
-00582 };
-00583 
-00584 #if (defined(_WIN32) || defined(__WIN32__))
-00585 #pragma pack(pop)
-00586 #else
-00587 #pragma pack()
-00588 #endif // WIN32
-00589 
-00593 FI_STRUCT (FIMEMORY) { void *data; };
-00594 
-00595 #endif // FREEIMAGE_IO
-00596 
-00597 // Plugin routines ----------------------------------------------------------
-00598 
-00599 #ifndef PLUGINS
-00600 #define PLUGINS
-00601 
-00602 typedef const char *(DLL_CALLCONV *FI_FormatProc)(void);
-00603 typedef const char *(DLL_CALLCONV *FI_DescriptionProc)(void);
-00604 typedef const char *(DLL_CALLCONV *FI_ExtensionListProc)(void);
-00605 typedef const char *(DLL_CALLCONV *FI_RegExprProc)(void);
-00606 typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read);
-00607 typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data);
-00608 typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data);
-00609 typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data);
-00610 typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data);
-00611 typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data);
-00612 typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle);
-00613 typedef const char *(DLL_CALLCONV *FI_MimeProc)(void);
-00614 typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp);
-00615 typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type);
-00616 typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(void);
-00617 typedef BOOL (DLL_CALLCONV *FI_SupportsNoPixelsProc)(void);
-00618 
-00619 FI_STRUCT (Plugin) {
-00620         FI_FormatProc format_proc;
-00621         FI_DescriptionProc description_proc;
-00622         FI_ExtensionListProc extension_proc;
-00623         FI_RegExprProc regexpr_proc;
-00624         FI_OpenProc open_proc;
-00625         FI_CloseProc close_proc;
-00626         FI_PageCountProc pagecount_proc;
-00627         FI_PageCapabilityProc pagecapability_proc;
-00628         FI_LoadProc load_proc;
-00629         FI_SaveProc save_proc;
-00630         FI_ValidateProc validate_proc;
-00631         FI_MimeProc mime_proc;
-00632         FI_SupportsExportBPPProc supports_export_bpp_proc;
-00633         FI_SupportsExportTypeProc supports_export_type_proc;
-00634         FI_SupportsICCProfilesProc supports_icc_profiles_proc;
-00635         FI_SupportsNoPixelsProc supports_no_pixels_proc;
-00636 };
-00637 
-00638 typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id);
-00639 
-00640 #endif // PLUGINS
-00641 
-00642 
-00643 // Load / Save flag constants -----------------------------------------------
-00644 
-00645 #define FIF_LOAD_NOPIXELS 0x8000 // loading: load the image header only (not supported by all plugins)
-00646 
-00647 #define BMP_DEFAULT         0
-00648 #define BMP_SAVE_RLE        1
-00649 #define CUT_DEFAULT         0
-00650 #define DDS_DEFAULT                     0
-00651 #define EXR_DEFAULT                     0               // save data as half with piz-based wavelet compression
-00652 #define EXR_FLOAT                       0x0001  // save data as float instead of as half (not recommended)
-00653 #define EXR_NONE                        0x0002  // save with no compression
-00654 #define EXR_ZIP                         0x0004  // save with zlib compression, in blocks of 16 scan lines
-00655 #define EXR_PIZ                         0x0008  // save with piz-based wavelet compression
-00656 #define EXR_PXR24                       0x0010  // save with lossy 24-bit float compression
-00657 #define EXR_B44                         0x0020  // save with lossy 44% float compression - goes to 22% when combined with EXR_LC
-00658 #define EXR_LC                          0x0040  // save images with one luminance and two chroma channels, rather than as RGB (lossy compression)
-00659 #define FAXG3_DEFAULT           0
-00660 #define GIF_DEFAULT                     0
-00661 #define GIF_LOAD256                     1               // Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color
-00662 #define GIF_PLAYBACK            2               // 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading
-00663 #define HDR_DEFAULT                     0
-00664 #define ICO_DEFAULT         0
-00665 #define ICO_MAKEALPHA           1               // convert to 32bpp and create an alpha channel from the AND-mask when loading
-00666 #define IFF_DEFAULT         0
-00667 #define J2K_DEFAULT                     0               // save with a 16:1 rate
-00668 #define JP2_DEFAULT                     0               // save with a 16:1 rate
-00669 #define JPEG_DEFAULT        0           // loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420)
-00670 #define JPEG_FAST           0x0001      // load the file as fast as possible, sacrificing some quality
-00671 #define JPEG_ACCURATE       0x0002      // load the file with the best quality, sacrificing some speed
-00672 #define JPEG_CMYK                       0x0004  // load separated CMYK "as is" (use | to combine with other load flags)
-00673 #define JPEG_EXIFROTATE         0x0008  // load and rotate according to Exif 'Orientation' tag if available
-00674 #define JPEG_QUALITYSUPERB  0x80        // save with superb quality (100:1)
-00675 #define JPEG_QUALITYGOOD    0x0100      // save with good quality (75:1)
-00676 #define JPEG_QUALITYNORMAL  0x0200      // save with normal quality (50:1)
-00677 #define JPEG_QUALITYAVERAGE 0x0400      // save with average quality (25:1)
-00678 #define JPEG_QUALITYBAD     0x0800      // save with bad quality (10:1)
-00679 #define JPEG_PROGRESSIVE        0x2000  // save as a progressive-JPEG (use | to combine with other save flags)
-00680 #define JPEG_SUBSAMPLING_411 0x1000             // save with high 4x1 chroma subsampling (4:1:1) 
-00681 #define JPEG_SUBSAMPLING_420 0x4000             // save with medium 2x2 medium chroma subsampling (4:2:0) - default value
-00682 #define JPEG_SUBSAMPLING_422 0x8000             // save with low 2x1 chroma subsampling (4:2:2) 
-00683 #define JPEG_SUBSAMPLING_444 0x10000    // save with no chroma subsampling (4:4:4)
-00684 #define JPEG_OPTIMIZE           0x20000         // on saving, compute optimal Huffman coding tables (can reduce a few percent of file size)
-00685 #define KOALA_DEFAULT       0
-00686 #define LBM_DEFAULT         0
-00687 #define MNG_DEFAULT         0
-00688 #define PCD_DEFAULT         0
-00689 #define PCD_BASE            1           // load the bitmap sized 768 x 512
-00690 #define PCD_BASEDIV4        2           // load the bitmap sized 384 x 256
-00691 #define PCD_BASEDIV16       3           // load the bitmap sized 192 x 128
-00692 #define PCX_DEFAULT         0
-00693 #define PFM_DEFAULT         0
-00694 #define PICT_DEFAULT        0
-00695 #define PNG_DEFAULT         0
-00696 #define PNG_IGNOREGAMMA         1               // loading: avoid gamma correction
-00697 #define PNG_Z_BEST_SPEED                        0x0001  // save using ZLib level 1 compression flag (default value is 6)
-00698 #define PNG_Z_DEFAULT_COMPRESSION       0x0006  // save using ZLib level 6 compression flag (default recommended value)
-00699 #define PNG_Z_BEST_COMPRESSION          0x0009  // save using ZLib level 9 compression flag (default value is 6)
-00700 #define PNG_Z_NO_COMPRESSION            0x0100  // save without ZLib compression
-00701 #define PNG_INTERLACED                          0x0200  // save using Adam7 interlacing (use | to combine with other save flags)
-00702 #define PNM_DEFAULT         0
-00703 #define PNM_SAVE_RAW        0       // If set the writer saves in RAW format (i.e. P4, P5 or P6)
-00704 #define PNM_SAVE_ASCII      1       // If set the writer saves in ASCII format (i.e. P1, P2 or P3)
-00705 #define PSD_DEFAULT         0
-00706 #define PSD_CMYK                        1               // reads tags for separated CMYK (default is conversion to RGB)
-00707 #define PSD_LAB                         2               // reads tags for CIELab (default is conversion to RGB)
-00708 #define RAS_DEFAULT         0
-00709 #define RAW_DEFAULT         0           // load the file as linear RGB 48-bit
-00710 #define RAW_PREVIEW                     1               // try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit
-00711 #define RAW_DISPLAY                     2               // load the file as RGB 24-bit
-00712 #define SGI_DEFAULT                     0
-00713 #define TARGA_DEFAULT       0
-00714 #define TARGA_LOAD_RGB888   1       // If set the loader converts RGB555 and ARGB8888 -> RGB888.
-00715 #define TARGA_SAVE_RLE          2               // If set, the writer saves with RLE compression
-00716 #define TIFF_DEFAULT        0
-00717 #define TIFF_CMYK                       0x0001  // reads/stores tags for separated CMYK (use | to combine with compression flags)
-00718 #define TIFF_PACKBITS       0x0100  // save using PACKBITS compression
-00719 #define TIFF_DEFLATE        0x0200  // save using DEFLATE compression (a.k.a. ZLIB compression)
-00720 #define TIFF_ADOBE_DEFLATE  0x0400  // save using ADOBE DEFLATE compression
-00721 #define TIFF_NONE           0x0800  // save without any compression
-00722 #define TIFF_CCITTFAX3          0x1000  // save using CCITT Group 3 fax encoding
-00723 #define TIFF_CCITTFAX4          0x2000  // save using CCITT Group 4 fax encoding
-00724 #define TIFF_LZW                        0x4000  // save using LZW compression
-00725 #define TIFF_JPEG                       0x8000  // save using JPEG compression
-00726 #define TIFF_LOGLUV                     0x10000 // save using LogLuv compression
-00727 #define WBMP_DEFAULT        0
-00728 #define XBM_DEFAULT                     0
-00729 #define XPM_DEFAULT                     0
-00730 
-00731 // Background filling options ---------------------------------------------------------
-00732 // Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas
-00733 
-00734 #define FI_COLOR_IS_RGB_COLOR                   0x00    // RGBQUAD color is a RGB color (contains no valid alpha channel)
-00735 #define FI_COLOR_IS_RGBA_COLOR                  0x01    // RGBQUAD color is a RGBA color (contains a valid alpha channel)
-00736 #define FI_COLOR_FIND_EQUAL_COLOR               0x02    // For palettized images: lookup equal RGB color from palette
-00737 #define FI_COLOR_ALPHA_IS_INDEX                 0x04    // The color's rgbReserved member (alpha) contains the palette index to be used
-00738 #define FI_COLOR_PALETTE_SEARCH_MASK    (FI_COLOR_FIND_EQUAL_COLOR | FI_COLOR_ALPHA_IS_INDEX)   // No color lookup is performed
-00739 
-00740 
-00741 #ifdef __cplusplus
-00742 extern "C" {
-00743 #endif
-00744 
-00745 // Init / Error routines ----------------------------------------------------
-00746 
-00747 DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE));
-00748 DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void);
-00749 
-00750 // Version routines ---------------------------------------------------------
-00751 
-00752 DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void);
-00753 DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void);
-00754 
-00755 // Message output functions -------------------------------------------------
-00756 
-00757 typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg);
-00758 typedef void (DLL_CALLCONV *FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT fif, const char *msg); 
-00759 
-00760 DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf); 
-00761 DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf);
-00762 DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...);
-00763 
-00764 // Allocate / Clone / Unload routines ---------------------------------------
-00765 
-00766 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
-00767 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp FI_DEFAULT(8), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
-00768 DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib);
-00769 DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib);
-00770 
-00771 // Header loading routines
-00772 DLL_API BOOL DLL_CALLCONV FreeImage_HasPixels(FIBITMAP *dib);
-00773 
-00774 // Load / Save routines -----------------------------------------------------
-00775 
-00776 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0));
-00777 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0));
-00778 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
-00779 DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0));
-00780 DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0));
-00781 DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
-00782 
-00783 // Memory I/O stream routines -----------------------------------------------
-00784 
-00785 DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0));
-00786 DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream);
-00787 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
-00788 DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0));
-00789 DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream);
-00790 DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin);
-00791 DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes);
-00792 DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
-00793 DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
-00794 
-00795 DLL_API FIMULTIBITMAP *DLL_CALLCONV FreeImage_LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
-00796 DLL_API BOOL DLL_CALLCONV FreeImage_SaveMultiBitmapToMemory(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, FIMEMORY *stream, int flags);
-00797 
-00798 // Plugin Interface ---------------------------------------------------------
-00799 
-00800 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterLocalPlugin(FI_InitProc proc_address, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0));
-00801 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterExternalPlugin(const char *path, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0));
-00802 DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void);
-00803 DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable);
-00804 DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif);
-00805 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format);
-00806 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime);
-00807 DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif);
-00808 DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif);
-00809 DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif);
-00810 DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif);
-00811 DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif);
-00812 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename);
-00813 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename);
-00814 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif);
-00815 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif);
-00816 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp);
-00817 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type);
-00818 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif);
-00819 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsNoPixels(FREE_IMAGE_FORMAT fif);
-00820 
-00821 // Multipaging interface ----------------------------------------------------
-00822 
-00823 DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL create_new, BOOL read_only, BOOL keep_cache_in_memory FI_DEFAULT(FALSE), int flags FI_DEFAULT(0));
-00824 DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
-00825 DLL_API BOOL DLL_CALLCONV FreeImage_SaveMultiBitmapToHandle(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
-00826 DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0));
-00827 DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap);
-00828 DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data);
-00829 DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data);
-00830 DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page);
-00831 DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page);
-00832 DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *data, BOOL changed);
-00833 DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source);
-00834 DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count);
-00835 
-00836 // Filetype request routines ------------------------------------------------
-00837 
-00838 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0));
-00839 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0));
-00840 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0));
-00841 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0));
-00842 
-00843 // Image type request routine -----------------------------------------------
-00844 
-00845 DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib);
-00846 
-00847 // FreeImage helper routines ------------------------------------------------
-00848 
-00849 DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void);
-00850 DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
-00851 DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
-00852 
-00853 // Pixel access routines ----------------------------------------------------
-00854 
-00855 DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib);
-00856 DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline);
-00857 
-00858 DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
-00859 DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
-00860 DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
-00861 DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
-00862 
-00863 // DIB info routines --------------------------------------------------------
-00864 
-00865 DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib);
-00866 DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib);
-00867 DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib);
-00868 DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib);
-00869 DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib);
-00870 DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib);
-00871 DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib);
-00872 DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib);
-00873 
-00874 DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib);
-00875 DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib);
-00876 DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res);
-00877 DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res);
-00878 
-00879 DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib);
-00880 DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib);
-00881 DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib);
-00882 
-00883 DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib);
-00884 DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib);
-00885 DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib);
-00886 
-00887 DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib);
-00888 DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib);
-00889 DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled);
-00890 DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count);
-00891 DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib);
-00892 DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index);
-00893 DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib);
-00894 
-00895 DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib);
-00896 DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
-00897 DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
-00898 
-00899 
-00900 // ICC profile routines -----------------------------------------------------
-00901 
-00902 DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib);
-00903 DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size);
-00904 DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib);
-00905 
-00906 // Line conversion routines -------------------------------------------------
-00907 
-00908 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels);
-00909 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00910 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels);
-00911 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels);
-00912 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels);
-00913 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels);
-00914 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels);
-00915 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels);
-00916 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels);
-00917 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels);
-00918 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels);
-00919 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels);
-00920 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00921 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00922 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00923 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels);
-00924 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels);
-00925 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels);
-00926 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00927 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00928 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00929 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels);
-00930 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels);
-00931 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels);
-00932 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00933 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00934 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00935 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels);
-00936 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels);
-00937 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels);
-00938 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00939 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00940 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
-00941 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels);
-00942 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels);
-00943 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels);
-00944 
-00945 // Smart conversion routines ------------------------------------------------
-00946 
-00947 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo4Bits(FIBITMAP *dib);
-00948 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib);
-00949 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToGreyscale(FIBITMAP *dib);
-00950 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib);
-00951 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib);
-00952 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib);
-00953 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib);
-00954 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize);
-00955 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize FI_DEFAULT(FIQ_WUQUANT), int PaletteSize FI_DEFAULT(256), int ReserveSize FI_DEFAULT(0), RGBQUAD *ReservePalette FI_DEFAULT(NULL));
-00956 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T);
-00957 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm);
-00958 
-00959 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
-00960 DLL_API void DLL_CALLCONV FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
-00961 
-00962 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToFloat(FIBITMAP *dib);
-00963 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib);
-00964 
-00965 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear FI_DEFAULT(TRUE));
-00966 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear FI_DEFAULT(TRUE));
-00967 
-00968 // tone mapping operators
-00969 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param FI_DEFAULT(0), double second_param FI_DEFAULT(0));
-00970 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0));
-00971 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0));
-00972 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05Ex(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0), double adaptation FI_DEFAULT(1), double color_correction FI_DEFAULT(0));
-00973 
-00974 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color_saturation FI_DEFAULT(0.5), double attenuation FI_DEFAULT(0.85));
-00975 
-00976 // ZLib interface -----------------------------------------------------------
-00977 
-00978 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
-00979 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
-00980 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
-00981 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
-00982 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size);
-00983 
-00984 // --------------------------------------------------------------------------
-00985 // Metadata routines --------------------------------------------------------
-00986 // --------------------------------------------------------------------------
-00987 
-00988 // tag creation / destruction
-00989 DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag(void);
-00990 DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag);
-00991 DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag);
-00992 
-00993 // tag getters and setters
-00994 DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag);
-00995 DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag);
-00996 DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag);
-00997 DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag);
-00998 DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag);
-00999 DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag);
-01000 DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag);
-01001 
-01002 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key);
-01003 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagDescription(FITAG *tag, const char *description);
-01004 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagID(FITAG *tag, WORD id);
-01005 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagType(FITAG *tag, FREE_IMAGE_MDTYPE type);
-01006 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagCount(FITAG *tag, DWORD count);
-01007 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagLength(FITAG *tag, DWORD length);
-01008 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagValue(FITAG *tag, const void *value);
-01009 
-01010 // iterator
-01011 DLL_API FIMETADATA *DLL_CALLCONV FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag);
-01012 DLL_API BOOL DLL_CALLCONV FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag);
-01013 DLL_API void DLL_CALLCONV FreeImage_FindCloseMetadata(FIMETADATA *mdhandle);
-01014 
-01015 // metadata setter and getter
-01016 DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag);
-01017 DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag);
-01018 
-01019 // helpers
-01020 DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib);
-01021 DLL_API BOOL DLL_CALLCONV FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src);
-01022 
-01023 // tag to C string conversion
-01024 DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL));
-01025 
-01026 // --------------------------------------------------------------------------
-01027 // Image manipulation toolkit -----------------------------------------------
-01028 // --------------------------------------------------------------------------
-01029 
-01030 // rotation and flipping
-01032 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle);
-01033 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor FI_DEFAULT(NULL));
-01034 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask);
-01035 DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib);
-01036 DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib);
-01037 DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE));
-01038 DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE));
-01039 
-01040 // upsampling / downsampling
-01041 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter);
-01042 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert FI_DEFAULT(TRUE));
-01043 
-01044 // color manipulation routines (point operations)
-01045 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel);
-01046 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma);
-01047 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage);
-01048 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage);
-01049 DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib);
-01050 DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK));
-01051 DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert);
-01052 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert FI_DEFAULT(FALSE));
-01053 DLL_API unsigned DLL_CALLCONV FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolors, unsigned count, BOOL ignore_alpha, BOOL swap);
-01054 DLL_API unsigned DLL_CALLCONV FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ignore_alpha);
-01055 DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices,       BYTE *dstindices, unsigned count, BOOL swap);
-01056 DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b);
-01057 
-01058 // channel processing routines
-01059 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel);
-01060 DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
-01061 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
-01062 DLL_API BOOL DLL_CALLCONV FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
-01063 
-01064 // copy / paste / composite routines
-01065 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom);
-01066 DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha);
-01067 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL));
-01068 DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
-01069 DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCropU(const wchar_t *src_file, const wchar_t *dst_file, int left, int top, int right, int bottom);
-01070 DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib);
-01071 
-01072 // background filling routines
-01073 DLL_API BOOL DLL_CALLCONV FreeImage_FillBackground(FIBITMAP *dib, const void *color, int options FI_DEFAULT(0));
-01074 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_EnlargeCanvas(FIBITMAP *src, int left, int top, int right, int bottom, const void *color, int options FI_DEFAULT(0));
-01075 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateEx(int width, int height, int bpp, const RGBQUAD *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
-01076 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, const void *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
-01077 
-01078 // miscellaneous algorithms
-01079 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle FI_DEFAULT(3));
-01080 
-01081 // restore the borland-specific enum size option
-01082 #if defined(__BORLANDC__)
-01083 #pragma option pop
-01084 #endif
-01085 
-01086 #ifdef __cplusplus
-01087 }
-01088 #endif
-01089 
-01090 #endif // FREEIMAGE_H
-

-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/annotated.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/annotated.html deleted file mode 100644 index 2f9c851..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/annotated.html +++ /dev/null @@ -1,44 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

FreeImagePlus Class List

Here are the classes, structs, unions and interfaces with brief descriptions: - - - - - - - - - - - - -
fipImageA class used to manage all photo related images and all image types used by the library
fipMemoryIOMemory handle
fipMetadataFindMetadata iterator
fipMultiPageMulti-page file stream
fipObjectAbstract base class for all objects used by the library
fipTagFreeImage Tag
fipWinImageA class designed for MS Windows (TM) platforms
tagFICOMPLEXData structure for COMPLEX type (complex number)
tagFIRGB1648-bit RGB
tagFIRGBA1664-bit RGBA
tagFIRGBAF128-bit RGBA Float
tagFIRGBF96-bit RGB Float
-
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classes.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classes.html deleted file mode 100644 index 18ee232..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classes.html +++ /dev/null @@ -1,35 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

FreeImagePlus Class Index

F | T

- -
  F  
-
fipMetadataFind   fipTag   tagFICOMPLEX   tagFIRGBAF   
fipImage   fipMultiPage   fipWinImage   tagFIRGB16   tagFIRGBF   
fipMemoryIO   fipObject   
  T  
-
tagFIRGBA16   

F | T

-


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipImage-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipImage-members.html deleted file mode 100644 index e0d6881..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipImage-members.html +++ /dev/null @@ -1,127 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipImage Member List

This is the complete list of members for fipImage, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_bHasChangedfipImage [mutable, protected]
_dibfipImage [protected]
_fiffipImage [protected]
accessPixels() const fipImage
adjustBrightness(double percentage)fipImage
adjustBrightnessContrastGamma(double brightness, double contrast, double gamma)fipImage
adjustContrast(double percentage)fipImage
adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel)fipImage
adjustGamma(double gamma)fipImage
clear()fipImage [virtual]
colorQuantize(FREE_IMAGE_QUANTIZE algorithm)fipImage
combineChannels(fipImage &red, fipImage &green, fipImage &blue)fipImage
convertTo16Bits555()fipImage
convertTo16Bits565()fipImage
convertTo24Bits()fipImage
convertTo32Bits()fipImage
convertTo4Bits()fipImage
convertTo8Bits()fipImage
convertToGrayscale()fipImage
convertToRGBF()fipImage
convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear=TRUE)fipImage
copySubImage(fipImage &dst, int left, int top, int right, int bottom) const fipImage
crop(int left, int top, int right, int bottom)fipImage
dither(FREE_IMAGE_DITHER algorithm)fipImage
fipImage(FREE_IMAGE_TYPE image_type=FIT_BITMAP, unsigned width=0, unsigned height=0, unsigned bpp=0)fipImage
fipImage(const fipImage &src)fipImage
fipMultiPage (defined in fipImage)fipImage [friend]
flipHorizontal()fipImage
flipVertical()fipImage
getBitsPerPixel() const fipImage
getChannel(fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel) const fipImage
getColorsUsed() const fipImage
getColorType() const fipImage
getFileBkColor(RGBQUAD *bkcolor) const fipImage
getHeight() const fipImage
getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel=FICC_BLACK) const fipImage
getHorizontalResolution() const fipImage
getImageSize() const fipImage
getImageType() const fipImage
getInfo() const fipImage
getInfoHeader() const fipImage
getLine() const fipImage
getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag) const fipImage
getMetadataCount(FREE_IMAGE_MDMODEL model) const fipImage
getPalette() const fipImage
getPaletteSize() const fipImage
getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const fipImage
getPixelIndex(unsigned x, unsigned y, BYTE *value) const fipImage
getScanLine(unsigned scanline) const fipImage
getScanWidth() const fipImage
getTransparencyCount() const fipImage
getTransparencyTable() const fipImage
getVerticalResolution() const fipImage
getWidth() const fipImage
hasFileBkColor() const fipImage
identifyFIF(const char *lpszPathName)fipImage [static]
identifyFIFFromHandle(FreeImageIO *io, fi_handle handle)fipImage [static]
identifyFIFFromMemory(FIMEMORY *hmem)fipImage [static]
identifyFIFU(const wchar_t *lpszPathName)fipImage [static]
invert()fipImage
isGrayscale() const fipImage
isModified()fipImage [inline]
isTransparent() const fipImage
isValid() const fipImage [virtual]
load(const char *lpszPathName, int flag=0)fipImage
loadFromHandle(FreeImageIO *io, fi_handle handle, int flag=0)fipImage
loadFromMemory(fipMemoryIO &memIO, int flag=0)fipImage
loadU(const wchar_t *lpszPathName, int flag=0)fipImage
makeThumbnail(unsigned max_size, BOOL convert=TRUE)fipImage
operator FIBITMAP *()fipImage [inline]
operator=(const fipImage &src)fipImage
operator=(FIBITMAP *dib)fipImage
pasteSubImage(fipImage &src, int left, int top, int alpha=256)fipImage
replace(FIBITMAP *new_dib) (defined in fipImage)fipImage [protected]
rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter)fipImage
rotate(double angle, const void *bkcolor=NULL)fipImage
rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask)fipImage
save(const char *lpszPathName, int flag=0) const fipImage
saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag=0) const fipImage
saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flag=0) const fipImage
saveU(const wchar_t *lpszPathName, int flag=0) const fipImage
setChannel(fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel)fipImage
setFileBkColor(RGBQUAD *bkcolor)fipImage
setHorizontalResolution(double value)fipImage
setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag)fipImage
setModified(BOOL bStatus=TRUE)fipImage [inline]
setPixelColor(unsigned x, unsigned y, RGBQUAD *value)fipImage
setPixelIndex(unsigned x, unsigned y, BYTE *value)fipImage
setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask=0, unsigned green_mask=0, unsigned blue_mask=0)fipImage
setTransparencyTable(BYTE *table, int count)fipImage
setVerticalResolution(double value)fipImage
splitChannels(fipImage &RedChannel, fipImage &GreenChannel, fipImage &BlueChannel)fipImage
threshold(BYTE T)fipImage
toneMapping(FREE_IMAGE_TMO tmo, double first_param=0, double second_param=0, double third_param=1, double fourth_param=0)fipImage
~fipImage()fipImage [virtual]
~fipObject()fipObject [inline, virtual]


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipImage.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipImage.html deleted file mode 100644 index 30e6737..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipImage.html +++ /dev/null @@ -1,3226 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipImage Class Reference

#include <FreeImagePlus.h> -

-

-Inheritance diagram for fipImage:
-
- -

- -fipObject -fipWinImage - -
- -

-List of all members.


Detailed Description

-A class used to manage all photo related images and all image types used by the library. -

-fipImage encapsulates the FIBITMAP format. It relies on the FreeImage library, especially for loading / saving images and for bit depth conversion.

Version:
FreeImage 3
-
Author:
Herv Drolon
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

Creation & Destruction
 fipImage (FREE_IMAGE_TYPE image_type=FIT_BITMAP, unsigned width=0, unsigned height=0, unsigned bpp=0)
 Constructor.
virtual ~fipImage ()
 Destructor.
BOOL setSize (FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask=0, unsigned green_mask=0, unsigned blue_mask=0)
 Image allocator.
virtual void clear ()
 Destroy image data.
Copying
 fipImage (const fipImage &src)
 Copy constructor.
fipImageoperator= (const fipImage &src)
 Copy constructor.
fipImageoperator= (FIBITMAP *dib)
 Assignement operator</b>
- Copy the input pointer and manage its destruction

BOOL copySubImage (fipImage &dst, int left, int top, int right, int bottom) const
BOOL pasteSubImage (fipImage &src, int left, int top, int alpha=256)
BOOL crop (int left, int top, int right, int bottom)
Loading & Saving
Loading and saving is handled by the FreeImage library.

BOOL load (const char *lpszPathName, int flag=0)
BOOL loadU (const wchar_t *lpszPathName, int flag=0)
 UNICODE version of load (this function only works under WIN32 and does nothing on other OS).
BOOL loadFromHandle (FreeImageIO *io, fi_handle handle, int flag=0)
BOOL loadFromMemory (fipMemoryIO &memIO, int flag=0)
BOOL save (const char *lpszPathName, int flag=0) const
BOOL saveU (const wchar_t *lpszPathName, int flag=0) const
 UNICODE version of save (this function only works under WIN32 and does nothing on other OS).
BOOL saveToHandle (FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag=0) const
BOOL saveToMemory (FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flag=0) const
Information functions
Accessors to the DIB BITMAPINFO structure.

FREE_IMAGE_TYPE getImageType () const
 Returns the data type of the image.
unsigned getWidth () const
 Returns the image width in pixels.
unsigned getHeight () const
 Returns the image height in pixels.
unsigned getScanWidth () const
 Returns the width of the bitmap in bytes rounded to the nearest DWORD.
 operator FIBITMAP * ()
 Returns a pointer to the FIBITMAP data.
BOOL isValid () const
 Returns TRUE if the image is allocated, FALSE otherwise.
BITMAPINFO * getInfo () const
 Returns a pointer to the bitmap's BITMAPINFO header.
BITMAPINFOHEADER * getInfoHeader () const
 Returns a pointer to the bitmap's BITMAPINFOHEADER.
LONG getImageSize () const
 Returns the size of the bitmap in bytes.
unsigned getBitsPerPixel () const
 Returns the bitdepth of the bitmap.
unsigned getLine () const
 Returns the width of the bitmap in bytes.
double getHorizontalResolution () const
 Returns the bitmap resolution along the X axis, in pixels / cm.
double getVerticalResolution () const
 Returns the bitmap resolution along the Y axis, in pixels / cm.
void setHorizontalResolution (double value)
 set the bitmap resolution along the X axis, in pixels / cm
void setVerticalResolution (double value)
 set the bitmap resolution along the Y axis, in pixels / cm
Palette operations
RGBQUAD * getPalette () const
 Returns a pointer to the bitmap's palette.
unsigned getPaletteSize () const
 Returns the palette size in bytes.
unsigned getColorsUsed () const
 Retrieves the number of colours used in the bitmap.
FREE_IMAGE_COLOR_TYPE getColorType () const
 Investigates the colour type of the bitmap.
BOOL isGrayscale () const
 Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise.
Pixel access
BYTE * accessPixels () const
BYTE * getScanLine (unsigned scanline) const
BOOL getPixelIndex (unsigned x, unsigned y, BYTE *value) const
 Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access).
BOOL getPixelColor (unsigned x, unsigned y, RGBQUAD *value) const
 Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access).
BOOL setPixelIndex (unsigned x, unsigned y, BYTE *value)
 Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access).
BOOL setPixelColor (unsigned x, unsigned y, RGBQUAD *value)
 Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access).
Conversion routines
Bitmaps are always loaded in their default bit depth.

-If you want the bitmap to be stored in another bit depth, the class provides several conversion functions.

BOOL convertToType (FREE_IMAGE_TYPE image_type, BOOL scale_linear=TRUE)
 Converts an image to a type supported by FreeImage.
BOOL threshold (BYTE T)
 Converts the bitmap to 1 bit using a threshold T.
BOOL dither (FREE_IMAGE_DITHER algorithm)
 Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm.
BOOL convertTo4Bits ()
 Converts the bitmap to 4 bits.
BOOL convertTo8Bits ()
 Converts the bitmap to 8 bits.
BOOL convertToGrayscale ()
 Converts the bitmap to 8 bits.
BOOL colorQuantize (FREE_IMAGE_QUANTIZE algorithm)
 Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap.
BOOL convertTo16Bits555 ()
 Converts the bitmap to 16 bits.
BOOL convertTo16Bits565 ()
 Converts the bitmap to 16 bits.
BOOL convertTo24Bits ()
 Converts the bitmap to 24 bits.
BOOL convertTo32Bits ()
 Converts the bitmap to 32 bits.
BOOL convertToRGBF ()
 Converts the bitmap to a 96-bit RGBF image.
BOOL toneMapping (FREE_IMAGE_TMO tmo, double first_param=0, double second_param=0, double third_param=1, double fourth_param=0)
 Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image.
Transparency support: background colour and alpha channel
BOOL isTransparent () const
 Returns TRUE if the image is transparent, returns FALSE otherwise.
unsigned getTransparencyCount () const
 8-bit transparency : get the number of transparent colors.
BYTE * getTransparencyTable () const
 8-bit transparency : get the bitmaps transparency table.
void setTransparencyTable (BYTE *table, int count)
 8-bit transparency : set the bitmaps transparency table.
BOOL hasFileBkColor () const
 Returns TRUE when the image has a file background color, FALSE otherwise.
BOOL getFileBkColor (RGBQUAD *bkcolor) const
BOOL setFileBkColor (RGBQUAD *bkcolor)
Channel processing support
BOOL getChannel (fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel) const
BOOL setChannel (fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel)
BOOL splitChannels (fipImage &RedChannel, fipImage &GreenChannel, fipImage &BlueChannel)
BOOL combineChannels (fipImage &red, fipImage &green, fipImage &blue)
Rotation and flipping
BOOL rotateEx (double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask)
 Image translation and rotation using B-Splines.
BOOL rotate (double angle, const void *bkcolor=NULL)
 Image rotation by means of three shears.
BOOL flipHorizontal ()
 Flip the image horizontally along the vertical axis.
BOOL flipVertical ()
 Flip the image vertically along the horizontal axis.
Color manipulation routines
BOOL invert ()
 Inverts each pixel data.
BOOL adjustCurve (BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel)
BOOL adjustGamma (double gamma)
BOOL adjustBrightness (double percentage)
BOOL adjustContrast (double percentage)
BOOL adjustBrightnessContrastGamma (double brightness, double contrast, double gamma)
 Adjusts an image's brightness, contrast and gamma within a single operation.
BOOL getHistogram (DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel=FICC_BLACK) const
Upsampling / downsampling
BOOL rescale (unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter)
BOOL makeThumbnail (unsigned max_size, BOOL convert=TRUE)
Image status
void setModified (BOOL bStatus=TRUE)
 Set the image status as 'modified'.
BOOL isModified ()
 Get the image status.
Metadata
unsigned getMetadataCount (FREE_IMAGE_MDMODEL model) const
 Returns the number of tags contained in the model metadata model attached to the dib.
BOOL getMetadata (FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag) const
 Retrieve a metadata attached to the dib.
BOOL setMetadata (FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag)
 Attach a new FreeImage tag to the dib.

Static Public Member Functions

File type identification
static FREE_IMAGE_FORMAT identifyFIF (const char *lpszPathName)
static FREE_IMAGE_FORMAT identifyFIFU (const wchar_t *lpszPathName)
 UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS).
static FREE_IMAGE_FORMAT identifyFIFFromHandle (FreeImageIO *io, fi_handle handle)
static FREE_IMAGE_FORMAT identifyFIFFromMemory (FIMEMORY *hmem)

Protected Member Functions

Internal use
-BOOL replace (FIBITMAP *new_dib)

Protected Attributes

FIBITMAP * _dib
 DIB data.
FREE_IMAGE_FORMAT _fif
 Original (or last saved) fif format if available, FIF_UNKNOWN otherwise.
BOOL _bHasChanged
 TRUE whenever the display need to be refreshed.

Friends

-class fipMultiPage
-

Constructor & Destructor Documentation

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fipImage::fipImage (FREE_IMAGE_TYPE  image_type = FIT_BITMAP,
unsigned  width = 0,
unsigned  height = 0,
unsigned  bpp = 0 
)
-
-
- -

-Constructor. -

-

See also:
FreeImage_AllocateT
- -
-

- -

-
- - - - - - - - -
virtual fipImage::~fipImage (  )  [virtual]
-
-
- -

-Destructor. -

- -

-

- -

-
- - - - - - - - - -
fipImage::fipImage (const fipImage src  ) 
-
-
- -

-Copy constructor. -

-

See also:
FreeImage_Clone
- -
-

-


Member Function Documentation

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::setSize (FREE_IMAGE_TYPE  image_type,
unsigned  width,
unsigned  height,
unsigned  bpp,
unsigned  red_mask = 0,
unsigned  green_mask = 0,
unsigned  blue_mask = 0 
)
-
-
- -

-Image allocator. -

-

See also:
FreeImage_AllocateT
- -
-

- -

-
- - - - - - - - -
virtual void fipImage::clear (  )  [virtual]
-
-
- -

-Destroy image data. -

- -

Reimplemented in fipWinImage.

- -
-

- -

-
- - - - - - - - - -
fipImage& fipImage::operator= (const fipImage src  ) 
-
-
- -

-Copy constructor. -

-

See also:
FreeImage_Clone
- -

Reimplemented in fipWinImage.

- -
-

- -

-
- - - - - - - - - -
fipImage& fipImage::operator= (FIBITMAP *  dib  ) 
-
-
- -

-Assignement operator</b>
- Copy the input pointer and manage its destruction
-

-

See also:
operator FIBITMAP*()
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::copySubImage (fipImage dst,
int  left,
int  top,
int  right,
int  bottom 
) const
-
-
- -

-Copy a sub part of the current image and returns it as a fipImage object.

-This method works with any bitmap type.

Parameters:
- - - - - - -
dst Output subimage
left Specifies the left position of the cropped rectangle.
top Specifies the top position of the cropped rectangle.
right Specifies the right position of the cropped rectangle.
bottom Specifies the bottom position of the cropped rectangle.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_Copy
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::pasteSubImage (fipImage src,
int  left,
int  top,
int  alpha = 256 
)
-
-
- -

-Alpha blend or combine a sub part image with the current image.

-The bit depth of dst bitmap must be greater than or equal to the bit depth of src. Upper promotion of src is done internally. Supported bit depth equals to 4, 8, 16, 24 or 32.

Parameters:
- - - - - -
src Source subimage
left Specifies the left position of the sub image.
top Specifies the top position of the sub image.
alpha Alpha blend factor. The source and destination images are alpha blended if alpha = 0..255. If alpha > 255, then the source image is combined to the destination image.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_Paste
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::crop (int  left,
int  top,
int  right,
int  bottom 
)
-
-
- -

-Crop a sub part of the current image and update it accordingly.

-This method works with any bitmap type.

Parameters:
- - - - - -
left Specifies the left position of the cropped rectangle.
top Specifies the top position of the cropped rectangle.
right Specifies the right position of the cropped rectangle.
bottom Specifies the bottom position of the cropped rectangle.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
- -
-

- -

-
- - - - - - - - - -
static FREE_IMAGE_FORMAT fipImage::identifyFIF (const char *  lpszPathName  )  [static]
-
-
- -

-Identifies an image from disk, given its file name

Parameters:
- - -
lpszPathName Path and file name of the image to identify.
-
-
Returns:
Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise.
-
See also:
FreeImage_GetFileType, FreeImage_GetFIFFromFilename, FreeImage documentation
- -
-

- -

-
- - - - - - - - - -
static FREE_IMAGE_FORMAT fipImage::identifyFIFU (const wchar_t *  lpszPathName  )  [static]
-
-
- -

-UNICODE version of identifyFIF (this function only works under WIN32 and does nothing on other OS). -

-

See also:
FreeImage_GetFileTypeU, FreeImage_GetFIFFromFilenameU, FreeImage documentation
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
static FREE_IMAGE_FORMAT fipImage::identifyFIFFromHandle (FreeImageIO *  io,
fi_handle  handle 
) [static]
-
-
- -

-Identifies an image using the specified FreeImageIO struct and fi_handle.

Parameters:
- - - -
io FreeImageIO structure
handle FreeImage fi_handle
-
-
Returns:
Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise.
-
See also:
FreeImage_GetFileTypeFromHandle, FreeImage documentation
- -
-

- -

-
- - - - - - - - - -
static FREE_IMAGE_FORMAT fipImage::identifyFIFFromMemory (FIMEMORY *  hmem  )  [static]
-
-
- -

-Identifies an image using the specified memory stream.

Parameters:
- - -
hmem FreeImage memory stream
-
-
Returns:
Returns the found FreeImage format if successful, returns FIF_UNKNOWN otherwise.
-
See also:
FreeImage_GetFileTypeFromMemory, FreeImage documentation
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::load (const char *  lpszPathName,
int  flag = 0 
)
-
-
- -

-Loads an image from disk, given its file name and an optional flag.

Parameters:
- - - -
lpszPathName Path and file name of the image to load.
flag The signification of this flag depends on the image to be read.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_Load, FreeImage documentation
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::loadU (const wchar_t *  lpszPathName,
int  flag = 0 
)
-
-
- -

-UNICODE version of load (this function only works under WIN32 and does nothing on other OS). -

-

See also:
load
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::loadFromHandle (FreeImageIO *  io,
fi_handle  handle,
int  flag = 0 
)
-
-
- -

-Loads an image using the specified FreeImageIO struct and fi_handle, and an optional flag.

Parameters:
- - - - -
io FreeImageIO structure
handle FreeImage fi_handle
flag The signification of this flag depends on the image to be read.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_LoadFromHandle, FreeImage documentation
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::loadFromMemory (fipMemoryIO memIO,
int  flag = 0 
)
-
-
- -

-Loads an image using the specified memory stream and an optional flag.

Parameters:
- - - -
memIO FreeImage memory stream
flag The signification of this flag depends on the image to be read.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_LoadFromMemory, FreeImage documentation
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::save (const char *  lpszPathName,
int  flag = 0 
) const
-
-
- -

-Saves an image to disk, given its file name and an optional flag.

Parameters:
- - - -
lpszPathName Path and file name of the image to save.
flag The signification of this flag depends on the image to be saved.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_Save, FreeImage documentation
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::saveU (const wchar_t *  lpszPathName,
int  flag = 0 
) const
-
-
- -

-UNICODE version of save (this function only works under WIN32 and does nothing on other OS). -

-

See also:
save
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::saveToHandle (FREE_IMAGE_FORMAT  fif,
FreeImageIO *  io,
fi_handle  handle,
int  flag = 0 
) const
-
-
- -

-Saves an image using the specified FreeImageIO struct and fi_handle, and an optional flag.

Parameters:
- - - - - -
fif Format identifier (FreeImage format)
io FreeImageIO structure
handle FreeImage fi_handle
flag The signification of this flag depends on the image to be saved.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_SaveToHandle, FreeImage documentation
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::saveToMemory (FREE_IMAGE_FORMAT  fif,
fipMemoryIO memIO,
int  flag = 0 
) const
-
-
- -

-Saves an image using the specified memory stream and an optional flag.

Parameters:
- - - - -
fif Format identifier (FreeImage format)
memIO FreeImage memory stream
flag The signification of this flag depends on the image to be saved.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_SaveToMemory, FreeImage documentation
- -
-

- -

-
- - - - - - - - -
FREE_IMAGE_TYPE fipImage::getImageType (  )  const
-
-
- -

-Returns the data type of the image. -

-

See also:
FreeImage_GetImageType
- -
-

- -

-
- - - - - - - - -
unsigned fipImage::getWidth (  )  const
-
-
- -

-Returns the image width in pixels. -

-

See also:
FreeImage_GetWidth
- -
-

- -

-
- - - - - - - - -
unsigned fipImage::getHeight (  )  const
-
-
- -

-Returns the image height in pixels. -

-

See also:
FreeImage_GetHeight
- -
-

- -

-
- - - - - - - - -
unsigned fipImage::getScanWidth (  )  const
-
-
- -

-Returns the width of the bitmap in bytes rounded to the nearest DWORD. -

-

See also:
FreeImage_GetPitch
- -
-

- -

-
- - - - - - - - -
fipImage::operator FIBITMAP * (  )  [inline]
-
-
- -

-Returns a pointer to the FIBITMAP data. -

-Used for direct access from FREEIMAGE functions or from your own low level C functions.
- Sample use :
-

-	fipImage src, dst;
-	src.load("test.png");
-	dst = FreeImage_ConvertTo8Bits(src);
-	FreeImage_Save(FIF_TIFF, dst, "test.tif", 0);
-	
See also:
operator=(FIBITMAP *dib)
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::isValid (  )  const [virtual]
-
-
- -

-Returns TRUE if the image is allocated, FALSE otherwise. -

- -

Implements fipObject.

- -

Reimplemented in fipWinImage.

- -
-

- -

-
- - - - - - - - -
BITMAPINFO* fipImage::getInfo (  )  const
-
-
- -

-Returns a pointer to the bitmap's BITMAPINFO header. -

-

See also:
FreeImage_GetInfo
- -
-

- -

-
- - - - - - - - -
BITMAPINFOHEADER* fipImage::getInfoHeader (  )  const
-
-
- -

-Returns a pointer to the bitmap's BITMAPINFOHEADER. -

-

See also:
FreeImage_GetInfoHeader
- -
-

- -

-
- - - - - - - - -
LONG fipImage::getImageSize (  )  const
-
-
- -

-Returns the size of the bitmap in bytes. -

-The size of the bitmap is the BITMAPINFOHEADER + the size of the palette + the size of the bitmap data.

See also:
FreeImage_GetDIBSize
- -
-

- -

-
- - - - - - - - -
unsigned fipImage::getBitsPerPixel (  )  const
-
-
- -

-Returns the bitdepth of the bitmap. -

-
- When the image type is FIT_BITMAP, valid bitdepth can be 1, 4, 8, 16, 24 or 32.

See also:
FreeImage_GetBPP, getImageType
- -
-

- -

-
- - - - - - - - -
unsigned fipImage::getLine (  )  const
-
-
- -

-Returns the width of the bitmap in bytes. -

-
- This is not the size of the scanline.

See also:
FreeImage_GetLine, getScanWidth
- -
-

- -

-
- - - - - - - - -
double fipImage::getHorizontalResolution (  )  const
-
-
- -

-Returns the bitmap resolution along the X axis, in pixels / cm. -

-

See also:
FreeImage_GetDotsPerMeterX
- -
-

- -

-
- - - - - - - - -
double fipImage::getVerticalResolution (  )  const
-
-
- -

-Returns the bitmap resolution along the Y axis, in pixels / cm. -

-

See also:
FreeImage_GetDotsPerMeterY
- -
-

- -

-
- - - - - - - - - -
void fipImage::setHorizontalResolution (double  value  ) 
-
-
- -

-set the bitmap resolution along the X axis, in pixels / cm -

-

See also:
FreeImage_GetInfoHeader
- -
-

- -

-
- - - - - - - - - -
void fipImage::setVerticalResolution (double  value  ) 
-
-
- -

-set the bitmap resolution along the Y axis, in pixels / cm -

-

See also:
FreeImage_GetInfoHeader
- -
-

- -

-
- - - - - - - - -
RGBQUAD* fipImage::getPalette (  )  const
-
-
- -

-Returns a pointer to the bitmap's palette. -

-If the bitmap doesn't have a palette, getPalette returns NULL.

See also:
FreeImage_GetPalette
- -
-

- -

-
- - - - - - - - -
unsigned fipImage::getPaletteSize (  )  const
-
-
- -

-Returns the palette size in bytes. -

-

See also:
FreeImage_GetColorsUsed
- -
-

- -

-
- - - - - - - - -
unsigned fipImage::getColorsUsed (  )  const
-
-
- -

-Retrieves the number of colours used in the bitmap. -

-If the bitmap is non-palletised, 0 is returned.

See also:
FreeImage_GetColorsUsed
- -
-

- -

-
- - - - - - - - -
FREE_IMAGE_COLOR_TYPE fipImage::getColorType (  )  const
-
-
- -

-Investigates the colour type of the bitmap. -

-

See also:
FreeImage_GetColorType, FREE_IMAGE_COLOR_TYPE
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::isGrayscale (  )  const
-
-
- -

-Returns TRUE if the bitmap is a 8-bit bitmap with a greyscale palette, FALSE otherwise. -

-

See also:
FreeImage_GetBPP, FreeImage_GetColorType
- -
-

- -

-
- - - - - - - - -
BYTE* fipImage::accessPixels (  )  const
-
-
- -

-Returns a pointer to the bitmap bits.

-It is up to you to interpret these bytes correctly, according to the results of FreeImage_GetBPP and GetRedMask, FreeImage_GetGreenMask and FreeImage_GetBlueMask.
- Use this function with getScanWidth to iterates through the pixels.

See also:
FreeImage_GetBits
- -
-

- -

-
- - - - - - - - - -
BYTE* fipImage::getScanLine (unsigned  scanline  )  const
-
-
- -

-Returns a pointer to the start of the given scanline in the bitmaps data-bits. This pointer can be cast according to the result returned by getImageType.
- Use this function with getScanWidth to iterates through the pixels.

See also:
FreeImage_GetScanLine, FreeImage documentation
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::getPixelIndex (unsigned  x,
unsigned  y,
BYTE *  value 
) const
-
-
- -

-Get the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). -

-

Parameters:
- - - - -
x Pixel position in horizontal direction
y Pixel position in vertical direction
value Pixel index (returned value)
-
-
Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_GetPixelIndex
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::getPixelColor (unsigned  x,
unsigned  y,
RGBQUAD *  value 
) const
-
-
- -

-Get the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). -

-

Parameters:
- - - - -
x Pixel position in horizontal direction
y Pixel position in vertical direction
value Pixel color (returned value)
-
-
Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_GetPixelColor
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::setPixelIndex (unsigned  x,
unsigned  y,
BYTE *  value 
)
-
-
- -

-Set the pixel index of a 1-, 4- or 8-bit palettized image at position (x, y), including range check (slow access). -

-

Parameters:
- - - - -
x Pixel position in horizontal direction
y Pixel position in vertical direction
value Pixel index
-
-
Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_SetPixelIndex
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::setPixelColor (unsigned  x,
unsigned  y,
RGBQUAD *  value 
)
-
-
- -

-Set the pixel color of a 16-, 24- or 32-bit image at position (x, y), including range check (slow access). -

-

Parameters:
- - - - -
x Pixel position in horizontal direction
y Pixel position in vertical direction
value Pixel color
-
-
Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_SetPixelColor
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::convertToType (FREE_IMAGE_TYPE  image_type,
BOOL  scale_linear = TRUE 
)
-
-
- -

-Converts an image to a type supported by FreeImage. -

-

Parameters:
- - - -
image_type New image type
scale_linear TRUE if image pixels must be scaled linearly when converting to a standard bitmap
-
-
Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_ConvertToType, FreeImage_ConvertToStandardType
- -
-

- -

-
- - - - - - - - - -
BOOL fipImage::threshold (BYTE  T  ) 
-
-
- -

-Converts the bitmap to 1 bit using a threshold T. -

-

Parameters:
- - -
T Threshold value in [0..255]
-
-
Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_Threshold
- -
-

- -

-
- - - - - - - - - -
BOOL fipImage::dither (FREE_IMAGE_DITHER  algorithm  ) 
-
-
- -

-Converts a 8-bit image to a monochrome 1-bit image using a dithering algorithm. -

-

Parameters:
- - -
algorithm Dithering algorithm to use.
-
-
Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_Dither, FREE_IMAGE_DITHER
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::convertTo4Bits (  ) 
-
-
- -

-Converts the bitmap to 4 bits. -

-Unless the bitmap is a 1-bit palettized bitmap, colour values are converted to greyscale.

Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_ConvertTo4Bits
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::convertTo8Bits (  ) 
-
-
- -

-Converts the bitmap to 8 bits. -

-If the bitmap is 24 or 32-bit RGB, the colour values are converted to greyscale.

Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_ConvertTo8Bits
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::convertToGrayscale (  ) 
-
-
- -

-Converts the bitmap to 8 bits. -

-
- For palletized bitmaps, the color map is converted to a greyscale ramp.

See also:
FreeImage_ConvertToGreyscale
-
Returns:
Returns TRUE if successfull, FALSE otherwise.
- -
-

- -

-
- - - - - - - - - -
BOOL fipImage::colorQuantize (FREE_IMAGE_QUANTIZE  algorithm  ) 
-
-
- -

-Quantizes a full colour 24-bit bitmap to a palletised 8-bit bitmap. -

-
- The quantize parameter specifies which colour reduction algorithm should be used.

Parameters:
- - -
algorithm Color quantization algorithm to use.
-
-
Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_ColorQuantize, FREE_IMAGE_QUANTIZE
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::convertTo16Bits555 (  ) 
-
-
- -

-Converts the bitmap to 16 bits. -

-The resulting bitmap has a layout of 5 bits red, 5 bits green, 5 bits blue and 1 unused bit.

Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_ConvertTo16Bits555
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::convertTo16Bits565 (  ) 
-
-
- -

-Converts the bitmap to 16 bits. -

-The resulting bitmap has a layout of 5 bits red, 6 bits green and 5 bits blue.

Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_ConvertTo16Bits565
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::convertTo24Bits (  ) 
-
-
- -

-Converts the bitmap to 24 bits. -

-

Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_ConvertTo24Bits
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::convertTo32Bits (  ) 
-
-
- -

-Converts the bitmap to 32 bits. -

-

Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_ConvertTo32Bits
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::convertToRGBF (  ) 
-
-
- -

-Converts the bitmap to a 96-bit RGBF image. -

-

Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_ConvertToRGBF
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::toneMapping (FREE_IMAGE_TMO  tmo,
double  first_param = 0,
double  second_param = 0,
double  third_param = 1,
double  fourth_param = 0 
)
-
-
- -

-Converts a High Dynamic Range image (48-bit RGB or 96-bit RGB Float) to a 24-bit RGB image. -

-

Parameters:
- - - - - - -
tmo Tone mapping operator
first_param First tone mapping algorithm parameter (algorithm dependant)
second_param Second tone mapping algorithm parameter (algorithm dependant)
third_param Third tone mapping algorithm parameter (algorithm dependant)
fourth_param Fourth tone mapping algorithm parameter (algorithm dependant)
-
-
Returns:
Returns TRUE if successfull, FALSE otherwise.
-
See also:
FreeImage_ToneMapping, FreeImage_TmoReinhard05Ex
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::isTransparent (  )  const
-
-
- -

-Returns TRUE if the image is transparent, returns FALSE otherwise. -

-

See also:
FreeImage_IsTransparent
- -
-

- -

-
- - - - - - - - -
unsigned fipImage::getTransparencyCount (  )  const
-
-
- -

-8-bit transparency : get the number of transparent colors. -

-

Returns:
Returns the number of transparent colors in a palletised bitmap.
-
See also:
FreeImage_GetTransparencyCount
- -
-

- -

-
- - - - - - - - -
BYTE* fipImage::getTransparencyTable (  )  const
-
-
- -

-8-bit transparency : get the bitmaps transparency table. -

-

Returns:
Returns a pointer to the bitmaps transparency table.
-
See also:
FreeImage_GetTransparencyTable
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
void fipImage::setTransparencyTable (BYTE *  table,
int  count 
)
-
-
- -

-8-bit transparency : set the bitmaps transparency table. -

-

See also:
FreeImage_SetTransparencyTable
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::hasFileBkColor (  )  const
-
-
- -

-Returns TRUE when the image has a file background color, FALSE otherwise. -

-

See also:
FreeImage_HasBackgroundColor
- -
-

- -

-
- - - - - - - - - -
BOOL fipImage::getFileBkColor (RGBQUAD *  bkcolor  )  const
-
-
- -

-Retrieves the file background color of an image.

-For 8-bit images, the color index in the palette is returned in the rgbReserved member of the bkcolor parameter.

Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_GetBackgroundColor
- -
-

- -

-
- - - - - - - - - -
BOOL fipImage::setFileBkColor (RGBQUAD *  bkcolor  ) 
-
-
- -

-Set the file background color of an image.

-When saving an image to PNG, this background color is transparently saved to the PNG file. When the bkcolor parameter is NULL, the background color is removed from the image.

Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_SetBackgroundColor
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::getChannel (fipImage image,
FREE_IMAGE_COLOR_CHANNEL  channel 
) const
-
-
- -

-Retrieves the red, green, blue or alpha channel of a 24- or 32-bit BGR[A] image.

Parameters:
- - - -
image Output image to be extracted
channel Color channel to extract
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_GetChannel, FREE_IMAGE_COLOR_CHANNEL
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::setChannel (fipImage image,
FREE_IMAGE_COLOR_CHANNEL  channel 
)
-
-
- -

-Insert a 8-bit dib into a 24- or 32-bit image.

Parameters:
- - - -
image Input 8-bit image to insert
channel Color channel to replace
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_SetChannel, FREE_IMAGE_COLOR_CHANNEL
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::splitChannels (fipImage RedChannel,
fipImage GreenChannel,
fipImage BlueChannel 
)
-
-
- -

-Split a 24-bit RGB image into 3 greyscale images corresponding to the red, green and blue channels.

Parameters:
- - - - -
RedChannel Output red channel.
GreenChannel Output green channel.
BlueChannel Output blue channel.
-
-
Returns:
Returns FALSE if the dib isn't a valid image, if it's not a 24-bit image or if one of the output channel can't be allocated. Returns TRUE otherwise.
-
See also:
FreeImage_GetChannel
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::combineChannels (fipImage red,
fipImage green,
fipImage blue 
)
-
-
- -

-Builds a 24-bit RGB image given its red, green and blue channel.

Parameters:
- - - - -
red Input red channel.
green Input green channel.
blue Input blue channel.
-
-
Returns:
Returns FALSE if the dib can't be allocated, if the input channels are not 8-bit images. Returns TRUE otherwise.
-
See also:
FreeImage_SetChannel
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::rotateEx (double  angle,
double  x_shift,
double  y_shift,
double  x_origin,
double  y_origin,
BOOL  use_mask 
)
-
-
- -

-Image translation and rotation using B-Splines. -

-

Parameters:
- - - - - - - -
angle Image rotation angle, in degree
x_shift Image horizontal shift
y_shift Image vertical shift
x_origin Origin of the x-axis
y_origin Origin of the y-axis
use_mask Whether or not to mask the image. Image mirroring is applied when use_mask is set to FALSE
-
-
Returns:
Returns the translated & rotated dib if successful, returns NULL otherwise
-
See also:
FreeImage_RotateEx
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::rotate (double  angle,
const void *  bkcolor = NULL 
)
-
-
- -

-Image rotation by means of three shears. -

-

Parameters:
- - - -
angle Image rotation angle, in degree
bkcolor Background color (image type dependent), default to black background
-
-
Returns:
Returns rotated dib if successful, returns NULL otherwise
-
See also:
FreeImage_Rotate
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::flipHorizontal (  ) 
-
-
- -

-Flip the image horizontally along the vertical axis. -

-

See also:
FreeImage_FlipHorizontal
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::flipVertical (  ) 
-
-
- -

-Flip the image vertically along the horizontal axis. -

-

See also:
FreeImage_FlipVertical
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::invert (  ) 
-
-
- -

-Inverts each pixel data. -

-

Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_Invert
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::adjustCurve (BYTE *  LUT,
FREE_IMAGE_COLOR_CHANNEL  channel 
)
-
-
- -

-Perfoms an histogram transformation on a 8, 24 or 32-bit image according to the values of a lookup table (LUT).

-The transformation is done as follows.
- Image 8-bit : if the image has a color palette, the LUT is applied to this palette, otherwise, it is applied to the grey values.
- Image 24-bit & 32-bit : if channel == IPL_CC_RGB, the same LUT is applied to each color plane (R,G, and B). Otherwise, the LUT is applied to the specified channel only.

Parameters:
- - - -
LUT Lookup table. The size of 'LUT' is assumed to be 256.
channel The color channel to be processed (only used with 24 & 32-bit DIB).
-
-
Returns:
Returns TRUE if the operation was successful, FALSE otherwise
-
See also:
FreeImage_AdjustCurve, FREE_IMAGE_COLOR_CHANNEL
- -
-

- -

-
- - - - - - - - - -
BOOL fipImage::adjustGamma (double  gamma  ) 
-
-
- -

-Performs gamma correction on a 8, 24 or 32-bit image.

Parameters:
- - -
gamma Gamma value to use. A value of 1.0 leaves the image alone, less than one darkens it, and greater than one lightens it.
-
-
Returns:
Returns TRUE if the operation was successful, FALSE otherwise
-
See also:
FreeImage_AdjustGamma, adjustCurve
- -
-

- -

-
- - - - - - - - - -
BOOL fipImage::adjustBrightness (double  percentage  ) 
-
-
- -

-Adjusts the brightness of a 8, 24 or 32-bit image by a certain amount.

Parameters:
- - -
percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will make the image darker and greater than 0 will make the image brighter.
-
-
Returns:
Returns TRUE if the operation was succesful, FALSE otherwise
-
See also:
FreeImage_AdjustBrightness, adjustCurve
- -
-

- -

-
- - - - - - - - - -
BOOL fipImage::adjustContrast (double  percentage  ) 
-
-
- -

-Adjusts the contrast of a 8, 24 or 32-bit image by a certain amount.

Parameters:
- - -
percentage Where -100 <= percentage <= 100
- A value 0 means no change, less than 0 will decrease the contrast and greater than 0 will increase the contrast of the image.
-
-
Returns:
Returns TRUE if the operation was succesfull, FALSE otherwise
-
See also:
FreeImage_AdjustContrast, adjustCurve
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::adjustBrightnessContrastGamma (double  brightness,
double  contrast,
double  gamma 
)
-
-
- -

-Adjusts an image's brightness, contrast and gamma within a single operation. -

-If more than one of these image display properties need to be adjusted, using this function should be preferred over calling each adjustment function separately. That's particularly true for huge images or if performance is an issue.

See also:
adjustBrightness

-adjustContrast

-adjustGamma

-FreeImage_AdjustColors

- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::getHistogram (DWORD *  histo,
FREE_IMAGE_COLOR_CHANNEL  channel = FICC_BLACK 
) const
-
-
- -

-Computes image histogram For 24-bit and 32-bit images, histogram can be computed from red, green, blue and black channels. For 8-bit images, histogram is computed from the black channel. Other bit depth is not supported.

Parameters:
- - - -
histo pointer to an histogram array. Size of this array is assumed to be 256.
channel Color channel to use
-
-
Returns:
Returns TRUE if the operation was succesfull, FALSE otherwise
-
See also:
FreeImage_GetHistogram
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::rescale (unsigned  new_width,
unsigned  new_height,
FREE_IMAGE_FILTER  filter 
)
-
-
- -

-Rescale the image to a new width / height.

-

Parameters:
- - - - -
new_width New image width
new_height New image height
filter The filter parameter specifies which resampling filter should be used.
-
-
Returns:
Returns TRUE if the operation was successful, FALSE otherwise
-
See also:
FreeImage_Rescale, FREE_IMAGE_FILTER
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipImage::makeThumbnail (unsigned  max_size,
BOOL  convert = TRUE 
)
-
-
- -

-Creates a thumbnail image keeping aspect ratio

Parameters:
- - - -
max_size Maximum width or height in pixel units
convert When set to TRUE, converts the image to a standard type
-
-
Returns:
Returns TRUE if the operation was successful, FALSE otherwise
-
See also:
FreeImage_MakeThumbnail
- -
-

- -

-
- - - - - - - - - -
void fipImage::setModified (BOOL  bStatus = TRUE  )  [inline]
-
-
- -

-Set the image status as 'modified'. -

-
- When using the fipWinImage class, the image status is used to refresh the display. It is changed to FALSE whenever the display has just been refreshed.

Parameters:
- - -
bStatus TRUE if the image should be marked as modified, FALSE otherwise
-
-
See also:
isModified
- -
-

- -

-
- - - - - - - - -
BOOL fipImage::isModified (  )  [inline]
-
-
- -

-Get the image status. -

-

Returns:
Returns TRUE if the image is marked as modified, FALSE otherwise
-
See also:
setModified
- -
-

- -

-
- - - - - - - - - -
unsigned fipImage::getMetadataCount (FREE_IMAGE_MDMODEL  model  )  const
-
-
- -

-Returns the number of tags contained in the model metadata model attached to the dib. -

-

Parameters:
- - -
model Metadata model to look for
-
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::getMetadata (FREE_IMAGE_MDMODEL  model,
const char *  key,
fipTag tag 
) const
-
-
- -

-Retrieve a metadata attached to the dib. -

-

Parameters:
- - - - -
model Metadata model to look for
key Metadata field name
tag Returned tag
-
-
Returns:
Returns TRUE if the operation was succesfull, FALSE otherwise
-
See also:
FreeImage_GetMetadata
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipImage::setMetadata (FREE_IMAGE_MDMODEL  model,
const char *  key,
fipTag tag 
)
-
-
- -

-Attach a new FreeImage tag to the dib. -

-
- Sample use :
-

-	fipImage image;
-...
-	fipTag tag;
-	tag.setKeyValue("Caption/Abstract", "my caption");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	tag.setKeyValue("Keywords", "FreeImage;Library;Images;Compression");
-	image.setMetadata(FIMD_IPTC, tag.getKey(), tag);
-	

-

Parameters:
- - - - -
model Metadata model used to store the tag
key Tag field name
tag Tag to be attached
-
-
Returns:
Returns TRUE if the operation was succesfull, FALSE otherwise
-
See also:
FreeImage_SetMetadata
- -
-

-


Member Data Documentation

- -
-
- - - - -
FIBITMAP* fipImage::_dib [protected]
-
-
- -

-DIB data. -

- -

-

- -

-
- - - - -
FREE_IMAGE_FORMAT fipImage::_fif [protected]
-
-
- -

-Original (or last saved) fif format if available, FIF_UNKNOWN otherwise. -

- -

-

- -

-
- - - - -
BOOL fipImage::_bHasChanged [mutable, protected]
-
-
- -

-TRUE whenever the display need to be refreshed. -

- -

-

-


The documentation for this class was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipImage.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipImage.png deleted file mode 100644 index 97d66ff..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipImage.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMemoryIO-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMemoryIO-members.html deleted file mode 100644 index 6e94298..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMemoryIO-members.html +++ /dev/null @@ -1,48 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipMemoryIO Member List

This is the complete list of members for fipMemoryIO, including all inherited members.

- - - - - - - - - - - - - - - - - -
_hmemfipMemoryIO [protected]
acquire(BYTE **data, DWORD *size_in_bytes)fipMemoryIO
close()fipMemoryIO
fipMemoryIO(BYTE *data=NULL, DWORD size_in_bytes=0)fipMemoryIO
getFileType() const fipMemoryIO
isValid() const fipMemoryIO [virtual]
load(FREE_IMAGE_FORMAT fif, int flags=0) const fipMemoryIO
loadMultiPage(FREE_IMAGE_FORMAT fif, int flags=0) const fipMemoryIO
operator FIMEMORY *()fipMemoryIO [inline]
read(void *buffer, unsigned size, unsigned count) const fipMemoryIO
save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags=0)fipMemoryIO
saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags=0)fipMemoryIO
seek(long offset, int origin)fipMemoryIO
tell() const fipMemoryIO
write(const void *buffer, unsigned size, unsigned count)fipMemoryIO
~fipMemoryIO()fipMemoryIO [virtual]
~fipObject()fipObject [inline, virtual]


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMemoryIO.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMemoryIO.html deleted file mode 100644 index 5698ab0..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMemoryIO.html +++ /dev/null @@ -1,628 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipMemoryIO Class Reference

#include <FreeImagePlus.h> -

-

-Inheritance diagram for fipMemoryIO:
-
- -

- -fipObject - -
- -

-List of all members.


Detailed Description

-Memory handle. -

-fipMemoryIO is a class that allows you to load / save images from / to a memory stream.

Version:
FreeImage 3
-
Author:
Herv Drolon
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

 fipMemoryIO (BYTE *data=NULL, DWORD size_in_bytes=0)
 Constructor.
virtual ~fipMemoryIO ()
 Destructor.
void close ()
 Destructor.
BOOL isValid () const
 Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise.
FREE_IMAGE_FORMAT getFileType () const
 Returns the buffer image format.
 operator FIMEMORY * ()
 Returns a pointer to the FIMEMORY data.
Memory IO routines
FIBITMAP * load (FREE_IMAGE_FORMAT fif, int flags=0) const
 Loads a dib from a memory stream.
FIMULTIBITMAP * loadMultiPage (FREE_IMAGE_FORMAT fif, int flags=0) const
 Loads a multi-page bitmap from a memory stream.
BOOL save (FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags=0)
 Saves a dib to a memory stream.
BOOL saveMultiPage (FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags=0)
 Saves a multi-page bitmap to a memory stream.
unsigned read (void *buffer, unsigned size, unsigned count) const
 Reads data from a memory stream.
unsigned write (const void *buffer, unsigned size, unsigned count)
 Writes data to a memory stream.
long tell () const
 Gets the current position of a memory pointer.
BOOL seek (long offset, int origin)
 Moves the memory pointer to a specified location.
BOOL acquire (BYTE **data, DWORD *size_in_bytes)
 Provides a direct buffer access to a memory stream.

Protected Attributes

FIMEMORY * _hmem
 Pointer to a memory stream.
-

Constructor & Destructor Documentation

- -
-
- - - - - - - - - - - - - - - - - - -
fipMemoryIO::fipMemoryIO (BYTE *  data = NULL,
DWORD  size_in_bytes = 0 
)
-
-
- -

-Constructor. -

-Wrap a memory buffer containing image data.
- The memory buffer is read only and has to be freed by the user when no longer in use.
- When default arguments are used, open a memory file as read/write.

Parameters:
- - - -
data Pointer to the memory buffer
size_in_bytes Buffer size in bytes
-
-
See also:
FreeImage_OpenMemory
- -
-

- -

-
- - - - - - - - -
virtual fipMemoryIO::~fipMemoryIO (  )  [virtual]
-
-
- -

-Destructor. -

-Free any allocated memory

See also:
FreeImage_CloseMemory
- -
-

-


Member Function Documentation

- -
-
- - - - - - - - -
void fipMemoryIO::close (  ) 
-
-
- -

-Destructor. -

-Free any allocated memory and invalidate the stream

See also:
FreeImage_CloseMemory
- -
-

- -

-
- - - - - - - - -
BOOL fipMemoryIO::isValid (  )  const [virtual]
-
-
- -

-Returns TRUE if the internal memory buffer is a valid buffer, returns FALSE otherwise. -

- -

Implements fipObject.

- -
-

- -

-
- - - - - - - - -
FREE_IMAGE_FORMAT fipMemoryIO::getFileType (  )  const
-
-
- -

-Returns the buffer image format. -

-

See also:
FreeImage_GetFileTypeFromMemory
- -
-

- -

-
- - - - - - - - -
fipMemoryIO::operator FIMEMORY * (  )  [inline]
-
-
- -

-Returns a pointer to the FIMEMORY data. -

-Used for direct access from FREEIMAGE functions or from your own low level C functions. -

-

- -

-
- - - - - - - - - - - - - - - - - - -
FIBITMAP* fipMemoryIO::load (FREE_IMAGE_FORMAT  fif,
int  flags = 0 
) const
-
-
- -

-Loads a dib from a memory stream. -

-

Parameters:
- - - -
fif Format identifier (FreeImage format)
flags The signification of this flag depends on the image to be loaded.
-
-
Returns:
Returns the loaded dib if successful, returns NULL otherwise
-
See also:
FreeImage_LoadFromMemory
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
FIMULTIBITMAP* fipMemoryIO::loadMultiPage (FREE_IMAGE_FORMAT  fif,
int  flags = 0 
) const
-
-
- -

-Loads a multi-page bitmap from a memory stream. -

-

Parameters:
- - - -
fif Format identifier (FreeImage format)
flags The signification of this flag depends on the multi-page to be loaded.
-
-
Returns:
Returns the loaded multi-page if successful, returns NULL otherwise
-
See also:
FreeImage_LoadMultiBitmapFromMemory
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipMemoryIO::save (FREE_IMAGE_FORMAT  fif,
FIBITMAP *  dib,
int  flags = 0 
)
-
-
- -

-Saves a dib to a memory stream. -

-

Parameters:
- - - - -
fif Format identifier (FreeImage format)
dib Image to be saved
flags The signification of this flag depends on the image to be saved.
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_SaveToMemory
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipMemoryIO::saveMultiPage (FREE_IMAGE_FORMAT  fif,
FIMULTIBITMAP *  bitmap,
int  flags = 0 
)
-
-
- -

-Saves a multi-page bitmap to a memory stream. -

-

Parameters:
- - - - -
fif Format identifier (FreeImage format)
bitmap Multi-page image to be saved
flags The signification of this flag depends on the image to be saved.
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_SaveMultiBitmapToMemory
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
unsigned fipMemoryIO::read (void *  buffer,
unsigned  size,
unsigned  count 
) const
-
-
- -

-Reads data from a memory stream. -

-

Parameters:
- - - - -
buffer Storage location for data
size Item size in bytes
count Maximum number of items to be read
-
-
Returns:
Returns the number of full items actually read, which may be less than count if an error occurs
-
See also:
FreeImage_ReadMemory
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
unsigned fipMemoryIO::write (const void *  buffer,
unsigned  size,
unsigned  count 
)
-
-
- -

-Writes data to a memory stream. -

-

Parameters:
- - - - -
buffer Pointer to data to be written
size Item size in bytes
count Maximum number of items to be written
-
-
Returns:
Returns the number of full items actually written, which may be less than count if an error occurs
-
See also:
FreeImage_WriteMemory
- -
-

- -

-
- - - - - - - - -
long fipMemoryIO::tell (  )  const
-
-
- -

-Gets the current position of a memory pointer. -

-

See also:
FreeImage_TellMemory
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipMemoryIO::seek (long  offset,
int  origin 
)
-
-
- -

-Moves the memory pointer to a specified location. -

-

See also:
FreeImage_SeekMemory
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipMemoryIO::acquire (BYTE **  data,
DWORD *  size_in_bytes 
)
-
-
- -

-Provides a direct buffer access to a memory stream. -

-

Parameters:
- - - -
data Pointer to the memory buffer (returned value)
size_in_bytes Buffer size in bytes (returned value)
-
-
See also:
FreeImage_AcquireMemory
- -
-

-


Member Data Documentation

- -
-
- - - - -
FIMEMORY* fipMemoryIO::_hmem [protected]
-
-
- -

-Pointer to a memory stream. -

- -

-

-


The documentation for this class was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMemoryIO.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMemoryIO.png deleted file mode 100644 index 04136b1..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMemoryIO.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMetadataFind-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMetadataFind-members.html deleted file mode 100644 index 9d93843..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMetadataFind-members.html +++ /dev/null @@ -1,38 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipMetadataFind Member List

This is the complete list of members for fipMetadataFind, including all inherited members.

- - - - - - - -
_mdhandlefipMetadataFind [protected]
findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage &image, fipTag &tag)fipMetadataFind
findNextMetadata(fipTag &tag)fipMetadataFind
fipMetadataFind()fipMetadataFind
isValid() const fipMetadataFind [virtual]
~fipMetadataFind()fipMetadataFind [virtual]
~fipObject()fipObject [inline, virtual]


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMetadataFind.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMetadataFind.html deleted file mode 100644 index b4718e8..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMetadataFind.html +++ /dev/null @@ -1,251 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipMetadataFind Class Reference

#include <FreeImagePlus.h> -

-

-Inheritance diagram for fipMetadataFind:
-
- -

- -fipObject - -
- -

-List of all members.


Detailed Description

-Metadata iterator. -

-Usage :
-

-fipImage image;
-// ...
-fipTag tag;
-fipMetadataFind finder;
-if( finder.findFirstMetadata(FIMD_EXIF_MAIN, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";

-

  } while( finder.findNextMetadata(tag) );
-}
-// the class can be called again with another metadata model
-if( finder.findFirstMetadata(FIMD_EXIF_EXIF, image, tag) ) {
-  do {
-    // process the tag
-	cout << tag.getKey() << "\n";

-

  } while( finder.findNextMetadata(tag) );
-}
-
- - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

BOOL isValid () const
 Returns TRUE if the search handle is allocated, FALSE otherwise.
 fipMetadataFind ()
 Constructor.
virtual ~fipMetadataFind ()
 Destructor.
BOOL findFirstMetadata (FREE_IMAGE_MDMODEL model, fipImage &image, fipTag &tag)
 Provides information about the first instance of a tag that matches the metadata model specified in the model argument.
BOOL findNextMetadata (fipTag &tag)
 Find the next tag, if any, that matches the metadata model argument in a previous call to findFirstMetadata.

Protected Attributes

FIMETADATA * _mdhandle
 Pointer to a search handle.
-

Constructor & Destructor Documentation

- -
-
- - - - - - - - -
fipMetadataFind::fipMetadataFind (  ) 
-
-
- -

-Constructor. -

- -

-

- -

-
- - - - - - - - -
virtual fipMetadataFind::~fipMetadataFind (  )  [virtual]
-
-
- -

-Destructor. -

-

See also:
FreeImage_FindCloseMetadata
- -
-

-


Member Function Documentation

- -
-
- - - - - - - - -
BOOL fipMetadataFind::isValid (  )  const [virtual]
-
-
- -

-Returns TRUE if the search handle is allocated, FALSE otherwise. -

- -

Implements fipObject.

- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipMetadataFind::findFirstMetadata (FREE_IMAGE_MDMODEL  model,
fipImage image,
fipTag tag 
)
-
-
- -

-Provides information about the first instance of a tag that matches the metadata model specified in the model argument. -

-

Parameters:
- - - - -
model Metadata model
image Input image
tag Returned tag
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_FindFirstMetadata
- -
-

- -

-
- - - - - - - - - -
BOOL fipMetadataFind::findNextMetadata (fipTag tag  ) 
-
-
- -

-Find the next tag, if any, that matches the metadata model argument in a previous call to findFirstMetadata. -

-

Parameters:
- - -
tag Returned tag
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise, indicating that no more matching tags could be found
-
See also:
FreeImage_FindNextMetadata
- -
-

-


Member Data Documentation

- -
-
- - - - -
FIMETADATA* fipMetadataFind::_mdhandle [protected]
-
-
- -

-Pointer to a search handle. -

- -

-

-


The documentation for this class was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMetadataFind.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMetadataFind.png deleted file mode 100644 index e15c342..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMetadataFind.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMultiPage-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMultiPage-members.html deleted file mode 100644 index 2b8a3af..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMultiPage-members.html +++ /dev/null @@ -1,52 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipMultiPage Member List

This is the complete list of members for fipMultiPage, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - -
_bMemoryCachefipMultiPage [protected]
_mpagefipMultiPage [protected]
appendPage(fipImage &image)fipMultiPage
close(int flags=0)fipMultiPage
deletePage(int page)fipMultiPage
fipMultiPage(BOOL keep_cache_in_memory=FALSE)fipMultiPage
getLockedPageNumbers(int *pages, int *count) const fipMultiPage
getPageCount() const fipMultiPage
insertPage(int page, fipImage &image)fipMultiPage
isValid() const fipMultiPage [virtual]
lockPage(int page)fipMultiPage
movePage(int target, int source)fipMultiPage
open(const char *lpszPathName, BOOL create_new, BOOL read_only, int flags=0)fipMultiPage
open(fipMemoryIO &memIO, int flags=0)fipMultiPage
open(FreeImageIO *io, fi_handle handle, int flags=0)fipMultiPage
operator FIMULTIBITMAP *()fipMultiPage [inline]
saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags=0) const fipMultiPage
saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flags=0) const fipMultiPage
unlockPage(fipImage &image, BOOL changed)fipMultiPage
~fipMultiPage()fipMultiPage [virtual]
~fipObject()fipObject [inline, virtual]


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMultiPage.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMultiPage.html deleted file mode 100644 index 0f37f2d..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMultiPage.html +++ /dev/null @@ -1,774 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipMultiPage Class Reference

#include <FreeImagePlus.h> -

-

-Inheritance diagram for fipMultiPage:
-
- -

- -fipObject - -
- -

-List of all members.


Detailed Description

-Multi-page file stream. -

-fipMultiPage encapsulates the multi-page API. It supports reading/writing multi-page TIFF, ICO and GIF files. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

 fipMultiPage (BOOL keep_cache_in_memory=FALSE)
 Constructor.
virtual ~fipMultiPage ()
 Destructor Close the file stream if not already done.
BOOL isValid () const
 Returns TRUE if the multi-page stream is opened.
 operator FIMULTIBITMAP * ()
 Returns a pointer to the FIMULTIBITMAP data.
BOOL open (const char *lpszPathName, BOOL create_new, BOOL read_only, int flags=0)
 Open a multi-page file stream.
BOOL open (fipMemoryIO &memIO, int flags=0)
 Open a multi-page memory stream as read/write.
BOOL open (FreeImageIO *io, fi_handle handle, int flags=0)
 Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle, and an optional flag.
BOOL close (int flags=0)
 Close a file stream.
BOOL saveToHandle (FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags=0) const
 Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag.
BOOL saveToMemory (FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flags=0) const
 Saves a multi-page image using the specified memory stream and an optional flag.
int getPageCount () const
 Returns the number of pages currently available in the multi-paged bitmap.
void appendPage (fipImage &image)
 Appends a new page to the end of the bitmap.
void insertPage (int page, fipImage &image)
 Inserts a new page before the given position in the bitmap.
void deletePage (int page)
 Deletes the page on the given position.
BOOL movePage (int target, int source)
 Moves the source page to the position of the target page.
FIBITMAP * lockPage (int page)
 Locks a page in memory for editing.
void unlockPage (fipImage &image, BOOL changed)
 Unlocks a previously locked page and gives it back to the multi-page engine.
BOOL getLockedPageNumbers (int *pages, int *count) const
 Returns an array of page-numbers that are currently locked in memory.

Protected Attributes

FIMULTIBITMAP * _mpage
 Pointer to a multi-page file stream.
BOOL _bMemoryCache
 TRUE when using a memory cache, FALSE otherwise.
-


Constructor & Destructor Documentation

- -
-
- - - - - - - - - -
fipMultiPage::fipMultiPage (BOOL  keep_cache_in_memory = FALSE  ) 
-
-
- -

-Constructor. -

-

Parameters:
- - -
keep_cache_in_memory When it is TRUE, all gathered bitmap data in the page manipulation process is kept in memory, otherwise it is lazily flushed to a temporary file on the hard disk in 64 Kb blocks.
-
- -
-

- -

-
- - - - - - - - -
virtual fipMultiPage::~fipMultiPage (  )  [virtual]
-
-
- -

-Destructor Close the file stream if not already done. -

- -

-

-


Member Function Documentation

- -
-
- - - - - - - - -
BOOL fipMultiPage::isValid (  )  const [virtual]
-
-
- -

-Returns TRUE if the multi-page stream is opened. -

- -

Implements fipObject.

- -
-

- -

-
- - - - - - - - -
fipMultiPage::operator FIMULTIBITMAP * (  )  [inline]
-
-
- -

-Returns a pointer to the FIMULTIBITMAP data. -

-Used for direct access from FREEIMAGE functions or from your own low level C functions. -

-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipMultiPage::open (const char *  lpszPathName,
BOOL  create_new,
BOOL  read_only,
int  flags = 0 
)
-
-
- -

-Open a multi-page file stream. -

-

Parameters:
- - - - - -
lpszPathName Name of the multi-page bitmap file
create_new When TRUE, it means that a new bitmap will be created rather than an existing one being opened
read_only When TRUE the bitmap is opened read-only
flags Load flags. The signification of this flag depends on the image to be loaded.
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_OpenMultiBitmap
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipMultiPage::open (fipMemoryIO memIO,
int  flags = 0 
)
-
-
- -

-Open a multi-page memory stream as read/write. -

-

Parameters:
- - - -
memIO Memory stream. The memory stream MUST BE a wrapped user buffer.
flags Load flags. The signification of this flag depends on the image to be loaded.
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_LoadMultiBitmapFromMemory
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipMultiPage::open (FreeImageIO *  io,
fi_handle  handle,
int  flags = 0 
)
-
-
- -

-Open a multi-page image as read/write, using the specified FreeImageIO struct and fi_handle, and an optional flag. -

-

Parameters:
- - - - -
io FreeImageIO structure
handle FreeImage fi_handle
flag The signification of this flag depends on the image to be read.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_OpenMultiBitmapFromHandle
- -
-

- -

-
- - - - - - - - - -
BOOL fipMultiPage::close (int  flags = 0  ) 
-
-
- -

-Close a file stream. -

-

Parameters:
- - -
flags Save flags. The signification of this flag depends on the image to be saved.
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_CloseMultiBitmap
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipMultiPage::saveToHandle (FREE_IMAGE_FORMAT  fif,
FreeImageIO *  io,
fi_handle  handle,
int  flags = 0 
) const
-
-
- -

-Saves a multi-page image using the specified FreeImageIO struct and fi_handle, and an optional flag. -

-

Parameters:
- - - - - -
fif Format identifier (FreeImage format)
io FreeImageIO structure
handle FreeImage fi_handle
flag The signification of this flag depends on the multi-page image to be saved.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_SaveMultiBitmapToHandle, FreeImage documentation
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - -
BOOL fipMultiPage::saveToMemory (FREE_IMAGE_FORMAT  fif,
fipMemoryIO memIO,
int  flags = 0 
) const
-
-
- -

-Saves a multi-page image using the specified memory stream and an optional flag. -

-

Parameters:
- - - - -
fif Format identifier (FreeImage format)
memIO FreeImage memory stream
flag The signification of this flag depends on the image to be saved.
-
-
Returns:
Returns TRUE if successful, FALSE otherwise.
-
See also:
FreeImage_SaveMultiBitmapToMemory, FreeImage documentation
- -
-

- -

-
- - - - - - - - -
int fipMultiPage::getPageCount (  )  const
-
-
- -

-Returns the number of pages currently available in the multi-paged bitmap. -

-

See also:
FreeImage_GetPageCount
- -
-

- -

-
- - - - - - - - - -
void fipMultiPage::appendPage (fipImage image  ) 
-
-
- -

-Appends a new page to the end of the bitmap. -

-

Parameters:
- - -
image Image to append
-
-
See also:
FreeImage_AppendPage
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
void fipMultiPage::insertPage (int  page,
fipImage image 
)
-
-
- -

-Inserts a new page before the given position in the bitmap. -

-

Parameters:
- - - -
page Page number. Page has to be a number smaller than the current number of pages available in the bitmap.
image Image to insert
-
-
See also:
FreeImage_InsertPage
- -
-

- -

-
- - - - - - - - - -
void fipMultiPage::deletePage (int  page  ) 
-
-
- -

-Deletes the page on the given position. -

-

Parameters:
- - -
page Page number
-
-
See also:
FreeImage_DeletePage
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipMultiPage::movePage (int  target,
int  source 
)
-
-
- -

-Moves the source page to the position of the target page. -

-

Parameters:
- - - -
target Target page position
source Source page position
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_MovePage
- -
-

- -

-
- - - - - - - - - -
FIBITMAP* fipMultiPage::lockPage (int  page  ) 
-
-
- -

-Locks a page in memory for editing. -

-You must call unlockPage to free the page
- Usage :
-

-	fipMultiPage mpage;
-...
-	fipImage image;		// You must declare this before
-	image = mpage.lockPage(2);
-	if(image.isValid()) {
-...
-	  mpage.unlockPage(image, TRUE);
-	}
-	
Parameters:
- - -
page Page number
-
-
Returns:
Returns the page if successful, returns NULL otherwise
-
See also:
FreeImage_LockPage
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
void fipMultiPage::unlockPage (fipImage image,
BOOL  changed 
)
-
-
- -

-Unlocks a previously locked page and gives it back to the multi-page engine. -

-

Parameters:
- - - -
image Page to unlock
changed When TRUE, the page is marked changed and the new page data is applied in the multi-page bitmap.
-
-
See also:
FreeImage_UnlockPage
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipMultiPage::getLockedPageNumbers (int *  pages,
int *  count 
) const
-
-
- -

-Returns an array of page-numbers that are currently locked in memory. -

-When the pages parameter is NULL, the size of the array is returned in the count variable. You can then allocate the array of the desired size and call getLockedPageNumbers again to populate the array.

Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_GetLockedPageNumbers
- -
-

-


Member Data Documentation

- -
-
- - - - -
FIMULTIBITMAP* fipMultiPage::_mpage [protected]
-
-
- -

-Pointer to a multi-page file stream. -

- -

-

- -

-
- - - - -
BOOL fipMultiPage::_bMemoryCache [protected]
-
-
- -

-TRUE when using a memory cache, FALSE otherwise. -

- -

-

-


The documentation for this class was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMultiPage.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMultiPage.png deleted file mode 100644 index 8c12265..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipMultiPage.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipObject-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipObject-members.html deleted file mode 100644 index 2a308ae..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipObject-members.html +++ /dev/null @@ -1,33 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipObject Member List

This is the complete list of members for fipObject, including all inherited members.

- - -
isValid() const =0fipObject [pure virtual]
~fipObject()fipObject [inline, virtual]


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipObject.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipObject.html deleted file mode 100644 index 5c73ac2..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipObject.html +++ /dev/null @@ -1,112 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipObject Class Reference

#include <FreeImagePlus.h> -

-

-Inheritance diagram for fipObject:
-
- -

- -fipImage -fipMemoryIO -fipMetadataFind -fipMultiPage -fipTag -fipWinImage - -
- -

-List of all members.


Detailed Description

-Abstract base class for all objects used by the library. -

-

Version:
FreeImage 3
-
Author:
Herv Drolon
- - - - - - - - - - -

Public Member Functions

virtual ~fipObject ()
 Destructor.
Information functions
virtual BOOL isValid () const =0
 Returns TRUE if the object is allocated, FALSE otherwise.
-

Constructor & Destructor Documentation

- -
-
- - - - - - - - -
virtual fipObject::~fipObject (  )  [inline, virtual]
-
-
- -

-Destructor. -

- -

-

-


Member Function Documentation

- -
-
- - - - - - - - -
virtual BOOL fipObject::isValid (  )  const [pure virtual]
-
-
- -

-Returns TRUE if the object is allocated, FALSE otherwise. -

- -

Implemented in fipImage, fipWinImage, fipMemoryIO, fipMultiPage, fipTag, and fipMetadataFind.

- -
-

-


The documentation for this class was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipObject.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipObject.png deleted file mode 100644 index 5b398b4..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipObject.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipTag-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipTag-members.html deleted file mode 100644 index 2149e20..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipTag-members.html +++ /dev/null @@ -1,56 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipTag Member List

This is the complete list of members for fipTag, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - -
_tagfipTag [protected]
fipTag()fipTag
fipTag(const fipTag &tag)fipTag
getCount() const fipTag
getDescription() const fipTag
getID() const fipTag
getKey() const fipTag
getLength() const fipTag
getType() const fipTag
getValue() const fipTag
isValid() const fipTag [virtual]
operator FITAG *()fipTag [inline]
operator=(const fipTag &tag)fipTag
operator=(FITAG *tag)fipTag
setCount(DWORD count)fipTag
setDescription(const char *description)fipTag
setID(WORD id)fipTag
setKey(const char *key)fipTag
setKeyValue(const char *key, const char *value)fipTag
setLength(DWORD length)fipTag
setType(FREE_IMAGE_MDTYPE type)fipTag
setValue(const void *value)fipTag
toString(FREE_IMAGE_MDMODEL model, char *Make=NULL) const fipTag
~fipObject()fipObject [inline, virtual]
~fipTag()fipTag [virtual]


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipTag.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipTag.html deleted file mode 100644 index 858c875..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipTag.html +++ /dev/null @@ -1,707 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipTag Class Reference

#include <FreeImagePlus.h> -

-

-Inheritance diagram for fipTag:
-
- -

- -fipObject - -
- -

-List of all members.


Detailed Description

-FreeImage Tag. -

-FreeImage uses this structure to store metadata information. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

 operator FITAG * ()
 Returns a pointer to the FITAG data.
BOOL isValid () const
 Returns TRUE if the tag is allocated, FALSE otherwise.
const char * toString (FREE_IMAGE_MDMODEL model, char *Make=NULL) const
 Converts a FreeImage tag structure to a string that represents the interpreted tag value.
Creation & Destruction
 fipTag ()
 Constructor.
virtual ~fipTag ()
 Destructor.
BOOL setKeyValue (const char *key, const char *value)
 Construct a FIDT_ASCII tag (ASCII string).
Copying
 fipTag (const fipTag &tag)
 Copy constructor.
fipTagoperator= (const fipTag &tag)
 Copy constructor.
fipTagoperator= (FITAG *tag)
 Assignement operator</b>
- Copy the input pointer and manage its destruction

Tag accessors
const char * getKey () const
 Returns the tag field name (unique inside a metadata model).
const char * getDescription () const
 Returns the tag description if available, returns NULL otherwise.
WORD getID () const
 Returns the tag ID if available, returns 0 otherwise.
FREE_IMAGE_MDTYPE getType () const
 Returns the tag data type.
DWORD getCount () const
 Returns the number of components in the tag (in tag type units).
DWORD getLength () const
 Returns the length of the tag value in bytes.
const void * getValue () const
 Returns the tag value.
BOOL setKey (const char *key)
 Set the tag field name.
BOOL setDescription (const char *description)
 Set the (usually optional) tag description.
BOOL setID (WORD id)
 Set the (usually optional) tad ID.
BOOL setType (FREE_IMAGE_MDTYPE type)
 Set the tag data type.
BOOL setCount (DWORD count)
 Set the number of data in the tag.
BOOL setLength (DWORD length)
 Set the length of the tag value, in bytes.
BOOL setValue (const void *value)
 Set the tag value.

Protected Attributes

FITAG * _tag
 Pointer to a FreeImage tag.
-


Constructor & Destructor Documentation

- -
-
- - - - - - - - -
fipTag::fipTag (  ) 
-
-
- -

-Constructor. -

-

See also:
FreeImage_CreateTag
- -
-

- -

-
- - - - - - - - -
virtual fipTag::~fipTag (  )  [virtual]
-
-
- -

-Destructor. -

-

See also:
FreeImage_DeleteTag
- -
-

- -

-
- - - - - - - - - -
fipTag::fipTag (const fipTag tag  ) 
-
-
- -

-Copy constructor. -

-

See also:
FreeImage_CloneTag
- -
-

-


Member Function Documentation

- -
-
- - - - - - - - - - - - - - - - - - -
BOOL fipTag::setKeyValue (const char *  key,
const char *  value 
)
-
-
- -

-Construct a FIDT_ASCII tag (ASCII string). -

-
- This method is useful to store comments or IPTC tags.

Parameters:
- - - -
name Field name
value Field value
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_CreateTag
- -
-

- -

-
- - - - - - - - - -
fipTag& fipTag::operator= (const fipTag tag  ) 
-
-
- -

-Copy constructor. -

-

See also:
FreeImage_CloneTag
- -
-

- -

-
- - - - - - - - - -
fipTag& fipTag::operator= (FITAG *  tag  ) 
-
-
- -

-Assignement operator</b>
- Copy the input pointer and manage its destruction
-

-

See also:
operator FITAG*()
- -
-

- -

-
- - - - - - - - -
fipTag::operator FITAG * (  )  [inline]
-
-
- -

-Returns a pointer to the FITAG data. -

-Used for direct access from FREEIMAGE functions or from your own low level C functions.

See also:
operator=(FITAG *tag)
- -
-

- -

-
- - - - - - - - -
BOOL fipTag::isValid (  )  const [virtual]
-
-
- -

-Returns TRUE if the tag is allocated, FALSE otherwise. -

- -

Implements fipObject.

- -
-

- -

-
- - - - - - - - -
const char* fipTag::getKey (  )  const
-
-
- -

-Returns the tag field name (unique inside a metadata model). -

-

See also:
FreeImage_GetTagKey
- -
-

- -

-
- - - - - - - - -
const char* fipTag::getDescription (  )  const
-
-
- -

-Returns the tag description if available, returns NULL otherwise. -

-

See also:
FreeImage_GetTagDescription
- -
-

- -

-
- - - - - - - - -
WORD fipTag::getID (  )  const
-
-
- -

-Returns the tag ID if available, returns 0 otherwise. -

-

See also:
FreeImage_GetTagID
- -
-

- -

-
- - - - - - - - -
FREE_IMAGE_MDTYPE fipTag::getType (  )  const
-
-
- -

-Returns the tag data type. -

-

See also:
FreeImage_GetTagType
- -
-

- -

-
- - - - - - - - -
DWORD fipTag::getCount (  )  const
-
-
- -

-Returns the number of components in the tag (in tag type units). -

-

See also:
FreeImage_GetTagCount
- -
-

- -

-
- - - - - - - - -
DWORD fipTag::getLength (  )  const
-
-
- -

-Returns the length of the tag value in bytes. -

-

See also:
FreeImage_GetTagLength
- -
-

- -

-
- - - - - - - - -
const void* fipTag::getValue (  )  const
-
-
- -

-Returns the tag value. -

-

See also:
FreeImage_GetTagValue
- -
-

- -

-
- - - - - - - - - -
BOOL fipTag::setKey (const char *  key  ) 
-
-
- -

-Set the tag field name. -

-

Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_SetTagKey
- -
-

- -

-
- - - - - - - - - -
BOOL fipTag::setDescription (const char *  description  ) 
-
-
- -

-Set the (usually optional) tag description. -

-

Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_SetTagDescription
- -
-

- -

-
- - - - - - - - - -
BOOL fipTag::setID (WORD  id  ) 
-
-
- -

-Set the (usually optional) tad ID. -

-

Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_SetTagID
- -
-

- -

-
- - - - - - - - - -
BOOL fipTag::setType (FREE_IMAGE_MDTYPE  type  ) 
-
-
- -

-Set the tag data type. -

-

Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_SetTagType
- -
-

- -

-
- - - - - - - - - -
BOOL fipTag::setCount (DWORD  count  ) 
-
-
- -

-Set the number of data in the tag. -

-

Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_SetTagCount
- -
-

- -

-
- - - - - - - - - -
BOOL fipTag::setLength (DWORD  length  ) 
-
-
- -

-Set the length of the tag value, in bytes. -

-

Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_SetTagLength
- -
-

- -

-
- - - - - - - - - -
BOOL fipTag::setValue (const void *  value  ) 
-
-
- -

-Set the tag value. -

-

Returns:
Returns TRUE if successful, returns FALSE otherwise
-
See also:
FreeImage_SetTagValue
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
const char* fipTag::toString (FREE_IMAGE_MDMODEL  model,
char *  Make = NULL 
) const
-
-
- -

-Converts a FreeImage tag structure to a string that represents the interpreted tag value. -

-

Parameters:
- - - -
model Metadata model specification (metadata model from which the tag was extracted)
Make Camera model (not used yet)
-
- -
-

-


Member Data Documentation

- -
-
- - - - -
FITAG* fipTag::_tag [protected]
-
-
- -

-Pointer to a FreeImage tag. -

- -

-

-


The documentation for this class was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipTag.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipTag.png deleted file mode 100644 index 7229802..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipTag.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipWinImage-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipWinImage-members.html deleted file mode 100644 index 87314ff..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipWinImage-members.html +++ /dev/null @@ -1,147 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipWinImage Member List

This is the complete list of members for fipWinImage, including all inherited members.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_bDeleteMefipWinImage [mutable, protected]
_bHasChangedfipImage [mutable, protected]
_dibfipImage [protected]
_display_dibfipWinImage [mutable, protected]
_fiffipImage [protected]
_tmofipWinImage [protected]
_tmo_param_1fipWinImage [protected]
_tmo_param_2fipWinImage [protected]
_tmo_param_3fipWinImage [protected]
_tmo_param_4fipWinImage [protected]
accessPixels() const fipImage
adjustBrightness(double percentage)fipImage
adjustBrightnessContrastGamma(double brightness, double contrast, double gamma)fipImage
adjustContrast(double percentage)fipImage
adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel)fipImage
adjustGamma(double gamma)fipImage
captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow)fipWinImage
clear()fipWinImage [virtual]
colorQuantize(FREE_IMAGE_QUANTIZE algorithm)fipImage
combineChannels(fipImage &red, fipImage &green, fipImage &blue)fipImage
convertTo16Bits555()fipImage
convertTo16Bits565()fipImage
convertTo24Bits()fipImage
convertTo32Bits()fipImage
convertTo4Bits()fipImage
convertTo8Bits()fipImage
convertToGrayscale()fipImage
convertToRGBF()fipImage
convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear=TRUE)fipImage
copyFromBitmap(HBITMAP hbmp)fipWinImage
copyFromHandle(HANDLE hMem)fipWinImage
copySubImage(fipImage &dst, int left, int top, int right, int bottom) const fipImage
copyToClipboard(HWND hWndNewOwner) const fipWinImage
copyToHandle() const fipWinImage
crop(int left, int top, int right, int bottom)fipImage
dither(FREE_IMAGE_DITHER algorithm)fipImage
draw(HDC hDC, RECT &rcDest) const fipWinImage [inline]
drawEx(HDC hDC, RECT &rcDest, BOOL useFileBkg=FALSE, RGBQUAD *appBkColor=NULL, FIBITMAP *bg=NULL) const fipWinImage
fipImage(FREE_IMAGE_TYPE image_type=FIT_BITMAP, unsigned width=0, unsigned height=0, unsigned bpp=0)fipImage
fipImage(const fipImage &src)fipImage
fipMultiPage (defined in fipImage)fipImage [friend]
fipWinImage(FREE_IMAGE_TYPE image_type=FIT_BITMAP, unsigned width=0, unsigned height=0, unsigned bpp=0)fipWinImage
flipHorizontal()fipImage
flipVertical()fipImage
getBitsPerPixel() const fipImage
getChannel(fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel) const fipImage
getColorsUsed() const fipImage
getColorType() const fipImage
getFileBkColor(RGBQUAD *bkcolor) const fipImage
getHeight() const fipImage
getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel=FICC_BLACK) const fipImage
getHorizontalResolution() const fipImage
getImageSize() const fipImage
getImageType() const fipImage
getInfo() const fipImage
getInfoHeader() const fipImage
getLine() const fipImage
getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag) const fipImage
getMetadataCount(FREE_IMAGE_MDMODEL model) const fipImage
getPalette() const fipImage
getPaletteSize() const fipImage
getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const fipImage
getPixelIndex(unsigned x, unsigned y, BYTE *value) const fipImage
getScanLine(unsigned scanline) const fipImage
getScanWidth() const fipImage
getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const fipWinImage
getTransparencyCount() const fipImage
getTransparencyTable() const fipImage
getVerticalResolution() const fipImage
getWidth() const fipImage
hasFileBkColor() const fipImage
identifyFIF(const char *lpszPathName)fipImage [static]
identifyFIFFromHandle(FreeImageIO *io, fi_handle handle)fipImage [static]
identifyFIFFromMemory(FIMEMORY *hmem)fipImage [static]
identifyFIFU(const wchar_t *lpszPathName)fipImage [static]
invert()fipImage
isGrayscale() const fipImage
isModified()fipImage [inline]
isTransparent() const fipImage
isValid() const fipWinImage [virtual]
load(const char *lpszPathName, int flag=0)fipImage
loadFromHandle(FreeImageIO *io, fi_handle handle, int flag=0)fipImage
loadFromMemory(fipMemoryIO &memIO, int flag=0)fipImage
loadU(const wchar_t *lpszPathName, int flag=0)fipImage
makeThumbnail(unsigned max_size, BOOL convert=TRUE)fipImage
operator FIBITMAP *()fipImage [inline]
operator=(const fipImage &src)fipWinImage
operator=(const fipWinImage &src)fipWinImage
fipImage::operator=(FIBITMAP *dib)fipImage
pasteFromClipboard()fipWinImage
pasteSubImage(fipImage &src, int left, int top, int alpha=256)fipImage
replace(FIBITMAP *new_dib) (defined in fipImage)fipImage [protected]
rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter)fipImage
rotate(double angle, const void *bkcolor=NULL)fipImage
rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask)fipImage
save(const char *lpszPathName, int flag=0) const fipImage
saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag=0) const fipImage
saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO &memIO, int flag=0) const fipImage
saveU(const wchar_t *lpszPathName, int flag=0) const fipImage
setChannel(fipImage &image, FREE_IMAGE_COLOR_CHANNEL channel)fipImage
setFileBkColor(RGBQUAD *bkcolor)fipImage
setHorizontalResolution(double value)fipImage
setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag &tag)fipImage
setModified(BOOL bStatus=TRUE)fipImage [inline]
setPixelColor(unsigned x, unsigned y, RGBQUAD *value)fipImage
setPixelIndex(unsigned x, unsigned y, BYTE *value)fipImage
setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask=0, unsigned green_mask=0, unsigned blue_mask=0)fipImage
setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param=0, double second_param=0, double third_param=1, double fourth_param=0)fipWinImage
setTransparencyTable(BYTE *table, int count)fipImage
setVerticalResolution(double value)fipImage
splitChannels(fipImage &RedChannel, fipImage &GreenChannel, fipImage &BlueChannel)fipImage
threshold(BYTE T)fipImage
toneMapping(FREE_IMAGE_TMO tmo, double first_param=0, double second_param=0, double third_param=1, double fourth_param=0)fipImage
~fipImage()fipImage [virtual]
~fipObject()fipObject [inline, virtual]
~fipWinImage()fipWinImage [virtual]


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipWinImage.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipWinImage.html deleted file mode 100644 index ef15551..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipWinImage.html +++ /dev/null @@ -1,792 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

fipWinImage Class Reference

#include <FreeImagePlus.h> -

-

-Inheritance diagram for fipWinImage:
-
- -

- -fipImage -fipObject - -
- -

-List of all members.


Detailed Description

-A class designed for MS Windows (TM) platforms. -

-fipWinImage provides methods used to :

    -
  • -Display a DIB on the screen
  • -
  • -Copy / Paste a DIB to/from Windows devices (HANDLE, HBITMAP, Clipboard)
  • -
  • -Capture a window (HWND) and convert it to an image
  • -
-
Version:
FreeImage 3
-
Author:
Herv Drolon
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Public Member Functions

Creation & Destruction
 fipWinImage (FREE_IMAGE_TYPE image_type=FIT_BITMAP, unsigned width=0, unsigned height=0, unsigned bpp=0)
 Constructor.
virtual ~fipWinImage ()
 Destructor.
virtual void clear ()
 Destroy image data.
BOOL isValid () const
 Returns TRUE if the image is allocated, FALSE otherwise.
Copying
fipWinImageoperator= (const fipImage &src)
 Copy constructor.
fipWinImageoperator= (const fipWinImage &src)
 Copy constructor Delete internal _display_dib data and copy tone mapping parameters.
HANDLE copyToHandle () const
 Clone function used for clipboard copy.
BOOL copyFromHandle (HANDLE hMem)
 Copy constructor used for clipboard paste.
BOOL copyFromBitmap (HBITMAP hbmp)
 Copy constructor.
Clipboard operations
BOOL copyToClipboard (HWND hWndNewOwner) const
 Clipboard copy.
BOOL pasteFromClipboard ()
 Retrieves data from the clipboard.
Screen capture
BOOL captureWindow (HWND hWndApplicationWindow, HWND hWndSelectedWindow)
 Capture a window and convert it to an image.
Painting operations
void draw (HDC hDC, RECT &rcDest) const
void drawEx (HDC hDC, RECT &rcDest, BOOL useFileBkg=FALSE, RGBQUAD *appBkColor=NULL, FIBITMAP *bg=NULL) const
void setToneMappingOperator (FREE_IMAGE_TMO tmo, double first_param=0, double second_param=0, double third_param=1, double fourth_param=0)
 Select a tone mapping algorithm used for drawing and set the image as modified so that the display will be refreshed.
void getToneMappingOperator (FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const
 Get the tone mapping algorithm used for drawing, with its parameters.

Protected Attributes

FIBITMAP * _display_dib
 DIB used for display (this allow to display non-standard bitmaps).
BOOL _bDeleteMe
 remember to delete _display_dib
FREE_IMAGE_TMO _tmo
 tone mapping operator
double _tmo_param_1
 first tone mapping algorithm parameter
double _tmo_param_2
 second tone mapping algorithm parameter
double _tmo_param_3
 third tone mapping algorithm parameter
double _tmo_param_4
 fourth tone mapping algorithm parameter
-

Constructor & Destructor Documentation

- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fipWinImage::fipWinImage (FREE_IMAGE_TYPE  image_type = FIT_BITMAP,
unsigned  width = 0,
unsigned  height = 0,
unsigned  bpp = 0 
)
-
-
- -

-Constructor. -

- -

-

- -

-
- - - - - - - - -
virtual fipWinImage::~fipWinImage (  )  [virtual]
-
-
- -

-Destructor. -

- -

-

-


Member Function Documentation

- -
-
- - - - - - - - -
virtual void fipWinImage::clear (  )  [virtual]
-
-
- -

-Destroy image data. -

- -

Reimplemented from fipImage.

- -
-

- -

-
- - - - - - - - -
BOOL fipWinImage::isValid (  )  const [virtual]
-
-
- -

-Returns TRUE if the image is allocated, FALSE otherwise. -

- -

Reimplemented from fipImage.

- -
-

- -

-
- - - - - - - - - -
fipWinImage& fipWinImage::operator= (const fipImage src  ) 
-
-
- -

-Copy constructor. -

-Delete internal _display_dib data and copy the base class image data. Tone mapping parameters are left unchanged.

See also:
FreeImage_Clone
- -

Reimplemented from fipImage.

- -
-

- -

-
- - - - - - - - - -
fipWinImage& fipWinImage::operator= (const fipWinImage src  ) 
-
-
- -

-Copy constructor Delete internal _display_dib data and copy tone mapping parameters. -

-Copy also the base class image data.

See also:
FreeImage_Clone
- -
-

- -

-
- - - - - - - - -
HANDLE fipWinImage::copyToHandle (  )  const
-
-
- -

-Clone function used for clipboard copy. -

-
- Convert the FIBITMAP image to a DIB, and transfer the DIB in a global bitmap handle.
- For non standard bitmaps, the BITMAPINFOHEADER->biCompression field is set to 0xFF + FreeImage_GetImageType(_dib), in order to recognize the bitmap as non standard. -

-

- -

-
- - - - - - - - - -
BOOL fipWinImage::copyFromHandle (HANDLE  hMem  ) 
-
-
- -

-Copy constructor used for clipboard paste. -

-
- Converts a global object to a FIBITMAP. The clipboard format must be CF_DIB.
- When the BITMAPINFOHEADER->biCompression field is set to 0xFF + [one of the predefined FREE_IMAGE_TYPE], the bitmap is recognized as non standard and correctly copied.

Returns:
Returns TRUE if successful, returns FALSE otherwise
- -
-

- -

-
- - - - - - - - - -
BOOL fipWinImage::copyFromBitmap (HBITMAP  hbmp  ) 
-
-
- -

-Copy constructor. -

-
- Converts a HBITMAP object to a FIBITMAP.

Returns:
Returns TRUE if successful, returns FALSE otherwise
- -
-

- -

-
- - - - - - - - - -
BOOL fipWinImage::copyToClipboard (HWND  hWndNewOwner  )  const
-
-
- -

-Clipboard copy. -

-

Parameters:
- - -
hWndNewOwner Handle to the window to be associated with the open clipboard. In MFC, you can use AfxGetApp()->m_pMainWnd->GetSafeHwnd().
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise
- -
-

- -

-
- - - - - - - - -
BOOL fipWinImage::pasteFromClipboard (  ) 
-
-
- -

-Retrieves data from the clipboard. -

-The clipboard format must be CF_DIB.

Returns:
Returns TRUE if successful, returns FALSE otherwise
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
BOOL fipWinImage::captureWindow (HWND  hWndApplicationWindow,
HWND  hWndSelectedWindow 
)
-
-
- -

-Capture a window and convert it to an image. -

-

Parameters:
- - - -
hWndApplicationWindow Handle to the application main window
hWndSelectedWindow Handle to the window to be captured
-
-
Returns:
Returns TRUE if successful, returns FALSE otherwise
- -
-

- -

-
- - - - - - - - - - - - - - - - - - -
void fipWinImage::draw (HDC  hDC,
RECT &  rcDest 
) const [inline]
-
-
- -

-Draw (stretch) the image on a HDC, using StretchDIBits.

-When the image is transparent or has a file background, this function composite the foreground image against a checkerboard background image.

Parameters:
- - - -
hDC Handle to the device context
rcDest Destination rectangle
-
-
See also:
FreeImage_Composite
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void fipWinImage::drawEx (HDC  hDC,
RECT &  rcDest,
BOOL  useFileBkg = FALSE,
RGBQUAD *  appBkColor = NULL,
FIBITMAP *  bg = NULL 
) const
-
-
- -

-Draw (stretch) the image on a HDC, using StretchDIBits.

-When the image is transparent or has a file background, this function can composite the foreground image against a checkerboard background image, against a single background color or against a user background image.
- When the image is a High Dynamic Range image (48-bit or RGB float), this function will apply a tone mapping operator before drawing the image.
- The original image (located in the fipImage class) will not be affected by any of the operations that could be done in order to display it.

Parameters:
- - - - - - -
hDC Handle to the device context
rcDest Destination rectangle
useFileBkg When set to TRUE, the function uses the file color background if there is one
appBkColor When a color is given, the function uses it as the background color
bg When a FIBITMAP is given, the function uses it as the background image
-
-
See also:
FreeImage_Composite

-setToneMappingOperator

- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void fipWinImage::setToneMappingOperator (FREE_IMAGE_TMO  tmo,
double  first_param = 0,
double  second_param = 0,
double  third_param = 1,
double  fourth_param = 0 
)
-
-
- -

-Select a tone mapping algorithm used for drawing and set the image as modified so that the display will be refreshed. -

-

Parameters:
- - - - - - -
tmo Tone mapping operator
first_param First tone mapping algorithm parameter
second_param Second tone mapping algorithm parameter
third_param Third tone mapping algorithm parameter
fourth_param Fourth tone mapping algorithm parameter
-
-
See also:
FreeImage_ToneMapping
- -
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void fipWinImage::getToneMappingOperator (FREE_IMAGE_TMO *  tmo,
double *  first_param,
double *  second_param,
double *  third_param,
double *  fourth_param 
) const
-
-
- -

-Get the tone mapping algorithm used for drawing, with its parameters. -

-

Parameters:
- - - - - - -
tmo Tone mapping operator
first_param First tone mapping algorithm parameter
second_param Second tone mapping algorithm parameter
third_param Third tone mapping algorithm parameter
fourth_param Fourth tone mapping algorithm parameter
-
-
See also:
FreeImage_ToneMapping
- -
-

-


Member Data Documentation

- -
-
- - - - -
FIBITMAP* fipWinImage::_display_dib [mutable, protected]
-
-
- -

-DIB used for display (this allow to display non-standard bitmaps). -

- -

-

- -

-
- - - - -
BOOL fipWinImage::_bDeleteMe [mutable, protected]
-
-
- -

-remember to delete _display_dib -

- -

-

- -

-
- - - - -
FREE_IMAGE_TMO fipWinImage::_tmo [protected]
-
-
- -

-tone mapping operator -

- -

-

- -

-
- - - - -
double fipWinImage::_tmo_param_1 [protected]
-
-
- -

-first tone mapping algorithm parameter -

- -

-

- -

-
- - - - -
double fipWinImage::_tmo_param_2 [protected]
-
-
- -

-second tone mapping algorithm parameter -

- -

-

- -

-
- - - - -
double fipWinImage::_tmo_param_3 [protected]
-
-
- -

-third tone mapping algorithm parameter -

- -

-

- -

-
- - - - -
double fipWinImage::_tmo_param_4 [protected]
-
-
- -

-fourth tone mapping algorithm parameter -

- -

-

-


The documentation for this class was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipWinImage.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipWinImage.png deleted file mode 100644 index e881ae0..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/classfipWinImage.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/doxygen.css b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/doxygen.css deleted file mode 100644 index c7db1a8..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/doxygen.css +++ /dev/null @@ -1,358 +0,0 @@ -BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { - font-family: Geneva, Arial, Helvetica, sans-serif; -} -BODY,TD { - font-size: 90%; -} -H1 { - text-align: center; - font-size: 160%; -} -H2 { - font-size: 120%; -} -H3 { - font-size: 100%; -} -CAPTION { font-weight: bold } -DIV.qindex { - width: 100%; - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - padding: 2px; - line-height: 140%; -} -DIV.nav { - width: 100%; - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - padding: 2px; - line-height: 140%; -} -DIV.navtab { - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; -} -TD.navtab { - font-size: 70%; -} -A.qindex { - text-decoration: none; - font-weight: bold; - color: #1A419D; -} -A.qindex:visited { - text-decoration: none; - font-weight: bold; - color: #1A419D -} -A.qindex:hover { - text-decoration: none; - background-color: #ddddff; -} -A.qindexHL { - text-decoration: none; - font-weight: bold; - background-color: #6666cc; - color: #ffffff; - border: 1px double #9295C2; -} -A.qindexHL:hover { - text-decoration: none; - background-color: #6666cc; - color: #ffffff; -} -A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } -A.el { text-decoration: none; font-weight: bold } -A.elRef { font-weight: bold } -A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} -A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} -A.codeRef:link { font-weight: normal; color: #0000FF} -A.codeRef:visited { font-weight: normal; color: #0000FF} -A:hover { text-decoration: none; background-color: #f2f2ff } -DL.el { margin-left: -1cm } -.fragment { - font-family: monospace, fixed; - font-size: 95%; -} -PRE.fragment { - border: 1px solid #CCCCCC; - background-color: #f5f5f5; - margin-top: 4px; - margin-bottom: 4px; - margin-left: 2px; - margin-right: 8px; - padding-left: 6px; - padding-right: 6px; - padding-top: 4px; - padding-bottom: 4px; -} -DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } - -DIV.groupHeader { - margin-left: 16px; - margin-top: 12px; - margin-bottom: 6px; - font-weight: bold; -} -DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } -BODY { - background: white; - color: black; - margin-right: 20px; - margin-left: 20px; -} -TD.indexkey { - background-color: #e8eef2; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px; - border: 1px solid #CCCCCC; -} -TD.indexvalue { - background-color: #e8eef2; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px; - border: 1px solid #CCCCCC; -} -TR.memlist { - background-color: #f0f0f0; -} -P.formulaDsp { text-align: center; } -IMG.formulaDsp { } -IMG.formulaInl { vertical-align: middle; } -SPAN.keyword { color: #008000 } -SPAN.keywordtype { color: #604020 } -SPAN.keywordflow { color: #e08000 } -SPAN.comment { color: #800000 } -SPAN.preprocessor { color: #806020 } -SPAN.stringliteral { color: #002080 } -SPAN.charliteral { color: #008080 } -.mdescLeft { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.mdescRight { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.memItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplParams { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - color: #606060; - background-color: #FAFAFA; - font-size: 80%; -} -.search { color: #003399; - font-weight: bold; -} -FORM.search { - margin-bottom: 0px; - margin-top: 0px; -} -INPUT.search { font-size: 75%; - color: #000080; - font-weight: normal; - background-color: #e8eef2; -} -TD.tiny { font-size: 75%; -} -a { - color: #1A41A8; -} -a:visited { - color: #2A3798; -} -.dirtab { padding: 4px; - border-collapse: collapse; - border: 1px solid #84b0c7; -} -TH.dirtab { background: #e8eef2; - font-weight: bold; -} -HR { height: 1px; - border: none; - border-top: 1px solid black; -} - -/* Style for detailed member documentation */ -.memtemplate { - font-size: 80%; - color: #606060; - font-weight: normal; -} -.memnav { - background-color: #e8eef2; - border: 1px solid #84b0c7; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; -} -.memitem { - padding: 4px; - background-color: #eef3f5; - border-width: 1px; - border-style: solid; - border-color: #dedeee; - -moz-border-radius: 8px 8px 8px 8px; -} -.memname { - white-space: nowrap; - font-weight: bold; -} -.memdoc{ - padding-left: 10px; -} -.memproto { - background-color: #d5e1e8; - width: 100%; - border-width: 1px; - border-style: solid; - border-color: #84b0c7; - font-weight: bold; - -moz-border-radius: 8px 8px 8px 8px; -} -.paramkey { - text-align: right; -} -.paramtype { - white-space: nowrap; -} -.paramname { - color: #602020; - font-style: italic; - white-space: nowrap; -} -/* End Styling for detailed member documentation */ - -/* for the tree view */ -.ftvtree { - font-family: sans-serif; - margin:0.5em; -} -.directory { font-size: 9pt; font-weight: bold; } -.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } -.directory > h3 { margin-top: 0; } -.directory p { margin: 0px; white-space: nowrap; } -.directory div { display: none; margin: 0px; } -.directory img { vertical-align: -30%; } diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/doxygen.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/doxygen.png deleted file mode 100644 index f0a274b..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/doxygen.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/files.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/files.html deleted file mode 100644 index e0b248a..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/files.html +++ /dev/null @@ -1,26 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
-

FreeImagePlus File List

Here is a list of all documented files with brief descriptions: - - -
FreeImage.h [code]
FreeImagePlus.h [code]
-
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/footer.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/footer.html deleted file mode 100644 index 5c88d31..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/footer.html +++ /dev/null @@ -1,7 +0,0 @@ -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/freeimage.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/freeimage.png deleted file mode 100644 index 4fa7923..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/freeimage.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/freeimagedoc.jpg b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/freeimagedoc.jpg deleted file mode 100644 index 0a31440..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/freeimagedoc.jpg and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2blank.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2blank.png deleted file mode 100644 index 493c3c0..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2blank.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2doc.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2doc.png deleted file mode 100644 index f72999f..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2doc.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2folderclosed.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2folderclosed.png deleted file mode 100644 index d6d0634..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2folderclosed.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2folderopen.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2folderopen.png deleted file mode 100644 index bbe2c91..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2folderopen.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2lastnode.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2lastnode.png deleted file mode 100644 index e7b9ba9..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2lastnode.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2link.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2link.png deleted file mode 100644 index 14f3fed..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2link.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2mlastnode.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2mlastnode.png deleted file mode 100644 index 09ceb6a..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2mlastnode.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2mnode.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2mnode.png deleted file mode 100644 index 3254c05..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2mnode.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2node.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2node.png deleted file mode 100644 index c9f06a5..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2node.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2plastnode.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2plastnode.png deleted file mode 100644 index 0b07e00..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2plastnode.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2pnode.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2pnode.png deleted file mode 100644 index 2001b79..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2pnode.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2vertline.png b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2vertline.png deleted file mode 100644 index b330f3a..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/ftv2vertline.png and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/functions.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/functions.html deleted file mode 100644 index 0aba130..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/functions.html +++ /dev/null @@ -1,446 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -
- -
-
- -
- -

-Here is a list of all documented class members with links to the class documentation for each member: -

-

- _ -

-

- a -

-

- c -

-

- d -

-

- f -

-

- g -

-

- h -

-

- i -

-

- l -

-

- m -

-

- o -

-

- p -

-

- r -

-

- s -

-

- t -

-

- u -

-

- w -

-

- ~ -

-
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/functions_func.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/functions_func.html deleted file mode 100644 index edf0494..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/functions_func.html +++ /dev/null @@ -1,409 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -
- -
-
- -
- -

-  -

-

- a -

-

- c -

-

- d -

-

- f -

-

- g -

-

- h -

-

- i -

-

- l -

-

- m -

-

- o -

-

- p -

-

- r -

-

- s -

-

- t -

-

- u -

-

- w -

-

- ~ -

-
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/functions_vars.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/functions_vars.html deleted file mode 100644 index b245ad5..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/functions_vars.html +++ /dev/null @@ -1,75 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -
- -
-  -

-

-
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/header.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/header.html deleted file mode 100644 index 253df15..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/header.html +++ /dev/null @@ -1,7 +0,0 @@ - - -FreeImagePlus - - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/hierarchy.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/hierarchy.html deleted file mode 100644 index 98e5933..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/hierarchy.html +++ /dev/null @@ -1,48 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

FreeImagePlus Class Hierarchy

This inheritance list is sorted roughly, but not completely, alphabetically: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.hhc b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.hhc deleted file mode 100644 index 61dd079..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.hhc +++ /dev/null @@ -1,47 +0,0 @@ - - - - - -
    -
  • -
      -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    -
  • -
      -
    • -
        -
      • -
          -
        • -
        -
      • -
      • -
      • -
      • -
      -
    • -
    • -
    • -
    • -
    • -
    -
  • -
  • -
      -
    • -
    • -
    -
diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.hhk b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.hhk deleted file mode 100644 index 015c497..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.hhk +++ /dev/null @@ -1,407 +0,0 @@ - - - - - -
    -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
      -
    • -
    • -
    -
  • -
      -
    • -
    • -
    -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
      -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    -
  • -
      -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    -
  • -
      -
    • -
    • -
    • -
    • -
    • -
    • -
    -
  • -
      -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    -
  • -
      -
    • -
    • -
    -
  • -
      -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    -
  • -
      -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
      -
    • -
    • -
    • -
    • -
    • -
    • -
    • -
    -
  • -
      -
    • -
    • -
    -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
      -
    • -
    • -
    • -
    -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
      -
    • -
    • -
    -
  • -
  • -
      -
    • -
    • -
    -
  • -
      -
    • -
    • -
    -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
      -
    • -
    • -
    -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.hhp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.hhp deleted file mode 100644 index 63a696d..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.hhp +++ /dev/null @@ -1,52 +0,0 @@ -[OPTIONS] -Compatibility=1.1 -Full-text search=Yes -Contents file=index.hhc -Default Window=main -Default topic=main.html -Index file=index.hhk -Language=0x409 English (United States) -Title=FreeImagePlus - -[WINDOWS] -main="FreeImagePlus","index.hhc","index.hhk","main.html","main.html",,,,,0x23520,,0x387e,,,,,,,,0 - -[FILES] -main.html -FreeImage_8h-source.html -FreeImagePlus_8h-source.html -annotated.html -classes.html -hierarchy.html -functions.html -functions_func.html -functions_vars.html -classfipImage.html -classfipImage-members.html -classfipMemoryIO.html -classfipMemoryIO-members.html -classfipMetadataFind.html -classfipMetadataFind-members.html -classfipMultiPage.html -classfipMultiPage-members.html -classfipObject.html -classfipObject-members.html -classfipTag.html -classfipTag-members.html -classfipWinImage.html -classfipWinImage-members.html -structtagFICOMPLEX.html -structtagFICOMPLEX-members.html -structtagFIRGB16.html -structtagFIRGB16-members.html -structtagFIRGBA16.html -structtagFIRGBA16-members.html -structtagFIRGBAF.html -structtagFIRGBAF-members.html -structtagFIRGBF.html -structtagFIRGBF-members.html -files.html -tabs.css -tab_b.gif -tab_l.gif -tab_r.gif diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.html deleted file mode 100644 index 12698a3..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - -FreeImagePlus - - - - - <a href="main.html">Frames are disabled. Click here to go to the main page.</a> - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/main.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/main.html deleted file mode 100644 index 1279c48..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/main.html +++ /dev/null @@ -1,18 +0,0 @@ - - -FreeImagePlus - - - - -
-Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  
-
-

-

-
-

-

A C++ wrapper for FreeImage 3

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFICOMPLEX-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFICOMPLEX-members.html deleted file mode 100644 index 42f313a..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFICOMPLEX-members.html +++ /dev/null @@ -1,33 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

tagFICOMPLEX Member List

This is the complete list of members for tagFICOMPLEX, including all inherited members.

- - -
itagFICOMPLEX
rtagFICOMPLEX


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFICOMPLEX.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFICOMPLEX.html deleted file mode 100644 index 57ab77d..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFICOMPLEX.html +++ /dev/null @@ -1,82 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

tagFICOMPLEX Struct Reference

#include <FreeImage.h> -

- -

-List of all members.


Detailed Description

-Data structure for COMPLEX type (complex number). - - - - - - - - -

Public Attributes

double r
 real part
double i
 imaginary part
-

Member Data Documentation

- -
-
- - - - -
double tagFICOMPLEX::r
-
-
- -

-real part -

- -

-

- -

-
- - - - -
double tagFICOMPLEX::i
-
-
- -

-imaginary part -

- -

-

-


The documentation for this struct was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGB16-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGB16-members.html deleted file mode 100644 index b1e5530..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGB16-members.html +++ /dev/null @@ -1,34 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

tagFIRGB16 Member List

This is the complete list of members for tagFIRGB16, including all inherited members.

- - - -
blue (defined in tagFIRGB16)tagFIRGB16
green (defined in tagFIRGB16)tagFIRGB16
red (defined in tagFIRGB16)tagFIRGB16


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGB16.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGB16.html deleted file mode 100644 index 588b56e..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGB16.html +++ /dev/null @@ -1,50 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

tagFIRGB16 Struct Reference

#include <FreeImage.h> -

- -

-List of all members.


Detailed Description

-48-bit RGB - - - - - - - - -

Public Attributes

-WORD red
-WORD green
-WORD blue
-
The documentation for this struct was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBA16-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBA16-members.html deleted file mode 100644 index c6413be..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBA16-members.html +++ /dev/null @@ -1,35 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

tagFIRGBA16 Member List

This is the complete list of members for tagFIRGBA16, including all inherited members.

- - - - -
alpha (defined in tagFIRGBA16)tagFIRGBA16
blue (defined in tagFIRGBA16)tagFIRGBA16
green (defined in tagFIRGBA16)tagFIRGBA16
red (defined in tagFIRGBA16)tagFIRGBA16


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBA16.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBA16.html deleted file mode 100644 index e3d5823..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBA16.html +++ /dev/null @@ -1,53 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

tagFIRGBA16 Struct Reference

#include <FreeImage.h> -

- -

-List of all members.


Detailed Description

-64-bit RGBA - - - - - - - - - - -

Public Attributes

-WORD red
-WORD green
-WORD blue
-WORD alpha
-
The documentation for this struct was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBAF-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBAF-members.html deleted file mode 100644 index 2aa8e68..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBAF-members.html +++ /dev/null @@ -1,35 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

tagFIRGBAF Member List

This is the complete list of members for tagFIRGBAF, including all inherited members.

- - - - -
alpha (defined in tagFIRGBAF)tagFIRGBAF
blue (defined in tagFIRGBAF)tagFIRGBAF
green (defined in tagFIRGBAF)tagFIRGBAF
red (defined in tagFIRGBAF)tagFIRGBAF


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBAF.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBAF.html deleted file mode 100644 index 15b7274..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBAF.html +++ /dev/null @@ -1,53 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

tagFIRGBAF Struct Reference

#include <FreeImage.h> -

- -

-List of all members.


Detailed Description

-128-bit RGBA Float - - - - - - - - - - -

Public Attributes

-float red
-float green
-float blue
-float alpha
-
The documentation for this struct was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBF-members.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBF-members.html deleted file mode 100644 index 971f112..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBF-members.html +++ /dev/null @@ -1,34 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

tagFIRGBF Member List

This is the complete list of members for tagFIRGBF, including all inherited members.

- - - -
blue (defined in tagFIRGBF)tagFIRGBF
green (defined in tagFIRGBF)tagFIRGBF
red (defined in tagFIRGBF)tagFIRGBF


-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBF.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBF.html deleted file mode 100644 index cabe562..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/structtagFIRGBF.html +++ /dev/null @@ -1,50 +0,0 @@ - - -FreeImagePlus - - - - - -
- -
- -

tagFIRGBF Struct Reference

#include <FreeImage.h> -

- -

-List of all members.


Detailed Description

-96-bit RGB Float - - - - - - - - -

Public Attributes

-float red
-float green
-float blue
-
The documentation for this struct was generated from the following file: -
-

-
-

- - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tab_b.gif b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tab_b.gif deleted file mode 100644 index 0d62348..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tab_b.gif and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tab_l.gif b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tab_l.gif deleted file mode 100644 index 9b1e633..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tab_l.gif and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tab_r.gif b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tab_r.gif deleted file mode 100644 index ce9dd9f..0000000 Binary files a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tab_r.gif and /dev/null differ diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tabs.css b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tabs.css deleted file mode 100644 index c37faaf..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tabs.css +++ /dev/null @@ -1,102 +0,0 @@ -/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ - -DIV.tabs -{ - float : left; - width : 100%; - background : url("tab_b.gif") repeat-x bottom; - margin-bottom : 4px; -} - -DIV.tabs UL -{ - margin : 0px; - padding-left : 10px; - list-style : none; -} - -DIV.tabs LI, DIV.tabs FORM -{ - display : inline; - margin : 0px; - padding : 0px; -} - -DIV.tabs FORM -{ - float : right; -} - -DIV.tabs A -{ - float : left; - background : url("tab_r.gif") no-repeat right top; - border-bottom : 1px solid #84B0C7; - font-size : x-small; - font-weight : bold; - text-decoration : none; -} - -DIV.tabs A:hover -{ - background-position: 100% -150px; -} - -DIV.tabs A:link, DIV.tabs A:visited, -DIV.tabs A:active, DIV.tabs A:hover -{ - color: #1A419D; -} - -DIV.tabs SPAN -{ - float : left; - display : block; - background : url("tab_l.gif") no-repeat left top; - padding : 5px 9px; - white-space : nowrap; -} - -DIV.tabs INPUT -{ - float : right; - display : inline; - font-size : 1em; -} - -DIV.tabs TD -{ - font-size : x-small; - font-weight : bold; - text-decoration : none; -} - - - -/* Commented Backslash Hack hides rule from IE5-Mac \*/ -DIV.tabs SPAN {float : none;} -/* End IE5-Mac hack */ - -DIV.tabs A:hover SPAN -{ - background-position: 0% -150px; -} - -DIV.tabs LI.current A -{ - background-position: 100% -150px; - border-width : 0px; -} - -DIV.tabs LI.current SPAN -{ - background-position: 0% -150px; - padding-bottom : 6px; -} - -DIV.nav -{ - background : none; - border : none; - border-bottom : 1px solid #84B0C7; -} diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tree.html b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tree.html deleted file mode 100644 index 7cdadbe..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/doc/tree.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - TreeView - - - - - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/FreeImagePlus.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/FreeImagePlus.cpp deleted file mode 100644 index efb8fe9..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/FreeImagePlus.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// ========================================================== -// FreeImagePlus.cpp : Defines the entry point for the DLL application. -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifdef _WIN32 -#include -#endif // _WIN32 - -#include "FreeImagePlus.h" - -//---------------------------------------------------------------------- - -#ifdef _WIN32 - -BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - - -#endif // _WIN32 diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipImage.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipImage.cpp deleted file mode 100644 index 6145351..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipImage.cpp +++ /dev/null @@ -1,910 +0,0 @@ -// ========================================================== -// fipImage class implementation -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "FreeImagePlus.h" - -/////////////////////////////////////////////////////////////////// -// Protected functions - -BOOL fipImage::replace(FIBITMAP *new_dib) { - if(new_dib == NULL) - return FALSE; - if(_dib) - FreeImage_Unload(_dib); - _dib = new_dib; - _bHasChanged = TRUE; - return TRUE; -} - -/////////////////////////////////////////////////////////////////// -// Creation & Destruction - -fipImage::fipImage(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp) { - _dib = NULL; - _bHasChanged = FALSE; - if(width && height && bpp) - setSize(image_type, width, height, bpp); -} - -fipImage::~fipImage() { - if(_dib) { - FreeImage_Unload(_dib); - _dib = NULL; - } -} - -BOOL fipImage::setSize(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask) { - if(_dib) { - FreeImage_Unload(_dib); - } - if((_dib = FreeImage_AllocateT(image_type, width, height, bpp, red_mask, green_mask, blue_mask)) == NULL) - return FALSE; - - if(image_type == FIT_BITMAP) { - // Create palette if needed - switch(bpp) { - case 1: - case 4: - case 8: - RGBQUAD *pal = FreeImage_GetPalette(_dib); - for(unsigned i = 0; i < FreeImage_GetColorsUsed(_dib); i++) { - pal[i].rgbRed = i; - pal[i].rgbGreen = i; - pal[i].rgbBlue = i; - } - break; - } - } - - _bHasChanged = TRUE; - - return TRUE; -} - -void fipImage::clear() { - if(_dib) { - FreeImage_Unload(_dib); - _dib = NULL; - } - _bHasChanged = TRUE; -} - -/////////////////////////////////////////////////////////////////// -// Copying - -fipImage::fipImage(const fipImage& Image) { - _dib = NULL; - _fif = FIF_UNKNOWN; - FIBITMAP *clone = FreeImage_Clone((FIBITMAP*)Image._dib); - replace(clone); -} - -fipImage& fipImage::operator=(const fipImage& Image) { - if(this != &Image) { - FIBITMAP *clone = FreeImage_Clone((FIBITMAP*)Image._dib); - replace(clone); - } - return *this; -} - -fipImage& fipImage::operator=(FIBITMAP *dib) { - if(_dib != dib) { - replace(dib); - } - return *this; -} - -BOOL fipImage::copySubImage(fipImage& dst, int left, int top, int right, int bottom) const { - if(_dib) { - dst = FreeImage_Copy(_dib, left, top, right, bottom); - return dst.isValid(); - } - return FALSE; -} - -BOOL fipImage::pasteSubImage(fipImage& src, int left, int top, int alpha) { - if(_dib) { - BOOL bResult = FreeImage_Paste(_dib, src._dib, left, top, alpha); - _bHasChanged = TRUE; - return bResult; - } - return FALSE; -} - -BOOL fipImage::crop(int left, int top, int right, int bottom) { - if(_dib) { - FIBITMAP *dst = FreeImage_Copy(_dib, left, top, right, bottom); - return replace(dst); - } - return FALSE; -} - - -/////////////////////////////////////////////////////////////////// -// Information functions - -FREE_IMAGE_TYPE fipImage::getImageType() const { - return FreeImage_GetImageType(_dib); -} - -unsigned fipImage::getWidth() const { - return FreeImage_GetWidth(_dib); -} - -unsigned fipImage::getHeight() const { - return FreeImage_GetHeight(_dib); -} - -unsigned fipImage::getScanWidth() const { - return FreeImage_GetPitch(_dib); -} - -BOOL fipImage::isValid() const { - return (_dib != NULL) ? TRUE:FALSE; -} - -BITMAPINFO* fipImage::getInfo() const { - return FreeImage_GetInfo(_dib); -} - -BITMAPINFOHEADER* fipImage::getInfoHeader() const { - return FreeImage_GetInfoHeader(_dib); -} - -LONG fipImage::getImageSize() const { - return FreeImage_GetDIBSize(_dib); -} - -unsigned fipImage::getBitsPerPixel() const { - return FreeImage_GetBPP(_dib); -} - -unsigned fipImage::getLine() const { - return FreeImage_GetLine(_dib); -} - -double fipImage::getHorizontalResolution() const { - return (FreeImage_GetDotsPerMeterX(_dib) / (double)100); -} - -double fipImage::getVerticalResolution() const { - return (FreeImage_GetDotsPerMeterY(_dib) / (double)100); -} - -void fipImage::setHorizontalResolution(double value) { - FreeImage_SetDotsPerMeterX(_dib, (unsigned)(value * 100 + 0.5)); -} - -void fipImage::setVerticalResolution(double value) { - FreeImage_SetDotsPerMeterY(_dib, (unsigned)(value * 100 + 0.5)); -} - - -/////////////////////////////////////////////////////////////////// -// Palette operations - -RGBQUAD* fipImage::getPalette() const { - return FreeImage_GetPalette(_dib); -} - -unsigned fipImage::getPaletteSize() const { - return FreeImage_GetColorsUsed(_dib) * sizeof(RGBQUAD); -} - -unsigned fipImage::getColorsUsed() const { - return FreeImage_GetColorsUsed(_dib); -} - -FREE_IMAGE_COLOR_TYPE fipImage::getColorType() const { - return FreeImage_GetColorType(_dib); -} - -BOOL fipImage::isGrayscale() const { - return ((FreeImage_GetBPP(_dib) == 8) && (FreeImage_GetColorType(_dib) != FIC_PALETTE)); -} - -/////////////////////////////////////////////////////////////////// -// Pixel access - -BYTE* fipImage::accessPixels() const { - return FreeImage_GetBits(_dib); -} - -BYTE* fipImage::getScanLine(unsigned scanline) const { - if(scanline < FreeImage_GetHeight(_dib)) { - return FreeImage_GetScanLine(_dib, scanline); - } - return NULL; -} - -BOOL fipImage::getPixelIndex(unsigned x, unsigned y, BYTE *value) const { - return FreeImage_GetPixelIndex(_dib, x, y, value); -} - -BOOL fipImage::getPixelColor(unsigned x, unsigned y, RGBQUAD *value) const { - return FreeImage_GetPixelColor(_dib, x, y, value); -} - -BOOL fipImage::setPixelIndex(unsigned x, unsigned y, BYTE *value) { - _bHasChanged = TRUE; - return FreeImage_SetPixelIndex(_dib, x, y, value); -} - -BOOL fipImage::setPixelColor(unsigned x, unsigned y, RGBQUAD *value) { - _bHasChanged = TRUE; - return FreeImage_SetPixelColor(_dib, x, y, value); -} - -/////////////////////////////////////////////////////////////////// -// File type identification - -FREE_IMAGE_FORMAT fipImage::identifyFIF(const char* lpszPathName) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileType(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - } - - return fif; -} - -FREE_IMAGE_FORMAT fipImage::identifyFIFU(const wchar_t* lpszPathName) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileTypeU(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilenameU(lpszPathName); - } - - return fif; -} - -FREE_IMAGE_FORMAT fipImage::identifyFIFFromHandle(FreeImageIO *io, fi_handle handle) { - if(io && handle) { - // check the file signature and get its format - return FreeImage_GetFileTypeFromHandle(io, handle, 16); - } - return FIF_UNKNOWN; -} - -FREE_IMAGE_FORMAT fipImage::identifyFIFFromMemory(FIMEMORY *hmem) { - if(hmem != NULL) { - return FreeImage_GetFileTypeFromMemory(hmem, 0); - } - return FIF_UNKNOWN; -} - - -/////////////////////////////////////////////////////////////////// -// Loading & Saving - -BOOL fipImage::load(const char* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileType(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - } - // check that the plugin has reading capabilities ... - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // Free the previous dib - if(_dib) { - FreeImage_Unload(_dib); - } - // Load the file - _dib = FreeImage_Load(fif, lpszPathName, flag); - _bHasChanged = TRUE; - if(_dib == NULL) - return FALSE; - return TRUE; - } - return FALSE; -} - -BOOL fipImage::loadU(const wchar_t* lpszPathName, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - // (the second argument is currently not used by FreeImage) - fif = FreeImage_GetFileTypeU(lpszPathName, 0); - if(fif == FIF_UNKNOWN) { - // no signature ? - // try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilenameU(lpszPathName); - } - // check that the plugin has reading capabilities ... - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // Free the previous dib - if(_dib) { - FreeImage_Unload(_dib); - } - // Load the file - _dib = FreeImage_LoadU(fif, lpszPathName, flag); - _bHasChanged = TRUE; - if(_dib == NULL) - return FALSE; - return TRUE; - } - return FALSE; -} - -BOOL fipImage::loadFromHandle(FreeImageIO *io, fi_handle handle, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - fif = FreeImage_GetFileTypeFromHandle(io, handle, 16); - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // Free the previous dib - if(_dib) { - FreeImage_Unload(_dib); - } - // Load the file - _dib = FreeImage_LoadFromHandle(fif, io, handle, flag); - _bHasChanged = TRUE; - if(_dib == NULL) - return FALSE; - return TRUE; - } - return FALSE; -} - -BOOL fipImage::loadFromMemory(fipMemoryIO& memIO, int flag) { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - - // check the file signature and get its format - fif = memIO.getFileType(); - if((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsReading(fif)) { - // Free the previous dib - if(_dib) { - FreeImage_Unload(_dib); - } - // Load the file - _dib = memIO.load(fif, flag); - _bHasChanged = TRUE; - if(_dib == NULL) - return FALSE; - return TRUE; - } - return FALSE; -} - -BOOL fipImage::save(const char* lpszPathName, int flag) const { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - BOOL bSuccess = FALSE; - - // Try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilename(lpszPathName); - if(fif != FIF_UNKNOWN ) { - // Check that the dib can be saved in this format - BOOL bCanSave; - - FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(_dib); - if(image_type == FIT_BITMAP) { - // standard bitmap type - WORD bpp = FreeImage_GetBPP(_dib); - bCanSave = (FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)); - } else { - // special bitmap type - bCanSave = FreeImage_FIFSupportsExportType(fif, image_type); - } - - if(bCanSave) { - bSuccess = FreeImage_Save(fif, _dib, lpszPathName, flag); - return bSuccess; - } - } - return bSuccess; -} - -BOOL fipImage::saveU(const wchar_t* lpszPathName, int flag) const { - FREE_IMAGE_FORMAT fif = FIF_UNKNOWN; - BOOL bSuccess = FALSE; - - // Try to guess the file format from the file extension - fif = FreeImage_GetFIFFromFilenameU(lpszPathName); - if(fif != FIF_UNKNOWN ) { - // Check that the dib can be saved in this format - BOOL bCanSave; - - FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(_dib); - if(image_type == FIT_BITMAP) { - // standard bitmap type - WORD bpp = FreeImage_GetBPP(_dib); - bCanSave = (FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)); - } else { - // special bitmap type - bCanSave = FreeImage_FIFSupportsExportType(fif, image_type); - } - - if(bCanSave) { - bSuccess = FreeImage_SaveU(fif, _dib, lpszPathName, flag); - return bSuccess; - } - } - return bSuccess; -} - -BOOL fipImage::saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flag) const { - BOOL bSuccess = FALSE; - - if(fif != FIF_UNKNOWN ) { - // Check that the dib can be saved in this format - BOOL bCanSave; - - FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(_dib); - if(image_type == FIT_BITMAP) { - // standard bitmap type - WORD bpp = FreeImage_GetBPP(_dib); - bCanSave = (FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)); - } else { - // special bitmap type - bCanSave = FreeImage_FIFSupportsExportType(fif, image_type); - } - - if(bCanSave) { - bSuccess = FreeImage_SaveToHandle(fif, _dib, io, handle, flag); - return bSuccess; - } - } - return bSuccess; -} - -BOOL fipImage::saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flag) const { - BOOL bSuccess = FALSE; - - if(fif != FIF_UNKNOWN ) { - // Check that the dib can be saved in this format - BOOL bCanSave; - - FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(_dib); - if(image_type == FIT_BITMAP) { - // standard bitmap type - WORD bpp = FreeImage_GetBPP(_dib); - bCanSave = (FreeImage_FIFSupportsWriting(fif) && FreeImage_FIFSupportsExportBPP(fif, bpp)); - } else { - // special bitmap type - bCanSave = FreeImage_FIFSupportsExportType(fif, image_type); - } - - if(bCanSave) { - bSuccess = memIO.save(fif, _dib, flag); - return bSuccess; - } - } - return bSuccess; -} - -/////////////////////////////////////////////////////////////////// -// Conversion routines - -BOOL fipImage::convertToType(FREE_IMAGE_TYPE image_type, BOOL scale_linear) { - if(_dib) { - FIBITMAP *dib = FreeImage_ConvertToType(_dib, image_type, scale_linear); - return replace(dib); - } - return FALSE; -} - -BOOL fipImage::threshold(BYTE T) { - if(_dib) { - FIBITMAP *dib1 = FreeImage_Threshold(_dib, T); - return replace(dib1); - } - return FALSE; -} - -BOOL fipImage::convertTo4Bits() { - if(_dib) { - FIBITMAP *dib4 = FreeImage_ConvertTo4Bits(_dib); - return replace(dib4); - } - return FALSE; -} - -BOOL fipImage::convertTo8Bits() { - if(_dib) { - FIBITMAP *dib8 = FreeImage_ConvertTo8Bits(_dib); - return replace(dib8); - } - return FALSE; -} - -BOOL fipImage::convertTo16Bits555() { - if(_dib) { - FIBITMAP *dib16_555 = FreeImage_ConvertTo16Bits555(_dib); - return replace(dib16_555); - } - return FALSE; -} - -BOOL fipImage::convertTo16Bits565() { - if(_dib) { - FIBITMAP *dib16_565 = FreeImage_ConvertTo16Bits565(_dib); - return replace(dib16_565); - } - return FALSE; -} - -BOOL fipImage::convertTo24Bits() { - if(_dib) { - FIBITMAP *dibRGB = FreeImage_ConvertTo24Bits(_dib); - return replace(dibRGB); - } - return FALSE; -} - -BOOL fipImage::convertTo32Bits() { - if(_dib) { - FIBITMAP *dib32 = FreeImage_ConvertTo32Bits(_dib); - return replace(dib32); - } - return FALSE; -} - -BOOL fipImage::convertToGrayscale() { - if(_dib) { - FIBITMAP *dib8 = FreeImage_ConvertToGreyscale(_dib); - return replace(dib8); - } - return FALSE; -} - -BOOL fipImage::colorQuantize(FREE_IMAGE_QUANTIZE algorithm) { - if(_dib) { - FIBITMAP *dib8 = FreeImage_ColorQuantize(_dib, algorithm); - return replace(dib8); - } - return FALSE; -} - -BOOL fipImage::dither(FREE_IMAGE_DITHER algorithm) { - if(_dib) { - FIBITMAP *dib = FreeImage_Dither(_dib, algorithm); - return replace(dib); - } - return FALSE; -} - -BOOL fipImage::convertToRGBF() { - if(_dib) { - FIBITMAP *dib = FreeImage_ConvertToRGBF(_dib); - return replace(dib); - } - return FALSE; - -} - -BOOL fipImage::toneMapping(FREE_IMAGE_TMO tmo, double first_param, double second_param, double third_param, double fourth_param) { - if(_dib) { - FIBITMAP *dst = NULL; - // Apply a tone mapping algorithm and convert to 24-bit - switch(tmo) { - case FITMO_REINHARD05: - dst = FreeImage_TmoReinhard05Ex(_dib, first_param, second_param, third_param, fourth_param); - break; - default: - dst = FreeImage_ToneMapping(_dib, tmo, first_param, second_param); - break; - } - - return replace(dst); - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Transparency support: background colour and alpha channel - -BOOL fipImage::isTransparent() const { - return FreeImage_IsTransparent(_dib); -} - -unsigned fipImage::getTransparencyCount() const { - return FreeImage_GetTransparencyCount(_dib); -} - -BYTE* fipImage::getTransparencyTable() const { - return FreeImage_GetTransparencyTable(_dib); -} - -void fipImage::setTransparencyTable(BYTE *table, int count) { - FreeImage_SetTransparencyTable(_dib, table, count); - _bHasChanged = TRUE; -} - -BOOL fipImage::hasFileBkColor() const { - return FreeImage_HasBackgroundColor(_dib); -} - -BOOL fipImage::getFileBkColor(RGBQUAD *bkcolor) const { - return FreeImage_GetBackgroundColor(_dib, bkcolor); -} - -BOOL fipImage::setFileBkColor(RGBQUAD *bkcolor) { - _bHasChanged = TRUE; - return FreeImage_SetBackgroundColor(_dib, bkcolor); -} - -/////////////////////////////////////////////////////////////////// -// Channel processing support - -BOOL fipImage::getChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) const { - if(_dib) { - image = FreeImage_GetChannel(_dib, channel); - return image.isValid(); - } - return FALSE; -} - -BOOL fipImage::setChannel(fipImage& image, FREE_IMAGE_COLOR_CHANNEL channel) { - if(_dib) { - _bHasChanged = TRUE; - return FreeImage_SetChannel(_dib, image._dib, channel); - } - return FALSE; -} - -BOOL fipImage::splitChannels(fipImage& RedChannel, fipImage& GreenChannel, fipImage& BlueChannel) { - if(_dib) { - RedChannel = FreeImage_GetChannel(_dib, FICC_RED); - GreenChannel = FreeImage_GetChannel(_dib, FICC_GREEN); - BlueChannel = FreeImage_GetChannel(_dib, FICC_BLUE); - - return (RedChannel.isValid() && GreenChannel.isValid() && BlueChannel.isValid()); - } - return FALSE; -} - -BOOL fipImage::combineChannels(fipImage& red, fipImage& green, fipImage& blue) { - if(!_dib) { - int width = red.getWidth(); - int height = red.getHeight(); - _dib = FreeImage_Allocate(width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK); - } - - if(_dib) { - BOOL bResult = TRUE; - bResult &= FreeImage_SetChannel(_dib, red._dib, FICC_RED); - bResult &= FreeImage_SetChannel(_dib, green._dib, FICC_GREEN); - bResult &= FreeImage_SetChannel(_dib, blue._dib, FICC_BLUE); - - _bHasChanged = TRUE; - - return bResult; - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Rotation and flipping - -BOOL fipImage::rotateEx(double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask) { - if(_dib) { - if(FreeImage_GetBPP(_dib) >= 8) { - FIBITMAP *rotated = FreeImage_RotateEx(_dib, angle, x_shift, y_shift, x_origin, y_origin, use_mask); - return replace(rotated); - } - } - return FALSE; -} - -BOOL fipImage::rotate(double angle, const void *bkcolor) { - if(_dib) { - switch(FreeImage_GetImageType(_dib)) { - case FIT_BITMAP: - switch(FreeImage_GetBPP(_dib)) { - case 1: - case 8: - case 24: - case 32: - break; - default: - return FALSE; - } - break; - - case FIT_UINT16: - case FIT_RGB16: - case FIT_RGBA16: - case FIT_FLOAT: - case FIT_RGBF: - case FIT_RGBAF: - break; - default: - return FALSE; - break; - } - - FIBITMAP *rotated = FreeImage_Rotate(_dib, angle, bkcolor); - return replace(rotated); - - } - return FALSE; -} - -BOOL fipImage::flipVertical() { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_FlipVertical(_dib); - } - return FALSE; -} - -BOOL fipImage::flipHorizontal() { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_FlipHorizontal(_dib); - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Color manipulation routines - -BOOL fipImage::invert() { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_Invert(_dib); - } - return FALSE; -} - -BOOL fipImage::adjustCurve(BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel) { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_AdjustCurve(_dib, LUT, channel); - } - return FALSE; -} - -BOOL fipImage::adjustGamma(double gamma) { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_AdjustGamma(_dib, gamma); - } - return FALSE; -} - -BOOL fipImage::adjustBrightness(double percentage) { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_AdjustBrightness(_dib, percentage); - } - return FALSE; -} - -BOOL fipImage::adjustContrast(double percentage) { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_AdjustContrast(_dib, percentage); - } - return FALSE; -} - -BOOL fipImage::adjustBrightnessContrastGamma(double brightness, double contrast, double gamma) { - if(_dib) { - _bHasChanged = TRUE; - - return FreeImage_AdjustColors(_dib, brightness, contrast, gamma, FALSE); - } - return FALSE; -} - -BOOL fipImage::getHistogram(DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel) const { - if(_dib) { - return FreeImage_GetHistogram(_dib, histo, channel); - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Upsampling / downsampling routine - -BOOL fipImage::rescale(unsigned new_width, unsigned new_height, FREE_IMAGE_FILTER filter) { - if(_dib) { - switch(FreeImage_GetImageType(_dib)) { - case FIT_BITMAP: - case FIT_UINT16: - case FIT_RGB16: - case FIT_RGBA16: - case FIT_FLOAT: - case FIT_RGBF: - case FIT_RGBAF: - break; - default: - return FALSE; - break; - } - - // Perform upsampling / downsampling - FIBITMAP *dst = FreeImage_Rescale(_dib, new_width, new_height, filter); - return replace(dst); - } - return FALSE; -} - -BOOL fipImage::makeThumbnail(unsigned max_size, BOOL convert) { - if(_dib) { - switch(FreeImage_GetImageType(_dib)) { - case FIT_BITMAP: - case FIT_UINT16: - case FIT_RGB16: - case FIT_RGBA16: - case FIT_FLOAT: - case FIT_RGBF: - case FIT_RGBAF: - break; - default: - return FALSE; - break; - } - - // Perform downsampling - FIBITMAP *dst = FreeImage_MakeThumbnail(_dib, max_size, convert); - return replace(dst); - } - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Metadata - -unsigned fipImage::getMetadataCount(FREE_IMAGE_MDMODEL model) const { - return FreeImage_GetMetadataCount(model, _dib); -} - -BOOL fipImage::getMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) const { - FITAG *searchedTag = NULL; - FreeImage_GetMetadata(model, _dib, key, &searchedTag); - if(searchedTag != NULL) { - tag = FreeImage_CloneTag(searchedTag); - return TRUE; - } else { - // clear the tag - tag = (FITAG*)NULL; - } - return FALSE; -} - -BOOL fipImage::setMetadata(FREE_IMAGE_MDMODEL model, const char *key, fipTag& tag) { - return FreeImage_SetMetadata(model, _dib, key, tag); -} - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipMemoryIO.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipMemoryIO.cpp deleted file mode 100644 index 4a8fe80..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipMemoryIO.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// ========================================================== -// fipMemoryIO class implementation -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "FreeImagePlus.h" -#include -#include -#include -#include -#include -#include - -fipMemoryIO::fipMemoryIO(BYTE *data, DWORD size_in_bytes) { - _hmem = FreeImage_OpenMemory(data, size_in_bytes); -} - -fipMemoryIO::~fipMemoryIO() { - if(_hmem != NULL) { - FreeImage_CloseMemory(_hmem); - } -} - -void fipMemoryIO::close() { - if(_hmem != NULL) { - FreeImage_CloseMemory(_hmem); - _hmem = NULL; - } -} - -BOOL fipMemoryIO::isValid() const { - return (_hmem != NULL); -} - -FREE_IMAGE_FORMAT fipMemoryIO::getFileType() const { - if(_hmem != NULL) { - return FreeImage_GetFileTypeFromMemory(_hmem, 0); - } - - return FIF_UNKNOWN; -} - -FIBITMAP* fipMemoryIO::load(FREE_IMAGE_FORMAT fif, int flags) const { - return FreeImage_LoadFromMemory(fif, _hmem, flags); -} - -FIMULTIBITMAP* fipMemoryIO::loadMultiPage(FREE_IMAGE_FORMAT fif, int flags) const { - return FreeImage_LoadMultiBitmapFromMemory(fif, _hmem, flags); -} - -BOOL fipMemoryIO::save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, int flags) { - return FreeImage_SaveToMemory(fif, dib, _hmem, flags); -} - -BOOL fipMemoryIO::saveMultiPage(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, int flags) { - return FreeImage_SaveMultiBitmapToMemory(fif, bitmap, _hmem, flags); -} - -unsigned fipMemoryIO::read(void *buffer, unsigned size, unsigned count) const { - return FreeImage_ReadMemory(buffer, size, count, _hmem); -} - -unsigned fipMemoryIO::write(const void *buffer, unsigned size, unsigned count) { - return FreeImage_WriteMemory(buffer, size, count, _hmem); -} - -long fipMemoryIO::tell() const { - return FreeImage_TellMemory(_hmem); -} - -BOOL fipMemoryIO::seek(long offset, int origin) { - return FreeImage_SeekMemory(_hmem, offset, origin); -} - -BOOL fipMemoryIO::acquire(BYTE **data, DWORD *size_in_bytes) { - return FreeImage_AcquireMemory(_hmem, data, size_in_bytes); -} - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipMetadataFind.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipMetadataFind.cpp deleted file mode 100644 index 57d01f6..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipMetadataFind.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// ========================================================== -// fipMetadataFind class implementation -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "FreeImagePlus.h" - -BOOL fipMetadataFind::isValid() const { - return (_mdhandle != NULL) ? TRUE : FALSE; -} - -fipMetadataFind::fipMetadataFind() : _mdhandle(NULL) { -} - -fipMetadataFind::~fipMetadataFind() { - FreeImage_FindCloseMetadata(_mdhandle); -} - -BOOL fipMetadataFind::findFirstMetadata(FREE_IMAGE_MDMODEL model, fipImage& image, fipTag& tag) { - FITAG *firstTag = NULL; - if(_mdhandle) FreeImage_FindCloseMetadata(_mdhandle); - _mdhandle = FreeImage_FindFirstMetadata(model, image, &firstTag); - if(_mdhandle) { - tag = FreeImage_CloneTag(firstTag); - return TRUE; - } - return FALSE; -} - -BOOL fipMetadataFind::findNextMetadata(fipTag& tag) { - FITAG *nextTag = NULL; - if( FreeImage_FindNextMetadata(_mdhandle, &nextTag) ) { - tag = FreeImage_CloneTag(nextTag); - return TRUE; - } - return FALSE; -} - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipMultiPage.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipMultiPage.cpp deleted file mode 100644 index cc33196..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipMultiPage.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// ========================================================== -// fipMultiPage class implementation -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "FreeImagePlus.h" - -fipMultiPage::fipMultiPage(BOOL keep_cache_in_memory) : _mpage(NULL), _bMemoryCache(keep_cache_in_memory) { -} - -fipMultiPage::~fipMultiPage() { - if(_mpage) { - // close the stream - close(0); - } -} - -BOOL fipMultiPage::isValid() const { - return (NULL != _mpage) ? TRUE : FALSE; -} - -BOOL fipMultiPage::open(const char* lpszPathName, BOOL create_new, BOOL read_only, int flags) { - // try to guess the file format from the filename - FREE_IMAGE_FORMAT fif = FreeImage_GetFIFFromFilename(lpszPathName); - - // open the stream - _mpage = FreeImage_OpenMultiBitmap(fif, lpszPathName, create_new, read_only, _bMemoryCache, flags); - - return (NULL != _mpage ) ? TRUE : FALSE; -} - -BOOL fipMultiPage::open(fipMemoryIO& memIO, int flags) { - // try to guess the file format from the memory handle - FREE_IMAGE_FORMAT fif = memIO.getFileType(); - - // open the stream - _mpage = memIO.loadMultiPage(fif, flags); - - return (NULL != _mpage ) ? TRUE : FALSE; -} - -BOOL fipMultiPage::open(FreeImageIO *io, fi_handle handle, int flags) { - // try to guess the file format from the handle - FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromHandle(io, handle, 0); - - // open the stream - _mpage = FreeImage_OpenMultiBitmapFromHandle(fif, io, handle, flags); - - return (NULL != _mpage ) ? TRUE : FALSE; -} - -BOOL fipMultiPage::close(int flags) { - BOOL bSuccess = FALSE; - if(_mpage) { - // close the stream - bSuccess = FreeImage_CloseMultiBitmap(_mpage, flags); - _mpage = NULL; - } - - return bSuccess; -} - -BOOL fipMultiPage::saveToHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags) const { - BOOL bSuccess = FALSE; - if(_mpage) { - bSuccess = FreeImage_SaveMultiBitmapToHandle(fif, _mpage, io, handle, flags); - } - - return bSuccess; -} - -BOOL fipMultiPage::saveToMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO, int flags) const { - BOOL bSuccess = FALSE; - if(_mpage) { - bSuccess = memIO.saveMultiPage(fif, _mpage, flags); - } - - return bSuccess; -} - -int fipMultiPage::getPageCount() const { - return _mpage ? FreeImage_GetPageCount(_mpage) : 0; -} - -void fipMultiPage::appendPage(fipImage& image) { - if(_mpage) { - FreeImage_AppendPage(_mpage, image); - } -} - -void fipMultiPage::insertPage(int page, fipImage& image) { - if(_mpage) { - FreeImage_InsertPage(_mpage, page, image); - } -} - -void fipMultiPage::deletePage(int page) { - if(_mpage) { - FreeImage_DeletePage(_mpage, page); - } -} - -BOOL fipMultiPage::movePage(int target, int source) { - return _mpage ? FreeImage_MovePage(_mpage, target, source) : FALSE; -} - -FIBITMAP* fipMultiPage::lockPage(int page) { - return _mpage ? FreeImage_LockPage(_mpage, page) : NULL; -} - -void fipMultiPage::unlockPage(fipImage& image, BOOL changed) { - if(_mpage) { - FreeImage_UnlockPage(_mpage, image, changed); - // clear the image so that it becomes invalid. - // this is possible because of the friend declaration - image._dib = NULL; - image._bHasChanged = FALSE; - } -} - -BOOL fipMultiPage::getLockedPageNumbers(int *pages, int *count) const { - return _mpage ? FreeImage_GetLockedPageNumbers(_mpage, pages, count) : FALSE; -} - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipTag.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipTag.cpp deleted file mode 100644 index b00a095..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipTag.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// ========================================================== -// fipTag class implementation -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include -#include "FreeImagePlus.h" - -fipTag::fipTag() { - _tag = FreeImage_CreateTag(); -} - -fipTag::~fipTag() { - FreeImage_DeleteTag(_tag); -} - -BOOL fipTag::setKeyValue(const char *key, const char *value) { - if(_tag) { - FreeImage_DeleteTag(_tag); - _tag = NULL; - } - // create a tag - _tag = FreeImage_CreateTag(); - if(_tag) { - BOOL bSuccess = TRUE; - // fill the tag - DWORD tag_length = (DWORD)(strlen(value) + 1); - bSuccess &= FreeImage_SetTagKey(_tag, key); - bSuccess &= FreeImage_SetTagLength(_tag, tag_length); - bSuccess &= FreeImage_SetTagCount(_tag, tag_length); - bSuccess &= FreeImage_SetTagType(_tag, FIDT_ASCII); - bSuccess &= FreeImage_SetTagValue(_tag, value); - return bSuccess; - } - return FALSE; -} - -fipTag::fipTag(const fipTag& tag) { - _tag = FreeImage_CloneTag(tag._tag); -} - -fipTag& fipTag::operator=(const fipTag& tag) { - if(this != &tag) { - if(_tag) FreeImage_DeleteTag(_tag); - _tag = FreeImage_CloneTag(tag._tag); - } - return *this; -} - -fipTag& fipTag::operator=(FITAG *tag) { - if(_tag) FreeImage_DeleteTag(_tag); - _tag = tag; - return *this; -} - -BOOL fipTag::isValid() const { - return (_tag != NULL) ? TRUE : FALSE; -} - -const char* fipTag::getKey() const { - return FreeImage_GetTagKey(_tag); -} - -const char* fipTag::getDescription() const { - return FreeImage_GetTagDescription(_tag); -} - -WORD fipTag::getID() const { - return FreeImage_GetTagID(_tag); -} - -FREE_IMAGE_MDTYPE fipTag::getType() const { - return FreeImage_GetTagType(_tag); -} - -DWORD fipTag::getCount() const { - return FreeImage_GetTagCount(_tag); -} - -DWORD fipTag::getLength() const { - return FreeImage_GetTagLength(_tag); -} - -const void* fipTag::getValue() const { - return FreeImage_GetTagValue(_tag); -} - -BOOL fipTag::setKey(const char *key) { - return FreeImage_SetTagKey(_tag, key); -} - -BOOL fipTag::setDescription(const char *description) { - return FreeImage_SetTagDescription(_tag, description); -} - -BOOL fipTag::setID(WORD id) { - return FreeImage_SetTagID(_tag, id); -} - -BOOL fipTag::setType(FREE_IMAGE_MDTYPE type) { - return FreeImage_SetTagType(_tag, type); -} - -BOOL fipTag::setCount(DWORD count) { - return FreeImage_SetTagCount(_tag, count); -} - -BOOL fipTag::setLength(DWORD length) { - return FreeImage_SetTagLength(_tag, length); -} - -BOOL fipTag::setValue(const void *value) { - return FreeImage_SetTagValue(_tag, value); -} - -const char* fipTag::toString(FREE_IMAGE_MDMODEL model, char *Make) const { - return FreeImage_TagToString(model, _tag, Make); -} diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipWinImage.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipWinImage.cpp deleted file mode 100644 index 014d888..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/src/fipWinImage.cpp +++ /dev/null @@ -1,481 +0,0 @@ -// ========================================================== -// fipWinImage class implementation -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#include "FreeImagePlus.h" - -#ifdef _WIN32 - -// marker used for clipboard copy / paste - -static inline void -SET_FREEIMAGE_MARKER(BITMAPINFOHEADER *bmih, FIBITMAP *dib) { - // Windows constants goes from 0L to 5L - // Add 0xFF to avoid conflicts - bmih->biCompression = 0xFF + FreeImage_GetImageType(dib); -} - -static inline FREE_IMAGE_TYPE -GET_FREEIMAGE_MARKER(BITMAPINFOHEADER *bmih) { - return (FREE_IMAGE_TYPE)(bmih->biCompression - 0xFF); -} - -/////////////////////////////////////////////////////////////////// -// Construction / Destruction - -fipWinImage::fipWinImage(FREE_IMAGE_TYPE image_type, unsigned width, unsigned height, unsigned bpp) : fipImage(image_type, width, height, bpp) { - _display_dib = NULL; - _bDeleteMe = FALSE; - // default tone mapping operator - _tmo = FITMO_DRAGO03; - _tmo_param_1 = 0; - _tmo_param_2 = 0; - _tmo_param_3 = 1; - _tmo_param_4 = 0; -} - -fipWinImage::~fipWinImage() { - if(_bDeleteMe) { - FreeImage_Unload(_display_dib); - } -} - -void fipWinImage::clear() { - // delete _display_dib - if(_bDeleteMe) { - FreeImage_Unload(_display_dib); - } - _display_dib = NULL; - _bDeleteMe = FALSE; - // delete base class data - fipImage::clear(); -} - -BOOL fipWinImage::isValid() const { - return fipImage::isValid(); -} - -/////////////////////////////////////////////////////////////////// -// Copying - -fipWinImage& fipWinImage::operator=(const fipImage& Image) { - // delete _display_dib - if(_bDeleteMe) { - FreeImage_Unload(_display_dib); - } - _display_dib = NULL; - _bDeleteMe = FALSE; - // clone the base class - fipImage::operator=(Image); - - return *this; -} - -fipWinImage& fipWinImage::operator=(const fipWinImage& Image) { - if(this != &Image) { - // delete _display_dib - if(_bDeleteMe) { - FreeImage_Unload(_display_dib); - } - _display_dib = NULL; - _bDeleteMe = FALSE; - // copy tmo data - _tmo = Image._tmo; - _tmo_param_1 = Image._tmo_param_1; - _tmo_param_2 = Image._tmo_param_2; - _tmo_param_3 = Image._tmo_param_3; - _tmo_param_4 = Image._tmo_param_4; - - // clone the base class - fipImage::operator=(Image); - } - return *this; -} - -HANDLE fipWinImage::copyToHandle() const { - HANDLE hMem = NULL; - - if(_dib) { - - // Get equivalent DIB size - long dib_size = sizeof(BITMAPINFOHEADER); - dib_size += FreeImage_GetColorsUsed(_dib) * sizeof(RGBQUAD); - dib_size += FreeImage_GetPitch(_dib) * FreeImage_GetHeight(_dib); - - // Allocate a DIB - hMem = GlobalAlloc(GHND, dib_size); - BYTE *dib = (BYTE*)GlobalLock(hMem); - - memset(dib, 0, dib_size); - - BYTE *p_dib = (BYTE*)dib; - - // Copy the BITMAPINFOHEADER - - BITMAPINFOHEADER *bih = FreeImage_GetInfoHeader(_dib); - memcpy(p_dib, bih, sizeof(BITMAPINFOHEADER)); - if(FreeImage_GetImageType(_dib) != FIT_BITMAP) { - // this hack is used to store the bitmap type in the biCompression member of the BITMAPINFOHEADER - SET_FREEIMAGE_MARKER((BITMAPINFOHEADER*)p_dib, _dib); - } - p_dib += sizeof(BITMAPINFOHEADER); - - // Copy the palette - - RGBQUAD *pal = FreeImage_GetPalette(_dib); - memcpy(p_dib, pal, FreeImage_GetColorsUsed(_dib) * sizeof(RGBQUAD)); - p_dib += FreeImage_GetColorsUsed(_dib) * sizeof(RGBQUAD); - - // Copy the bitmap - - BYTE *bits = FreeImage_GetBits(_dib); - memcpy(p_dib, bits, FreeImage_GetPitch(_dib) * FreeImage_GetHeight(_dib)); - - GlobalUnlock(hMem); - } - - return hMem; -} - -BOOL fipWinImage::copyFromHandle(HANDLE hMem) { - BYTE *lpVoid = NULL; - BITMAPINFOHEADER *pHead = NULL; - RGBQUAD *pPalette = NULL; - BYTE *bits = NULL; - DWORD bitfields[3] = {0, 0, 0}; - - // Get a pointer to the bitmap - lpVoid = (BYTE *)GlobalLock(hMem); - - // Get a pointer to the bitmap header - pHead = (BITMAPINFOHEADER *)lpVoid; - - // Get a pointer to the palette - if(pHead->biBitCount < 16) - pPalette = (RGBQUAD *)(((BYTE *)pHead) + sizeof(BITMAPINFOHEADER)); - - // Get a pointer to the pixels - bits = ((BYTE*)pHead + sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * pHead->biClrUsed); - - if(pHead->biCompression == BI_BITFIELDS) { - // Take into account the color masks that specify the red, green, and blue components (16- and 32-bit) - unsigned mask_size = 3 * sizeof(DWORD); - memcpy(&bitfields[0], bits, mask_size); - bits += mask_size; - } - - if(lpVoid) { - - // Allocate a new FIBITMAP - - FREE_IMAGE_TYPE image_type = FIT_BITMAP; - // Use a hack to decide if the clipboard contains non standard bitmaps ... - switch(GET_FREEIMAGE_MARKER(pHead)) { - case FIT_UINT16: - case FIT_INT16: - case FIT_UINT32: - case FIT_INT32: - case FIT_FLOAT: - case FIT_DOUBLE: - case FIT_COMPLEX: - case FIT_RGB16: - case FIT_RGBA16: - case FIT_RGBF: - case FIT_RGBAF: - image_type = GET_FREEIMAGE_MARKER(pHead); - break; - } - if(!setSize(image_type, (WORD)pHead->biWidth, (WORD)pHead->biHeight, pHead->biBitCount, bitfields[2], bitfields[1], bitfields[0])) { - GlobalUnlock(lpVoid); - return FALSE; - } - - // Copy the bitmap header - memcpy(FreeImage_GetInfoHeader(_dib), pHead, sizeof(BITMAPINFOHEADER)); - - - // Copy the palette - memcpy(FreeImage_GetPalette(_dib), pPalette, pHead->biClrUsed * sizeof(RGBQUAD)); - - // Copy the bitmap - memcpy(FreeImage_GetBits(_dib), bits, FreeImage_GetPitch(_dib) * FreeImage_GetHeight(_dib)); - - GlobalUnlock(lpVoid); - - return TRUE; - } - - return FALSE; -} - -BOOL fipWinImage::copyFromBitmap(HBITMAP hbmp) { - if(hbmp) { - int Success; - BITMAP bm; - // Get informations about the bitmap - GetObject(hbmp, sizeof(BITMAP), (LPSTR) &bm); - // Create the image - setSize(FIT_BITMAP, (WORD)bm.bmWidth, (WORD)bm.bmHeight, (WORD)bm.bmBitsPixel); - - // The GetDIBits function clears the biClrUsed and biClrImportant BITMAPINFO members (dont't know why) - // So we save these infos below. This is needed for palettized images only. - int nColors = FreeImage_GetColorsUsed(_dib); - - // Create a device context for the bitmap - HDC dc = GetDC(NULL); - // Copy the pixels - Success = GetDIBits(dc, // handle to DC - hbmp, // handle to bitmap - 0, // first scan line to set - FreeImage_GetHeight(_dib), // number of scan lines to copy - FreeImage_GetBits(_dib), // array for bitmap bits - FreeImage_GetInfo(_dib), // bitmap data buffer - DIB_RGB_COLORS // RGB - ); - if(Success == 0) { - FreeImage_OutputMessageProc(FIF_UNKNOWN, "Error : GetDIBits failed"); - ReleaseDC(NULL, dc); - return FALSE; - } - ReleaseDC(NULL, dc); - - // restore BITMAPINFO members - - FreeImage_GetInfoHeader(_dib)->biClrUsed = nColors; - FreeImage_GetInfoHeader(_dib)->biClrImportant = nColors; - - return TRUE; - } - - return FALSE; -} - -BOOL fipWinImage::copyToClipboard(HWND hWndNewOwner) const { - HANDLE hDIB = copyToHandle(); - - if(OpenClipboard(hWndNewOwner)) { - if(EmptyClipboard()) { - if(SetClipboardData(CF_DIB, hDIB) == NULL) { - MessageBox(hWndNewOwner, "Unable to set Clipboard data", "FreeImage", MB_ICONERROR); - CloseClipboard(); - return FALSE; - } - } - } - CloseClipboard(); - - return TRUE; -} - -BOOL fipWinImage::pasteFromClipboard() { - if(!IsClipboardFormatAvailable(CF_DIB)) - return FALSE; - - if(OpenClipboard(NULL)) { - HANDLE hDIB = GetClipboardData(CF_DIB); - copyFromHandle(hDIB); - CloseClipboard(); - return TRUE; - } - CloseClipboard(); - - return FALSE; -} - -/////////////////////////////////////////////////////////////////// -// Screen capture - -BOOL fipWinImage::captureWindow(HWND hWndApplicationWindow, HWND hWndSelectedWindow) { - int xScreen, yScreen, xshift, yshift; - RECT r; - - // Get window size - GetWindowRect(hWndSelectedWindow, &r); - - // Check if the window is out of the screen or maximixed - xshift = 0; - yshift = 0; - xScreen = GetSystemMetrics(SM_CXSCREEN); - yScreen = GetSystemMetrics(SM_CYSCREEN); - if(r.right > xScreen) - r.right = xScreen; - if(r.bottom > yScreen) - r.bottom = yScreen; - if(r.left < 0) { - xshift = -r.left; - r.left = 0; - } - if(r.top < 0){ - yshift = -r.top; - r.top = 0; - } - - int width = r.right - r.left; - int height = r.bottom - r.top; - - if(width <= 0 || height <= 0) - return FALSE; - - // Hide the application window. - ShowWindow(hWndApplicationWindow, SW_HIDE); - // Bring the window at the top most level - SetWindowPos(hWndSelectedWindow, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - // Give enough time to refresh the window - Sleep(500); - - // Prepare the DCs - HDC dstDC = GetDC(NULL); - HDC srcDC = GetWindowDC(hWndSelectedWindow); // full window (GetDC(hWndSelectedWindow) = clientarea) - HDC memDC = CreateCompatibleDC(dstDC); - - // Copy the screen to the bitmap - HBITMAP bm = CreateCompatibleBitmap(dstDC, width, height); - HBITMAP oldbm = (HBITMAP)SelectObject(memDC, bm); - BitBlt(memDC, 0, 0, width, height, srcDC, xshift, yshift, SRCCOPY); - - // Redraw the application window. - ShowWindow(hWndApplicationWindow, SW_SHOW); - - // Restore the position - SetWindowPos(hWndSelectedWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - SetWindowPos(hWndApplicationWindow, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); - - // Convert the HBITMAP to a FIBITMAP - copyFromBitmap(bm); - - // Free objects - DeleteObject(SelectObject(memDC, oldbm)); - DeleteDC(memDC); - - // Convert 32-bit images to 24-bit - if(getBitsPerPixel() == 32) { - convertTo24Bits(); - } - - return TRUE; -} - - -/////////////////////////////////////////////////////////////////// -// Painting operations - -void fipWinImage::drawEx(HDC hDC, RECT& rcDest, BOOL useFileBkg, RGBQUAD *appBkColor, FIBITMAP *bg) const { - // Convert to a standard bitmap if needed - if(_bHasChanged) { - if(_bDeleteMe) { - FreeImage_Unload(_display_dib); - _display_dib = NULL; - _bDeleteMe = FALSE; - } - - FREE_IMAGE_TYPE image_type = getImageType(); - if(image_type == FIT_BITMAP) { - BOOL bHasBackground = FreeImage_HasBackgroundColor(_dib); - BOOL bIsTransparent = FreeImage_IsTransparent(_dib); - - if(!bIsTransparent && (!bHasBackground || !useFileBkg)) { - // Copy pointer - _display_dib = _dib; - } - else { - // Create the transparent / alpha blended image - _display_dib = FreeImage_Composite(_dib, useFileBkg, appBkColor, bg); - if(_display_dib) { - // Remember to delete _display_dib - _bDeleteMe = TRUE; - } else { - // Something failed: copy pointers - _display_dib = _dib; - } - } - } else { - // Convert to a standard dib for display - - if(image_type == FIT_COMPLEX) { - // Convert to type FIT_DOUBLE - FIBITMAP *dib_double = FreeImage_GetComplexChannel(_dib, FICC_MAG); - // Convert to a standard bitmap (linear scaling) - _display_dib = FreeImage_ConvertToStandardType(dib_double, TRUE); - // Free image of type FIT_DOUBLE - FreeImage_Unload(dib_double); - } else if((image_type == FIT_RGBF) || (image_type == FIT_RGBAF) || (image_type == FIT_RGB16)) { - // Apply a tone mapping algorithm and convert to 24-bit - switch(_tmo) { - case FITMO_REINHARD05: - _display_dib = FreeImage_TmoReinhard05Ex(_dib, _tmo_param_1, _tmo_param_2, _tmo_param_3, _tmo_param_4); - break; - default: - _display_dib = FreeImage_ToneMapping(_dib, _tmo, _tmo_param_1, _tmo_param_2); - break; - } - } else if(image_type == FIT_RGBA16) { - // Convert to 32-bit - FIBITMAP *dib32 = FreeImage_ConvertTo32Bits(_dib); - if(dib32) { - // Create the transparent / alpha blended image - _display_dib = FreeImage_Composite(dib32, useFileBkg, appBkColor, bg); - FreeImage_Unload(dib32); - } - } else { - // Other cases: convert to a standard bitmap (linear scaling) - _display_dib = FreeImage_ConvertToStandardType(_dib, TRUE); - } - // Remember to delete _display_dib - _bDeleteMe = TRUE; - } - - _bHasChanged = FALSE; - } - - // Draw the dib - SetStretchBltMode(hDC, COLORONCOLOR); - StretchDIBits(hDC, rcDest.left, rcDest.top, - rcDest.right-rcDest.left, rcDest.bottom-rcDest.top, - 0, 0, FreeImage_GetWidth(_display_dib), FreeImage_GetHeight(_display_dib), - FreeImage_GetBits(_display_dib), FreeImage_GetInfo(_display_dib), DIB_RGB_COLORS, SRCCOPY); - -} - -void fipWinImage::setToneMappingOperator(FREE_IMAGE_TMO tmo, double first_param, double second_param, double third_param, double fourth_param) { - // avoid costly operations if possible ... - if((_tmo != tmo) || (_tmo_param_1 != first_param) || (_tmo_param_2 != second_param) || (_tmo_param_3 != third_param) || (_tmo_param_4 != fourth_param)) { - _tmo = tmo; - _tmo_param_1 = first_param; - _tmo_param_2 = second_param; - _tmo_param_3 = third_param; - _tmo_param_4 = fourth_param; - - FREE_IMAGE_TYPE image_type = getImageType(); - if((image_type == FIT_RGBF) || (image_type == FIT_RGB16)) { - _bHasChanged = TRUE; - } - } -} - -void fipWinImage::getToneMappingOperator(FREE_IMAGE_TMO *tmo, double *first_param, double *second_param, double *third_param, double *fourth_param) const { - *tmo = _tmo; - *first_param = _tmo_param_1; - *second_param = _tmo_param_2; - *third_param = _tmo_param_3; - *fourth_param = _tmo_param_4; -} - - -#endif // _WIN32 diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2003.sln b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2003.sln deleted file mode 100644 index be2ce0c..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2003.sln +++ /dev/null @@ -1,23 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fipTest", "fipTest.2003.vcproj", "{D1ABE87A-65A2-4AA2-9C94-73B9B4898C3B}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {D1ABE87A-65A2-4AA2-9C94-73B9B4898C3B}.Debug.ActiveCfg = Debug|Win32 - {D1ABE87A-65A2-4AA2-9C94-73B9B4898C3B}.Debug.Build.0 = Debug|Win32 - {D1ABE87A-65A2-4AA2-9C94-73B9B4898C3B}.Release.ActiveCfg = Release|Win32 - {D1ABE87A-65A2-4AA2-9C94-73B9B4898C3B}.Release.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2003.vcproj b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2003.vcproj deleted file mode 100644 index 4d99681..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2003.vcproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.sln b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.sln deleted file mode 100644 index b5803c9..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fipTest", "fipTest.2005.vcproj", "{39B399CB-50D7-43CF-9967-CBA4309C7034}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {39B399CB-50D7-43CF-9967-CBA4309C7034}.Debug|Win32.ActiveCfg = Debug|Win32 - {39B399CB-50D7-43CF-9967-CBA4309C7034}.Debug|Win32.Build.0 = Debug|Win32 - {39B399CB-50D7-43CF-9967-CBA4309C7034}.Release|Win32.ActiveCfg = Release|Win32 - {39B399CB-50D7-43CF-9967-CBA4309C7034}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.vcproj b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.vcproj deleted file mode 100644 index 5a6ea55..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2005.vcproj +++ /dev/null @@ -1,282 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.vcproj b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.vcproj deleted file mode 100644 index 078f707..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.2008.vcproj +++ /dev/null @@ -1,281 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.cpp deleted file mode 100644 index 49864e7..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - - -#include "fipTest.h" - -using namespace std; - -// ---------------------------------------------------------- - -/** - FreeImage error handler - @param fif Format / Plugin responsible for the error - @param message Error message -*/ -void FreeImageErrorHandler(FREE_IMAGE_FORMAT fif, const char *message) { - cout << "\n*** "; - if(fif != FIF_UNKNOWN) { - cout << FreeImage_GetFormatFromFIF(fif) << " Format\n"; - } - cout << message; - cout << " ***\n"; -} - -// ---------------------------------------------------------- - -int main(int argc, char *argv[]) { - char *lpszTestFile = "test.jpg"; - char *lpszMultiPage = "test.tif"; - -#if defined(FREEIMAGE_LIB) || !defined(WIN32) - FreeImage_Initialise(); -#endif - - // initialize our own FreeImage error handler - - FreeImage_SetOutputMessage(FreeImageErrorHandler); - - // test memory IO - testMemIO(lpszTestFile); - - // test multipage IO - testMultiPage(lpszMultiPage); - - // test multipage memory IO - testMultiPageMemory(lpszMultiPage); - - // test multipage stream IO - testStreamMultiPage(lpszMultiPage); - -#if defined(FREEIMAGE_LIB) || !defined(WIN32) - FreeImage_DeInitialise(); -#endif - - return 0; -} - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.h b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.h deleted file mode 100644 index 3b8d1de..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTest.h +++ /dev/null @@ -1,79 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - -#ifndef TEST_FREEIMAGEPLUS_API_H -#define TEST_FREEIMAGEPLUS_API_H - -#include "../FreeImagePlus.h" -#include -#include -#include - -#include - -// -------------------------------------------------------------------------- -// Memory IO test scripts - -/// Test saving to a memory stream -void testSaveMemIO(const char *lpszPathName); -/// Test loading from a buffer attached to a memory stream -void testLoadMemIO(const char *lpszPathName); -/// Test extracting a memory buffer from a memory stream -void testAcquireMemIO(const char *lpszPathName); -/// Test Loading / Saving from / to a memory stream using fipImage -void testImageMemIO(const char *lpszPathName); -/// Test the above functions -void testMemIO(const char *lpszPathName); - -// -------------------------------------------------------------------------- -// Multipage test scripts - -/// Test multipage loading & saving -BOOL testCloneMultiPage(const char *input, const char *output, int output_flag); -/// Test the above functions -void testMultiPage(const char *lpszMultiPage); - -// -------------------------------------------------------------------------- -// Multipage memory IO test scripts - -/// test FreeImage_LoadMultiBitmapFromMemory -BOOL testLoadMultiBitmapFromMemory(const char *lpszPathName); -/// test FreeImage_SaveMultiBitmapToMemory -BOOL testSaveMultiBitmapToMemory(const char *input, const char *output, int output_flag); -/// test FreeImage_LoadMultiBitmapFromMemory & FreeImage_SaveMultiBitmapToMemory -BOOL testMemoryStreamMultiPageOpenSave(const char *lpszPathName, char *output, int input_flag, int output_flag); -/// Test the above functions -void testMultiPageMemory(const char *lpszPathName); - -// -------------------------------------------------------------------------- -// Multipage IO test scripts - -/// test multipage stream (opening) -BOOL testStreamMultiPageOpen(const char *input, int flags); -/// test multipage stream (save as) -BOOL testStreamMultiPageSave(const char *input, const char *output, int input_flag, int output_flag); -/// test multipage stream (open, modify, save as) -BOOL testStreamMultiPageOpenSave(const char *input, const char *output, int input_flag, int output_flag); -/// Test the above functions -void testStreamMultiPage(const char *lpszPathName); - - -#endif // TEST_FREEIMAGEPLUS_API_H diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPage.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPage.cpp deleted file mode 100644 index 2e3e662..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPage.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - - -#include "fipTest.h" - -using namespace std; - -// -------------------------------------------------------------------------- -// Multipage test scripts - -BOOL testCloneMultiPage(const char *input, const char *output, int output_flag) { - - BOOL bMemoryCache = TRUE; - - fipMultiPage src(bMemoryCache); - fipMultiPage dst(bMemoryCache); - - // You MUST declare this before using it. - // We will use the assignement operator, i.e. operator=() - fipImage image; - - // Open src file (read-only, use memory cache) - src.open(input, FALSE, TRUE); - - if(src.isValid()) { - // Open dst file (creation, use memory cache) - dst.open(output, TRUE, FALSE); - - // Get src page count - int count = src.getPageCount(); - - // Clone src to dst - for(int page = 0; page < count; page++) { - // Load the bitmap at position 'page' - image = src.lockPage(page); - if(image.isValid()) { - // add a new bitmap to dst - dst.appendPage(image); - // Unload the bitmap (do not apply any change to src) - src.unlockPage(image, FALSE); - } - } - - // Close src - src.close(0); - // Save and close dst - dst.close(output_flag); - - return TRUE; - } - - return FALSE; -} - -// ---------------------------------------------------------- - -void testMultiPage(const char *lpszMultiPage) { - cout << "testMultiPage ...\n"; - - testCloneMultiPage(lpszMultiPage, "clone.tif", 0); -} - - diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageMemory.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageMemory.cpp deleted file mode 100644 index 4144f3f..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageMemory.cpp +++ /dev/null @@ -1,276 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - - -#include "fipTest.h" - -using namespace std; - -// -------------------------------------------------------------------------- - -static BOOL -loadBuffer(const char *lpszPathName, BYTE **buffer, DWORD *length) { - struct stat file_info; - int result; - - // get data associated with lpszPathName - result = stat(lpszPathName, &file_info); - if(result == 0) { - // allocate a memory buffer and load temporary data - *buffer = (BYTE*)malloc(file_info.st_size * sizeof(BYTE)); - if(*buffer) { - FILE *stream = fopen(lpszPathName, "rb"); - if(stream) { - *length = (DWORD)fread(*buffer, sizeof(BYTE), file_info.st_size, stream); - fclose(stream); - - return TRUE; - } - } - } - - return FALSE; -} - -static BOOL -extractPagesFromMemory(FREE_IMAGE_FORMAT fif, fipMemoryIO& memIO) { - BOOL bMemoryCache = TRUE; - - char filename[256]; - fipImage image; - - // open the multipage bitmap stream as read-only - fipMultiPage src(bMemoryCache); - - src.open(memIO); - - if(src.isValid()) { - // get the page count - int count = src.getPageCount(); - // extract all pages - for(int page = 0; page < count; page++) { - // load the bitmap at position 'page' - image = src.lockPage(page); - if(image.isValid()) { - // save the page - sprintf(filename, "page%d.%s", page, FreeImage_GetFormatFromFIF(fif)); - image.save(filename, 0); - // Unload the bitmap (do not apply any change to src) - src.unlockPage(image, FALSE); - } else { - // an error occured: free the multipage bitmap handle (fipMultiPage destructor) and return - src.close(0); - return FALSE; - } - } - } - // make sure to close the multipage bitmap handle on exit (fipMultiPage destructor or direct call to src.close(0)) - return src.close(0); -} - -BOOL testLoadMultiBitmapFromMemory(const char *lpszPathName) { - BOOL bSuccess = FALSE; - - BYTE *buffer = NULL; - DWORD buffer_size = 0; - - // load source stream as a buffer, i.e. - // allocate a memory buffer and load temporary data - bSuccess = loadBuffer(lpszPathName, &buffer, &buffer_size); - assert(bSuccess); - - if(bSuccess) { - // attach the binary data to a memory stream - fipMemoryIO memIO(buffer, buffer_size); - - // get the file type - FREE_IMAGE_FORMAT fif = memIO.getFileType(); - - // extract pages - bSuccess = extractPagesFromMemory(fif, memIO); - assert(bSuccess); - - // close the memory stream (memIO destructor) - } - - // user is responsible for freeing the data - free(buffer); - - return bSuccess; -} - -// -------------------------------------------------------------------------- - -BOOL testSaveMultiBitmapToMemory(const char *input, const char *output, int output_flag) { - BOOL bSuccess; - - BOOL bCreateNew = FALSE; - BOOL bReadOnly = TRUE; - BOOL bMemoryCache = TRUE; - - // Open src file (read-only, use memory cache) - fipMultiPage src(bMemoryCache); - src.open(input, bCreateNew, bReadOnly, 0); - - if(src.isValid()) { - // open and allocate a memory stream - fipMemoryIO memIO; - - // save the file to memory - FREE_IMAGE_FORMAT fif = fipImage::identifyFIF(output); - bSuccess = src.saveToMemory(fif, memIO, output_flag); - assert(bSuccess); - - // src is no longer needed: close and free src file - src.close(0); - - // get the buffer from the memory stream - BYTE *mem_buffer = NULL; - DWORD size_in_bytes = 0; - - bSuccess = memIO.acquire(&mem_buffer, &size_in_bytes); - assert(bSuccess); - - // save the buffer in a file stream - FILE *stream = fopen(output, "wb"); - if(stream) { - fwrite(mem_buffer, sizeof(BYTE), size_in_bytes, stream); - fclose(stream); - } - - // close and free the memory stream (memIO destructor) - - return TRUE; - } - - return FALSE; -} - -BOOL testMemoryStreamMultiPageOpenSave(const char *lpszPathName, char *output, int input_flag, int output_flag) { - BOOL bSuccess = FALSE; - - BYTE *buffer = NULL; - DWORD buffer_size = 0; - - // load source stream as a buffer, i.e. - // allocate a memory buffer and load temporary data - bSuccess = loadBuffer(lpszPathName, &buffer, &buffer_size); - assert(bSuccess); - - // attach the binary data to a memory stream - fipMemoryIO src_stream(buffer, buffer_size); - assert(src_stream.isValid()); - - // open the multipage bitmap stream - fipMultiPage src; - src.open(src_stream, input_flag); - - // apply some modifications (everything being stored to the cache) ... - - if(src.isValid()) { - fipImage image; - - // get the page count - int count = src.getPageCount(); - assert(count > 2); - - // Load the bitmap at position '2' - image = src.lockPage(2); - if(image.isValid()) { - image.invert(); - // Unload the bitmap (apply change to src, modifications are stored to the cache) - src.unlockPage(image, TRUE); - } - - // delete page 0 (modifications are stored to the cache) - src.deletePage(0); - - // insert a new page at position '0' (modifications are stored to the cache) - image.load("test.jpg"); - src.insertPage(0, image); - } - - // save the modification into the output stream ... - - if(src.isValid()) { - // open and allocate a memory stream - fipMemoryIO dst_stream; - assert(dst_stream.isValid()); - - // save the file to memory - FREE_IMAGE_FORMAT fif = fipImage::identifyFIF(output); - src.saveToMemory(fif, dst_stream, output_flag); - - // src is no longer needed - // close and free the memory stream - src_stream.close(); - // close and free src file (nothing is done, the cache is cleared) - src.close(0); - - // at this point, the input buffer is no longer needed - // !!! user is responsible for freeing the initial source buffer !!! - free(buffer); buffer = NULL; - - // get the dst buffer from the memory stream - BYTE *dst_buffer = NULL; - DWORD size_in_bytes = 0; - - dst_stream.acquire(&dst_buffer, &size_in_bytes); - - // save the buffer in a file stream - FILE *stream = fopen(output, "wb"); - if(stream) { - fwrite(dst_buffer, sizeof(BYTE), size_in_bytes, stream); - fclose(stream); - } - - // close and free the memory stream (destructor is called) - - return TRUE; - } - - if(buffer) { - free(buffer); - } - - return FALSE; -} - -// -------------------------------------------------------------------------- - -void testMultiPageMemory(const char *lpszPathName) { - BOOL bSuccess; - - cout << "testMultiPageMemory ...\n"; - - // test FreeImage_LoadMultiBitmapFromMemory - bSuccess = testLoadMultiBitmapFromMemory(lpszPathName); - assert(bSuccess); - - // test FreeImage_SaveMultiBitmapToMemory - bSuccess = testSaveMultiBitmapToMemory(lpszPathName, "mpage-mstream.tif", 0); - assert(bSuccess); - - // test FreeImage_LoadMultiBitmapFromMemory & FreeImage_SaveMultiBitmapToMemory - bSuccess = testMemoryStreamMultiPageOpenSave(lpszPathName, "mpage-mstream-redirect.tif", 0, 0); - assert(bSuccess); - -} diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageStream.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageStream.cpp deleted file mode 100644 index 86dc7c7..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMPageStream.cpp +++ /dev/null @@ -1,222 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - - -#include "fipTest.h" - -using namespace std; - -// -------------------------------------------------------------------------- - -static unsigned DLL_CALLCONV -myReadProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - return fread(buffer, size, count, (FILE *)handle); -} - -static unsigned DLL_CALLCONV -myWriteProc(void *buffer, unsigned size, unsigned count, fi_handle handle) { - return fwrite(buffer, size, count, (FILE *)handle); -} - -static int DLL_CALLCONV -mySeekProc(fi_handle handle, long offset, int origin) { - return fseek((FILE *)handle, offset, origin); -} - -static long DLL_CALLCONV -myTellProc(fi_handle handle) { - return ftell((FILE *)handle); -} - -BOOL testStreamMultiPageOpen(const char *input, int flags) { - // initialize your own IO functions - - FreeImageIO io; - - io.read_proc = myReadProc; - io.write_proc = myWriteProc; - io.seek_proc = mySeekProc; - io.tell_proc = myTellProc; - - BOOL bSuccess = FALSE; - - // Open src stream in read-only mode - FILE *file = fopen(input, "r+b"); - if (file != NULL) { - fipMultiPage src; - - // Open the multi-page file - src.open(&io, (fi_handle)file, flags); - - if(src.isValid()) { - // get the page count - int count = src.getPageCount(); - assert(count > 1); - - // delete page 0 (modifications are stored to the cache) - src.deletePage(0); - - // Close src file (nothing is done, the cache is cleared) - bSuccess = src.close(0); - assert(bSuccess); - } - - // Close the src stream - fclose(file); - - return bSuccess; - } - - return bSuccess; -} - -BOOL testStreamMultiPageSave(const char *input, const char *output, int input_flag, int output_flag) { - // initialize your own IO functions - - FreeImageIO io; - - io.read_proc = myReadProc; - io.write_proc = myWriteProc; - io.seek_proc = mySeekProc; - io.tell_proc = myTellProc; - - BOOL bCreateNew = FALSE; - BOOL bReadOnly = TRUE; - BOOL bMemoryCache = TRUE; - - // Open src file (read-only, use memory cache) - fipMultiPage src(bMemoryCache); - src.open(input, bCreateNew, bReadOnly, input_flag); - - if(src.isValid()) { - // Open dst stream in read/write mode - FILE *file = fopen(output, "w+b"); - if (file != NULL) { - // Save the multi-page file to the stream - FREE_IMAGE_FORMAT fif = fipImage::identifyFIF(output); - BOOL bSuccess = src.saveToHandle(fif, &io, (fi_handle)file, output_flag); - assert(bSuccess); - - // Close the dst stream - fclose(file); - - // Close src file (or let the destructor close it) - return src.close(0); - - return TRUE; - } - - // Close src file (or let the destructor close it) - src.close(0); - } - - return FALSE; -} - -BOOL testStreamMultiPageOpenSave(const char *input, const char *output, int input_flag, int output_flag) { - // initialize your own IO functions - - FreeImageIO io; - - io.read_proc = myReadProc; - io.write_proc = myWriteProc; - io.seek_proc = mySeekProc; - io.tell_proc = myTellProc; - - BOOL bSuccess = FALSE; - - // Open src stream in read-only mode - FILE *src_file = fopen(input, "r+b"); - assert(src_file); - if (src_file != NULL) { - fipMultiPage src; - // Open the multi-page file - src.open(&io, (fi_handle)src_file, input_flag); - - if(src.isValid()) { - fipImage image; - - // get the page count - int count = src.getPageCount(); - assert(count > 2); - - // Load the bitmap at position '2' - image = src.lockPage(2); - if(image.isValid()) { - image.invert(); - // Unload the bitmap (apply change to src, modifications are stored to the cache) - src.unlockPage(image, TRUE); - } - - // delete page 0 (modifications are stored to the cache) - src.deletePage(0); - - // insert a new page at position '0' (modifications are stored to the cache) - image.load("test.jpg"); - src.insertPage(0, image); - - // Open dst stream in read/write mode - FILE *dst_file = fopen(output, "w+b"); - assert(dst_file); - if (dst_file != NULL) { - // Save the multi-page file to the stream (modifications are applied) - FREE_IMAGE_FORMAT fif = fipImage::identifyFIF(output); - BOOL bSuccess = src.saveToHandle(fif, &io, (fi_handle)dst_file, output_flag); - assert(bSuccess); - - // Close the dst stream - fclose(dst_file); - } - - // Close src file (nothing is done, the cache is cleared) - bSuccess = src.close(0); - assert(bSuccess); - } - - // Close the src stream - fclose(src_file); - - return bSuccess; - } - - return FALSE; -} - -// -------------------------------------------------------------------------- - -void testStreamMultiPage(const char *lpszPathName) { - BOOL bSuccess; - - cout << "testStreamMultiPage ...\n"; - - // test multipage stream (opening) - bSuccess = testStreamMultiPageOpen(lpszPathName, 0); - assert(bSuccess); - - // test multipage stream (save as) - bSuccess = testStreamMultiPageSave(lpszPathName, "clone-stream.tif", 0, 0); - assert(bSuccess); - - // test multipage stream (open, modify, save as) - bSuccess = testStreamMultiPageOpenSave(lpszPathName, "redirect-stream.tif", 0, 0); - assert(bSuccess); - -} diff --git a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMemIO.cpp b/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMemIO.cpp deleted file mode 100644 index 233189d..0000000 --- a/DSTexCompress/FreeImage/Wrapper/FreeImagePlus/test/fipTestMemIO.cpp +++ /dev/null @@ -1,171 +0,0 @@ -// ========================================================== -// FreeImagePlus Test Script -// -// Design and implementation by -// - Herv Drolon (drolon@infonie.fr) -// -// This file is part of FreeImage 3 -// -// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -// THIS DISCLAIMER. -// -// Use at your own risk! -// ========================================================== - - -#include "fipTest.h" - -using namespace std; - -// -------------------------------------------------------------------------- -// Memory IO test scripts - -/** -Test saving to a memory stream -*/ -void testSaveMemIO(const char *lpszPathName) { - - // load a regular file - FREE_IMAGE_FORMAT fif = FreeImage_GetFileType(lpszPathName); - FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, 0); - - // open a memory handle - fipMemoryIO memIO; - - // save the file to memory - memIO.save(fif, dib, 0); - - // at this point, memIO contains the entire PNG data in memory. - // the amount of space used by the memory is equal to file_size - long file_size = memIO.tell(); - assert(file_size != 0); - - // its easy load an image from memory as well - - // seek to the start of the memory stream - memIO.seek(0L, SEEK_SET); - - // get the file type - FREE_IMAGE_FORMAT mem_fif = memIO.getFileType(); - - // load an image from the memory handle - FIBITMAP *check = memIO.load(mem_fif, 0); - - // save as a regular file - FreeImage_Save(FIF_PNG, check, "dump.png", PNG_DEFAULT); - - FreeImage_Unload(check); - FreeImage_Unload(dib); - - // The memIO object will be destroyed automatically -} - -/** -Test loading from a buffer attached to a memory stream -*/ -void testLoadMemIO(const char *lpszPathName) { - struct stat buf; - int result; - - // get data associated with lpszPathName - result = stat(lpszPathName, &buf); - if(result == 0) { - // allocate a memory buffer and load temporary data - BYTE *mem_buffer = (BYTE*)malloc(buf.st_size * sizeof(BYTE)); - if(mem_buffer) { - FILE *stream = fopen(lpszPathName, "rb"); - if(stream) { - fread(mem_buffer, sizeof(BYTE), buf.st_size, stream); - fclose(stream); - - // attach the binary data to a memory stream - fipMemoryIO memIO(mem_buffer, buf.st_size); - - // get the file type - FREE_IMAGE_FORMAT fif = memIO.getFileType(); - - // load an image from the memory stream - FIBITMAP *check = memIO.load(fif, PNG_DEFAULT); - - // save as a regular file - FreeImage_Save(FIF_PNG, check, "blob.png", PNG_DEFAULT); - - // close the stream (memIO is destroyed) - } - - // user is responsible for freeing the data - free(mem_buffer); - } - } -} - -/** -Test extracting a memory buffer from a memory stream -*/ -void testAcquireMemIO(const char *lpszPathName) { - - // load a regular file - FREE_IMAGE_FORMAT fif = FreeImage_GetFileType(lpszPathName); - FIBITMAP *dib = FreeImage_Load(fif, lpszPathName, 0); - - // open and allocate a memory stream - fipMemoryIO memIO; - - // save the file to memory - memIO.save(FIF_PNG, dib, PNG_DEFAULT); - - // get the buffer from the memory stream - BYTE *mem_buffer = NULL; - DWORD size_in_bytes = 0; - - memIO.acquire(&mem_buffer, &size_in_bytes); - - // save the buffer in a file stream - FILE *stream = fopen("buffer.png", "wb"); - if(stream) { - fwrite(mem_buffer, sizeof(BYTE), size_in_bytes, stream); - fclose(stream); - } - - // close and free the memory stream (memIO is destroyed) -} - -/** -Test Loading / Saving from / to a memory stream using fipImage -*/ -void testImageMemIO(const char *lpszPathName) { - BOOL bSuccess = FALSE; - - fipMemoryIO memIO; - fipImage image; - - // load a regular file - bSuccess = image.load(lpszPathName); - if(bSuccess) { - // save the file to a memory stream - bSuccess = image.saveToMemory(FIF_PNG, memIO, PNG_DEFAULT); - assert(bSuccess); - - // load the file from the memory stream - memIO.seek(0L, SEEK_SET); - bSuccess = image.loadFromMemory(memIO, 0); - assert(bSuccess); - } -} - -void testMemIO(const char *lpszPathName) { - cout << "testMemIO ...\n"; - - testSaveMemIO(lpszPathName); - testLoadMemIO(lpszPathName); - testAcquireMemIO(lpszPathName); - testImageMemIO(lpszPathName); -} - diff --git a/DSTexCompress/FreeImage/Wrapper/VB6/mfreeimage/MFreeImage.bas b/DSTexCompress/FreeImage/Wrapper/VB6/mfreeimage/MFreeImage.bas deleted file mode 100644 index 00c4314..0000000 --- a/DSTexCompress/FreeImage/Wrapper/VB6/mfreeimage/MFreeImage.bas +++ /dev/null @@ -1,12455 +0,0 @@ -Attribute VB_Name = "MFreeImage" -'// ========================================================== -'// Visual Basic Wrapper for FreeImage 3 -'// Original FreeImage 3 functions and VB compatible derived functions -'// Design and implementation by -'// - Carsten Klein (cklein05@users.sourceforge.net) -'// -'// Main reference : Curland, Matthew., Advanced Visual Basic 6, Addison Wesley, ISBN 0201707128, (c) 2000 -'// Steve McMahon, creator of the excellent site vbAccelerator at http://www.vbaccelerator.com/ -'// MSDN Knowlede Base -'// -'// This file is part of FreeImage 3 -'// -'// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY -'// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES -'// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE -'// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED -'// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT -'// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY -'// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL -'// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER -'// THIS DISCLAIMER. -'// -'// Use at your own risk! -'// ========================================================== - -'// ========================================================== -'// CVS -'// $Revision: 2.13 $ -'// $Date: 2010/08/11 16:02:40 $ -'// $Id: MFreeImage.bas,v 2.13 2010/08/11 16:02:40 cklein05 Exp $ -'// ========================================================== - - -Option Explicit - -'-------------------------------------------------------------------------------- -' General notes on implementation and design -'-------------------------------------------------------------------------------- - -' General: - -' Most of the pointer type parameters used in the FreeImage API are actually -' declared as Long in VB. That is also true for return values. 'Out' parameters -' are declared ByRef, so they can receive the provided address of the pointer. -' 'In' parameters are declared ByVal since in VB the Long variable is not a -' pointer type but contains the address of the pointer. - - -' Functions returning a special type: - -' Some of the following external function declarations of the FreeImage 3 functions -' are declared Private. Additionally the token 'Int' is appended to the VB function -' name, what means 'Internal' to avoid naming confusion. All of these return a value -' of a certain type that can't be used with a declared function in VB directly but -' would need the function to be declared in a type library. Since this wrapper module -' should not depend on a compile time type library, these functions require some extra -' work to be done and also a VB wrapper function to make them look like the C/C++ -' function. - - -' Functions returning Strings: - -' Some of the declared FreeImage functions are defined as 'const char *' in C/C++ -' and so actually return a string pointer. Without using a type library for declaring -' these functions, in VB it is impossible to declare these functions to return a -' VB String type. So each of these functions is wrapped by a VB implemented function -' named correctly according to the FreeImage API, actually returning a 'real' VB String. - - -' Functions returning Booleans: - -' A Boolean is a numeric 32 bit value in both C/C++ and VB. In C/C++ TRUE is defined -' as 1 whereas in VB True is -1 (all bits set). When a function is declared as 'Boolean' -' in VB, the return value (all 32 bits) of the called function is just used "as is" and -' maybe assigned to a VB boolean variable. A Boolean in VB is 'False' when the numeric -' value is NULL (0) and 'True' in any other case. So, at a first glance, everything -' would be great since both numeric values -1 (VB True) and 1 (C/C++ TRUE) are actually -' 'True' in VB. -' But, if you have a VB variable (or a function returning a Boolean) with just some bits -' set and use the VB 'Not' operator, the result is not what you would expect. In this -' case, if bTest is True, (Not bTest) is also True. The 'Not' operator just toggles all -' bits by XOR-ing the value with -1. So, the result is not so surprisingly any more: -' The C/C++ TRUE value is 0...0001. When all bits are XORed with 1, the result is -' 1...1110 what is also not NULL (0) so this is still 'True' in VB. -' The resolution is to convert these return values into real VB Booleans in a wrapper -' function, one for each declared FreeImage function. Therefore each C/C++ BOOL -' function is declared Private as xxxInt(...). A Public Boolean wrapper function -' xxx(...) returns a real Boolean with 'xxx = (xxxInt(...) = 1)'. - - -' Extended and derived functions: - -' Some of the functions are additionally provided in an extended, call it a more VB -' friendly version, named '...Ex'. For example look at the 'FreeImage_GetPaletteEx' -' function. Most of them are dealing with arrays and so actually return a VB style -' array of correct type. - -' The wrapper also includes some derived functions that should make life easier for -' not only a VB programmer. - -' Better VB interoperability is given by offering conversion between DIBs and -' VB Picture objects. See the FreeImage_CreateFromOlePicture and -' FreeImage_GetOlePicture functions. - -' Both known VB functions LoadPicture() and SavePicture() are provided in extended -' versions calles LoadPictureEx() and SavePictureEx() offering the FreeImage 3s -' image file types. - -' The FreeImage 3 error handling is provided in VB after calling the VB specific -' function FreeImage_InitErrorHandler() - - -' Enumerations: - -' All of the enumaration members are additionally 'declared' as constants in a -' conditional compiler directive '#If...#Then' block that is actually unreachable. -' For example see: -' -' Public Enum FREE_IMAGE_QUANTIZE -' FIQ_WUQUANT = 0 ' Xiaolin Wu color quantization algorithm -' FIQ_NNQUANT = 1 ' NeuQuant neural-net quantization algorithm by Anthony Dekker -' End Enum -' #If False Then -' Const FIQ_WUQUANT = 0 -' Const FIQ_NNQUANT = 1 -' #End If -' -' Since this module is supposed to be used directly in VB projects rather than in -' compiled form (mybe through an ActiveX-DLL), this is for tweaking some ugly VB -' behaviour regarding enumerations. Enum members are automatically adjusted in case -' by the VB IDE whenever you type these members in wrong case. Since these are also -' constants now, they are no longer adjusted to wrong case but always corrected -' according to the definition of the constant. As the expression '#If False Then' -' actually never comes true, these constants are not really defined either when running -' in the VB IDE nor in compiled form. - - -'-------------------------------------------------------------------------------- -' ToDo and known issues (unordered and with no priority) -'-------------------------------------------------------------------------------- - -' ToDo: more inline documentation for mask image creation and icon functions -' needed - -'-------------------------------------------------------------------------------- -' Change Log -'-------------------------------------------------------------------------------- - -'* : fixed -'- : removed -'! : changed -'+ : added -' -'August 11, 2010 - 2.13 -'+ [Carsten Klein] added PSD load flags PSD_CMYK and PSD_LAB as well as the enum constants FILO_PSD_CYMK and FILO_PSD_LAB. -'+ [Carsten Klein] added TIFF_LOGLUV save flag as well as the enum constant FISO_TIFF_LOGLUV. -' -'July 5, 2010 - 2.12 -'+ [Carsten Klein] added support for the new EXIF_RAW metadata model by adding enum constant FIMD_EXIF_RAW. -'+ [Carsten Klein] added the new FIF_LOAD_NOPIXELS flag as well as the enum constant FILO_LOAD_NOPIXELS. -'+ [Carsten Klein] added function declaration FreeImage_HasPixelsInt and a real VB Boolean returning function FreeImage_HasPixels. -'+ [Carsten Klein] added function declaration FreeImage_FIFSupportsNoPixelsInt and a real VB Boolean returning function FreeImage_FIFSupportsNoPixels. -' -'June 20, 2010 - 2.11 -'+ [Carsten Klein] added new save flag JPEG_OPTIMIZE (also added FISO_JPEG_OPTIMIZE to enumeration FREE_IMAGE_SAVE_OPTIONS). -' -'April 20, 2010 - 2.10 -'+ [Carsten Klein] added new save flag TARGA_SAVE_RLE (also added FISO_TARGA_SAVE_RLE to enumeration FREE_IMAGE_SAVE_OPTIONS). -'! [Carsten Klein] changed constants FREEIMAGE_MINOR_VERSION and FREEIMAGE_RELEASE_SERIAL: set to 14 and 0 respectively to match current version 3.14.0 -'+ [Carsten Klein] added function FreeImage_ConvertToFloat. -'+ [Carsten Klein] added function FreeImage_SaveMultiBitmapToMemory. -'+ [Carsten Klein] added wrapper functions FreeImage_SaveMultiBitmapToMemoryEx and FreeImage_SaveMultiBitmapToMemoryEx2. -'+ [Carsten Klein] added wrapper function FreeImage_OpenMultiBitmapEx, which only opens existing files, but has support for automatic image format detection. -'+ [Carsten Klein] added wrapper function FreeImage_CreateMultiBitmapEx, which only creates new (empty) multi-page bitmaps with support for automatic image format detection. -'* [Carsten Klein] fixed a bug in FreeImage_LoadEx: now uses the file specified for format detection rather than the filename extension. -'+ [Carsten Klein] improved error messages in function FreeImage_LoadEx. -'* [Carsten Klein] fixed a bug in FreeImage_AcquireMemoryEx: no more crashes when passing an uninitialized array. -'+ [Carsten Klein] added thin wrapper functions, enabling proper handling of Boolean parameters: -'+ added wrapper function FreeImage_OpenMultiBitmap -'+ added wrapper function FreeImage_UnlockPage -'+ added wrapper function FreeImage_RotateEx -'+ added wrapper function FreeImage_MakeThumbnail -'+ added wrapper function FreeImage_GetAdjustColorsLookupTable -'+ added wrapper function FreeImage_ApplyColorMapping -'+ added wrapper function FreeImage_SwapColors -'+ added wrapper function FreeImage_SwapColorsByLong -'+ added wrapper function FreeImage_ApplyIndexMapping -'+ added wrapper function FreeImage_SetTransparent -'+ added wrapper function FreeImage_ConvertFromRawBits -'+ added wrapper function FreeImage_ConvertToRawBits -'+ added wrapper function FreeImage_ConvertToStandardType -'+ added wrapper function FreeImage_ConvertToType -'! [Carsten Klein] changed the parameter names of most functions. -'! [Carsten Klein] changed signature of functions FreeImage_ConvertFromRawBits and FreeImage_ConvertToRawBits: 'ByRef Bits As Long' is now 'ByVal BitsPtr As Long'. -'+ [Carsten Klein] added wrapper functions FreeImage_ConvertFromRawBitsEx and FreeImage_ConvertToRawBitsEx. -'* [Carsten Klein] fixed a bug in declaration of function FreeImage_TmoReinhard05Ex: parameters 'Adaption' and 'ColorCorrection' are now passed by value. -'- [Carsten Klein] removed half-implemented function FreeImage_SetChannelEx. -'+ [Carsten Klein] added wrapper function FreeImage_SetChannelIOP. -'- [Carsten Klein] removed needless default values of optional parameters. -'- [Carsten Klein] removed function declaration FreeImage_CompositeByLong: replaced by declaration FreeImage_Composite. -'! [Carsten Klein] changed function declaration FreeImage_Composite: application back color is now passed as ByRef ... As Any and so takes both RGBQUAD and Long valus. -'+ [Carsten Klein] added wrapper function FreeImage_UnloadEx, which additionally sets the ByRef-passed Bitmap handle to zero after unloading. -'+ [Carsten Klein] added wrapper functions ConvertColor and ConvertOleColor to convert VB-style BGR colors into RGB color values. -' -'! now FreeImage version 3.14.0 -' -'February 9, 2010 - 2.9.1 -'* [Carsten Klein] fixed a bug in FreeImage_GetBackgroundColorAsLong: parameter 'bkcolor' is now properly passed ByRef. -' -'February 9, 2010 - 2.9 -'* [Carsten Klein] fixed a syntax typo -' -'February 8, 2010 - 2.8 -'* [Mike Weir] fixed a bug in function FreeImage_ApplyColorMappingEx: now properly includes all specified mapping entries -'* [Carsten Klein] fixed a bug in function FreeImage_ApplyIndexMappingEx: now properly includes all specified mapping entries -'* [Mike Weir] fixed a bug in function FreeImage_RescaleEx: now also rescales the image, if either the new width or height matches the image's current size -'* [WinAnd / Carsten Klein] fixed a bug in function FreeImage_GetTransparencyTableExClone: returns an uninitialized array if there is no transparency table -'* [WinAnd / Carsten Klein] fixed a bug in function FreeImage_SearchPalette: no longer crashes if there is no transparency table -' -'December 21, 2009 - 2.7 -'! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 1 to match current version 3.13.1 -' -'! now FreeImage version 3.13.1 -' -'December 18, 2009 - 2.6 -'- [Carsten Klein] removed usage of constants vbPicTypeBitmap and vbPicTypeIcon: these are not available in VBA environments like Excel, Access or Outlook. -' -'September 08, 2009 - 2.5 -'! [Carsten Klein] changed constant FREEIMAGE_MINOR_VERSION: set to 13 to match current version 3.13.0 -'+ [Carsten Klein] added load flag constant JPEG_EXIFROTATE and new member FILO_JPEG_EXIFROTATE to enumeration FREE_IMAGE_LOAD_OPTIONS. -'+ [Carsten Klein] added support for the PFM image format. -'+ [Carsten Klein] added support for the PICT and RAW image formats. -'+ [Carsten Klein] added UNICODE functions FreeImage_JPEGTransformU and FreeImage_JPEGCropU. -'+ [Carsten Klein] added enumeration FREE_IMAGE_COLOR_OPTIONS, which contains options to specify colors, used with FreeImage_FillBackground and FreeImage_EnlargeCanvas. -'+ [Carsten Klein] added function FreeImage_FillBackground: although this returns BOOL in C/C++, the VB version only returns a Long. -'+ [Carsten Klein] added wrapper functions FreeImage_FillBackgroundEx and FreeImage_FillBackgroundByLong, taking an RGBQUAD and a Long 'Color' argument respectively and return a true VB Boolean. -'+ [Carsten Klein] added function FreeImage_EnlargeCanvas. -'+ [Carsten Klein] added functions FreeImage_AllocateEx and FreeImage_AllocateExT. -'+ [Carsten Klein] added function FreeImage_TmoReinhard05Ex. -'+ [Carsten Klein] added function FreeImage_Rotate. -'+ [Carsten Klein] added wrapper function FreeImage_RotateIOP. -' -'! now FreeImage version 3.13.0 -' -'March 18, 2009 - 2.4.2 -'+ [Carsten Klein] added enumeration FREE_IMAGE_FRAME_DISPOSAL_METHODS, which provides the frame disposal options needed to create animated GIF files. -' -'July 29, 2008 - 2.4.1 -'* [Carsten Klein] minor documentation updates -'! [Carsten Klein] renamed member FICF_PALETTISED_8BPP of enumeration FREE_IMAGE_CONVERSION_FLAGS into FICF_PALLETISED_8BPP. -' -'June 30, 2008 - 2.4 -'* [Carsten Klein] fixed some minor issues in FreeImage_PaintTransparent() -' -'June 06, 2008 - 2.3 -'+ [Carsten Klein] added new compression flags to the JPEG and PNG plugins -'! [Carsten Klein] renamed wrapper function FreeImage_CloneMetadata() to FreeImage_CloneMetadataEx(): now, there is a native function called FreeImage_CloneMetadata(). -'+ [Carsten Klein] added private and internal function declaration for FreeImage_CloneMetadata() along with it's public Boolean returning wrapper function. -'- [Carsten Klein] removed the FreeImage_ColorQuantizeEx() stuff from both functions FreeImage_ConvertColorDepth() and FreeImage_ConvertColorDepthIOP(): removed parameters PaletteSize, ReserveSize and ReservePalette. -'- [Carsten Klein] changed declaration of FreeImage_ColorQuantizeEx() to be a internal function private to the wrapper with an 'Int' appendix. -'+ [Carsten Klein] added two more VB-friendly public wrapper functions FreeImage_ColorQuantizeEx() and FreeImage_ColorQuantizeExIOP(). -'+ [Carsten Klein] added wrapper function FreeImage_GetPalettePtr(): gets the pointer to a specified array of RGBQUADs: intended to be used together with any of the ColorQuantizeEx functions. -'! [Carsten Klein] changed constant FREEIMAGE_MINOR_VERSION: set to 11 to match current version 3.11.0 -' -'! now FreeImage version 3.11.0 -' -'December 14, 2007 - 2.2.1 -'+ [Carsten Klein] added constants for member 'biCompression' in BITMAPINFOHEADER struct -'+ [Carsten Klein] added wrapper function FreeImage_GetInfoHeaderEx(), which returns a fully populated BITMAPINFOHEADER struct for a bitmap. -'* [Carsten Klein] fixed a bug in FreeImage_GetFileTypeFromMemoryEx(): now calls FreeImage_CloseMemory() releasing the hStream to prevent memory leaks. -'+ [Carsten Klein] added wrapper function FreeImage_GetColorizedPalette(): returns a colorized greyscale palettte. -'+ [Carsten Klein] added wrapper function FreeImage_Colorize(): applies a colorized greyscale palettte obtained from FreeImage_GetColorizedPalette() to a bitmap. -'+ [Carsten Klein] added wrapper function FreeImage_Sepia(): calls FreeImage_Colorize() with proper parameters to apply a so called sepia palette to a bitmap. -' -'December 12, 2007 - 2.2 -'* [Carsten Klein] fixed a small bug in FreeImage_PaintTransparent, which now calls function FreeImage_ConvertTo32Bits instead of FreeImage_ConvertTo32Bits2. -' -'November 15, 2007 - 2.1 -'* [Carsten Klein] adjusted page numbers of the API documentation in FreeImage function declarations to match FreeImage 3.10.0 API documentation -'- [Carsten Klein] removed parameter 'UnloadSource' from function FreeImage_GetOlePictureIcon(): an hIcon should not be destroyed if OleCreatePictureIndirect() is called with fOwn = True. -'! [Carsten Klein] refactored FreeImage_GetOlePicture(): now relies on FreeImage_GetBitmap(). -' -'November 10, 2007 - 2.0.8 -'! [Carsten Klein] changed declaration of FreeImage_SetOutputMessage(): now points transparently to the __stdcall version of this function in the library. -'+ [Carsten Klein] added function declaraton for FreeImage_MultigridPoissonSolver(). -'+ [Carsten Klein] added function declaraton for FreeImage_GetTransparentIndex() and FreeImage_SetTransparentIndex(). -'+ [Carsten Klein] added private and internal function declaration for FreeImage_AdjustColors() along with it's public Boolean returning wrapper function. -'+ [Carsten Klein] added function declaraton for FreeImage_GetAdjustColorsLookupTable(). -'+ [Carsten Klein] added wrapper function FreeImage_GetAdjustColorsLookupTableEx(): this takes a real VB style Byte array ton receive the lookup table created. -'+ [Carsten Klein] added function declaraton for FreeImage_ApplyColorMapping(). -'+ [Carsten Klein] added wrapper function FreeImage_ApplyColorMappingEx(): this takes a real VB style RGBQUAD array. -'+ [Carsten Klein] added function declaratons for FreeImage_SwapColors() and FreeImage_SwapColorsByLong(). -'+ [Carsten Klein] added function declaraton for FreeImage_ApplyIndexMapping(). -'+ [Carsten Klein] added wrapper function FreeImage_ApplyIndexMappingEx(): this takes a real VB style Byte array. -'+ [Carsten Klein] added function declaraton for FreeImage_SwapPaletteIndices(). -' -'November 05, 2007 - 2.0.7 -'+ [Carsten Klein] added 4 bit color depth to both function pGetNextColorDepth() and pGetPrevousColorDepth() -'- [Carsten Klein] removed member FICF_PREPARE_RESCALE from enumeration FREE_IMAGE_CONVERSION_FLAGS -'- [Carsten Klein] removed all references to FICF_PREPARE_RESCALE: Converting color depth before rescaling an image is no longer performed by the wrapper. Since FreeImage now transparently converts color depth on rescaling, doing this in the wrapper is no longer needed. -'! [Carsten Klein] refactored wrapper function FreeImage_ConvertColorDepth(): removed case FICF_PREPARE_RESCALE; is now more similar to C# wrapper's version of this function. -'! [Carsten Klein] refactored wrapper function FreeImage_SaveEx(): removed case FICF_PREPARE_RESCALE; is now more similar to C# wrapper's version of this function. -' -'September 14, 2007 - 2.0.6 -'+ [Carsten Klein] added function declaration and Boolean wrapper function for FreeImage_PreMultiplyWithAlpha(). -' -'July 26, 2007 - 2.0.5 -'+ [Carsten Klein] added wrapper function FreeImage_GetBitmap(): returns an HBITMAP created by the CreateDIBSection() function and so has the same color depth as the original DIB. -'+ [Carsten Klein] added wrapper function FreeImage_GetBitmapForDevice(): returns an HBITMAP created by the CreateDIBitmap() function and so has the same color depth as the specified reference DC or as the desktop, if the 'hDC' parameter was omitted. -'- [Carsten Klein] removed function declaration for GetWindowDC(): this function is no longer used. -'* [Carsten Klein] fixed a bug in wrapper function FreeImage_IsExtensionValidForFIF(): string comparison now includes a comma. -'* [Carsten Klein] fixed a bug in wrapper function FreeImage_IsFilenameValidForFIF(): string comparison now includes a comma. -' -'July 25, 2007 - 2.0.4 -'* [Carsten Klein] fixed a bug in function FreeImage_GetPaletteExClone(): now actually returns the palette as RGBQUAD array plus some other minor improvements -'+ [Carsten Klein] added wrapper function FreeImage_GetPaletteExLongClone(): this function returns a VB style Byte array that is only wrapped around FreeImage's pointer to a DIB's transparency table. -'+ [Carsten Klein] added wrapper function FreeImage_GetTransparencyTableEx(): this function returns a VB style Byte array that is only wrapped around FreeImage's pointer to a DIB's transparency table. -'! [Carsten Klein] changed name of wrapper function FreeImage_GetTransparencyTableEx(): this function is now named FreeImage_GetTransparencyTableExClone(), since it actually returns a clone (deep copy) of an image's transparency table (compare with FreeImage_GetPaletteExClone()). -'+ [Carsten Klein] added wrapper function FreeImage_SetPalette(): sets an image's palette through a VB style RGBQUAD array. -'+ [Carsten Klein] added wrapper function FreeImage_SetPaletteLong(): sets an image's palette through a VB style Long array. -'+ [Carsten Klein] added function declaration for CreateDIBsection() -'+ [Carsten Klein] added function declaration for DeleteDC() -'* [Carsten Klein] fixed a bug in wrapper function FreeImage_CreateFromScreen(): now the memory DC is deleted with the DeleteDC() function and no longer with the DeleteObject() function. -' -'July 05, 2007 - 2.0.3 -'+ [Carsten Klein] added wrapper function FreeImage_GetFileTypeFromMemoryEx(): more VB friendly version of FreeImage_GetFileTypeFromMemory() which may take an array rather than a FIMEMORY stream. -' -'May 21, 2007 - 2.0.2 -'! [Carsten Klein] changed constant FREEIMAGE_MINOR_VERSION: set to 10 to match current version 3.10.0 -'! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 0 to match current version 3.10.0 -'+ [Carsten Klein] added image format constants FIF_EXR, FIF_J2K and FIF_JP2 to enumeration FREE_IMAGE_FORMAT. -'+ [Carsten Klein] added tone mapping operator constant FITMO_FATTAL02 to enumeration FREE_IMAGE_TMO. -'+ [Carsten Klein] added save option constants J2K_DEFAULT and JP2_DEFAULT for JPEG2000 format. -'+ [Carsten Klein] added save option constants EXR_DEFAULT, EXR_FLOAT, EXR_NONE, EXR_ZIP, EXR_PIZ, EXR_PXR24, EXR_B44 and EXR_LC for EXR format. -'+ [Carsten Klein] added save option constants for EXR format to enumeration FREE_IMAGE_SAVE_OPTIONS. -'+ [Carsten Klein] added declared function FreeImage_TmoFattal02(): adds support for Gradient domain high dynamic range compression (R. Fattal, 2002) -' -'! now FreeImage version 3.10.0 -' -'February 24, 2007 - 2.0.1 -'* [Carsten Klein] fixed a bug in function FreeImage_CreateFromScreen(): now size of image created is according to window to be captured if parameter 'hwnd' <> 0. -'+ [Carsten Klein] added parameter 'bClientAreaOnly' to function FreeImage_CreateFromScreen(). -'+ [Carsten Klein] added blitting option 'CAPTUREBLT' when calling function BitBlt() in function FreeImage_CreateFromScreen(). -'- [Carsten Klein] removed unused variable 'hDIB' from functions FreeImage_CreateFromScreen() and FreeImage_LoadEx(). Thanks to Bruce Rusk for pointing that out. -' -'February 16, 2007 - 2.0 -'! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 3 to match current version 3.9.3 -'! [Carsten Klein] changed JPEG load/save flag option values: changed constants and both enumerations FREE_IMAGE_SAVE_OPTIONS and FREE_IMAGE_SAVE_OPTIONS. -'+ [Carsten Klein] added ICC Color Profile support: -'! changed signature of declared function FreeImage_GetICCProfile(): is now declared 'Private' and suffixed with '...Int()'. -'+ added wrapper function FreeImage_GetICCProfile(): is the public wrapper function for private function FreeImage_GetICCProfileInt(), returing a real FIICCPROFILE structure. -'+ added constant FREE_IMAGE_ICC_COLOR_MODEL_MASK. -'+ added enumeration FREE_IMAGE_ICC_COLOR_MODEL. -'+ added wrapper function FreeImage_GetICCProfileColorModel(): returns the color profile's color model (FIICCPROFILE.flags member). -'+ added wrapper function FreeImage_GetICCProfileSize(): returns the color profile data's size in bytes. -'+ added wrapper function FreeImage_GetICCProfileDataPointer(): returns the pointer to the color profile data. -'+ added wrapper function FreeImage_HasICCProfile(): returns whether a color profile is available for a dib or not. -'! [Carsten Klein] changed behaviour of wrapper function FreeImage_RescaleEx() and all it's derived functions: no clone is returned if the actual and desired image size are the same. -'+ [Carsten Klein] added parameter 'bForceCloneCreation' to wrapper function FreeImage_RescaleEx() and all it's derived functions. -' -'! now FreeImage version 3.9.3 -' -'January 09, 2007 - 1.9.4 -'! [Carsten Klein] changed scope of declared function FreeImage_GetFileTypeUInt(): is now private according to all other '...Int' functions wrapped by a VB-friendly function. -'! [Carsten Klein] changed scope of declared function FreeImage_GetFIFFromFilenameUInt(): is now private according to all other '...Int' functions wrapped by a VB-friendly function. -'! [Carsten Klein] changed signature of declared functions FreeImage_GetBackgroundColorInt() and FreeImage_SetBackgroundColorInt(): now both have a 'ByRef bkcolor As RGBQUAD' parameter instead of 'ByVal bkcolor As Long'. -'+ [Carsten Klein] added declared functions FreeImage_GetBackgroundColorAsLongInt(): this has a 'ByRef bkcolor As Long' parameter and provides the background color as a Long value. -'+ [Carsten Klein] added declared functions FreeImage_SetBackgroundColorAsLongInt(): this has a 'ByRef bkcolor As Long' parameter and takes the background color as a Long value. -'! [Carsten Klein] changed signature of wrapper functions FreeImage_GetBackgroundColor() and FreeImage_SetBackgroundColor(): now both have a 'ByRef bkcolor As RGBQUAD' parameter instead of 'ByVal bkcolor As Long'. -'+ [Carsten Klein] added wrapper functions FreeImage_GetBackgroundColorAsLong() and FreeImage_SetBackgroundColorAsLong(): both have a 'ByRef bkcolor As Long' parameter and so offer getting and setting the background color through a Long value. -'+ [Carsten Klein] added wrapper functions FreeImage_GetBackgroundColorEx() and FreeImage_SetBackgroundColorEx(): both both take 4 ByRef Byte parameters 'Alpha', 'Red', 'Green' and 'Blue', one for each color component. -' -'January 05, 2007 - 1.9.3 -'+ [Carsten Klein] added wrapper function FreeImage_GetLockedPageNumbersEx(): this returns a real VB-style array of Longs containing the page numbers of all locked pages. -' -'January 02, 2007 - 1.9.2 -'* [Carsten Klein] fixed a bug in inline description of function FreeImage_GetPaletteEx(): now tells to use function FreeImage_DestroyLockedArrayRGBQUAD() to free an array returned by this function. -'* [Carsten Klein] fixed some minor bugs in inline documentation. -'* [Carsten Klein] fixed a serious bug in function FreeImage_SaveEx(): parameter 'UnloadSource' is now interpreted correctly under all circumstances. -'* [Carsten Klein] fixed some minor issues in function FreeImage_SaveEx(). -' -'December 29, 2006 - 1.9.1 -'+ [Carsten Klein] added enumeration item FID_BAYER16x16: now supports Bayer ordered dispersed dot dithering (order 4 dithering matrix). -' -'October 31, 2006 - 1.9 -'* [Carsten Klein] adjusted page numbers of the API documentation in header comments in FreeImage function declarations to match FreeImage 3.9.2 API documentation -'! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 2 to match current version 3.9.2 -'+ [Carsten Klein] added function declaration for FreeImage_JPEGCrop(): added both declaration and Boolean returning wrapper function. -'! [Carsten Klein] changed data type of all occurences of parameter 'Flags' from Long to either FREE_IMAGE_LOAD_OPTIONS or FREE_IMAGE_SAVE_OPTIONS enum. This is true for declared functions as well as for wrapper functions. -'+ [Carsten Klein] added function declaration for FreeImage_LoadMultiBitmapFromMemory(). -'+ [Carsten Klein] added wrapper function FreeImage_LoadMultiBitmapFromMemoryEx(): this is dealing with a VB style array (SAFEARRAY) like FreeImage_LoadFromMemoryEx() does. -' -'! now FreeImage version 3.9.2 -' -'October 30, 2006 - 1.8 -'* [Carsten Klein] fixed a memory leak in wrapper function SavePictureEx(). Thanks to Roogames for reporting that bug. -'! [Carsten Klein] changed return type of wrapper function SavePictureEx() to Boolean. -'+ [Carsten Klein] added wrapper function FreeImage_SaveEx() which brings all the features, as there are inline size- and color conversion and format guessing, so far only known from SavePictureEx() for DIBs. -'! [Carsten Klein] changed wrapper function SavePictureEx(): now this is only a thin wrapper for function FreeImage_SaveEx(). -'+ [Carsten Klein] added enumeration FREE_IMAGE_LOAD_OPTIONS. -'- [Carsten Klein] refactored enumeration FREE_IMAGE_SAVE_OPTIONS: removed unnecessary items from enumeration. -'! [Carsten Klein] changed wrapper function LoadPictureEx(): added parameter 'Options' (enum FREE_IMAGE_LOAD_OPTIONS) to specify image loading options (called 'flags' in FreeImage). -'+ [Carsten Klein] added wrapper function FreeImage_LoadEx() which brings all the features, as there are inline size- and color conversion and format guessing, so far only known from LoadPictureEx() for DIBs. -'! [Carsten Klein] changed wrapper function LoadPictureEx(): now this is only a thin wrapper for function FreeImage_LoadEx(). -' -'October 13, 2006 - 1.7.2 -'+ [Carsten Klein] added User32 function GetDesktopWindow() -'+ added User32 function GetWindowDC() -'- [Carsten Klein] removed unused constants DI_MASK, DI_IMAGE and DI_NORMAL -'+ added GDI32 function GetDeviceCaps() with constants HORZRES and VERTRES -'+ added GDI32 function SelectObject() -'+ added GDI32 function DeleteObject() -'+ added GDI32 function CreateCompatibleBitmap() -'+ added GDI32 function CreateCompatibleDC() -'+ added GDI32 function BitBlt() -'+ [Carsten Klein] added wrapper function FreeImage_CreateFromScreen(): this function lets you capture the whole screen or any certain window -' -'October 10, 2006 - 1.7.1 -'! [Carsten Klein] changed parameter name 'Page' into 'hPageDib' in declared function FreeImage_UnlockPage(). 'hPageDib' must be the (dib-)handle obtained from FreeImage_LockPage() and not the page number. Now, the declaration is less confusing. Thanks to Ender Wiggin. -' -'August 4, 2006 - 1.7 -'* [Carsten Klein] fixed a bug in pGetTagFromTagPtr(): removed overflow error when converting unsigned short tags (FIDT_SHORT) with values between 32768 and 65535. Thanks to Andr Hendriks. -'! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 1 to match current version 3.9.1 -' -'! now FreeImage version 3.9.1 -' -'July 17, 2006 - 1.6 -'+ [Carsten Klein] added more public wrapper functions for tag copying and cloning: -'+ added function FreeImage_CopyMetadata() -'+ added function FreeImage_CloneMetadata() -'- [Carsten Klein] removed dead API functions, dead structures and dead variables -'* [Carsten Klein] fixed a bug in FreeImage_ConvertColorDepth(): now color images are converted to 24 bits when used with FICF_PREPARE_RESCALE, all others to 8 bit -' -'July 16, 2006 - 1.5.6 -'+ [Carsten Klein] added more public wrapper functions for VB friendly tag access: these functions deal with a FREE_IMAGE_TAG structure instead of FreeImage's Tag pointer. -'+ added function FreeImage_SetMetadataEx() -'+ added function FreeImage_CreateTagEx() -'+ added function FreeImage_AppendTag() -'+ added function FreeImage_RemoveTag() -'+ added function FreeImage_RemoveTagEx() -'+ added function FreeImage_TagExists() -'+ added function FreeImage_TagExistsEx() -'+ added function FreeImage_DeleteTagEx() -'+ added function FreeImage_CloneTagEx() -'+ added function FreeImage_RemoveMetadataModel() -'+ added function FreeImage_UpdateMetadata() -'+ added function FreeImage_UnsignedLong() -'+ added function FreeImage_UnsignedShort() -'+ added function FreeImage_CreateRational() -'+ added function FreeImage_CreateSignedRational() -'+ added function FreeImage_GetImageComment() -'+ added function FreeImage_SetImageComment() -'+ [Carsten Klein] added some private helper functions to leverage tag updating: -'+ added helper function pTagToTagPtr() -'+ added helper function pGetValueBuffer() -'+ added helper function pGetRationalValueBuffer() -'+ added helper function pGetVariantAsByteBuffer() -'+ added helper function pGetElementSize() -' -'July 5, 2006 - 1.5.5 -'! [Carsten Klein] changed function signature of FreeImage_FindNextMetadataEx(): optional parameter 'Model' is now present; see the function's inline documentation -' -'June 30, 2006 - 1.5.4 -'* [Carsten Klein] fixed bug in functions creating a FreeImage DIB from a windows hBitmap: workaround for palletized bitmaps is now implemented -'* fixed function FreeImage_CreateFromOLEPicture() -'* fixed function FreeImage_CreateFromDC() -' -'June 22, 2006 - 1.5.3 -'! [Carsten Klein] changed function declaration of FreeImage_GetMetadataInt(): parameter 'model' is now 'ByVal' and Tag is a Long pointer -'! [Carsten Klein] changed function declaration of FreeImage_SetMetadataInt(): parameter 'model' is now 'ByVal' and Tag is a Long pointer -'! [Carsten Klein] changed function declaration of FreeImage_GetMetadata(): parameter Tag is a Long pointer now -'! [Carsten Klein] changed function declaration of FreeImage_SetMetadata(): parameter Tag is a Long pointer now -'+ [Carsten Klein] added function declarations for tag creation and destruction: -'+ added declaration for function FreeImage_CreateTag() -'+ added declaration for procedure FreeImage_DeleteTag() -'+ added declaration for function FreeImage_CloneTag() -'+ [Carsten Klein] added new items to structure FREE_IMAGE_TAG: -'+ added item 'Model As FREE_IMAGE_MDMODEL' -'+ added item 'TagPtr As Long' -'+ [Carsten Klein] added wrapper functions for more VB friendly Tag access: these functions deal with a FREE_IMAGE_TAG structure instead of FreeImage's Tag pointer. -'+ added function FreeImage_FindFirstMetadataEx() -'+ added function FreeImage_FindNextMetadataEx() -'+ added function FreeImage_GetAllMetadataTags() -'+ added function FreeImage_GetMetadataEx() -'* [Carsten Klein] fixed and adjusted page numbers of the API documentation in header comments in FreeImage function declarations -'- [Carsten Klein] removed workaround for thresholding and dithering non-MINISBLACK 8 bit images in function FreeImage_ConvertColorDepth(): was fixed in FreeImage 3.9.0 -'* [Carsten Klein] fixed all pending issues in function FreeImage_PaintDC(): is now in production state -' -'June 14, 2006 - 1.5.2 -'! [Carsten Klein] changed signature of function FreeImage_CreateMask() -'+ [Carsten Klein] added function FreeImage_CreateMaskImage(): this creates a monochrome mask from a source image -'+ [Carsten Klein] added function FreeImage_CreateMaskInPlace(): this creates a monochrome mask from a source image -'+ [Carsten Klein] added enumeration FREE_IMAGE_ICON_TRANSPARENCY_OPTION_FLAGS -'+ [Carsten Klein] added wrapper function FreeImage_CreateSimpleBWMaskImage(): wrapper for FreeImage_CreateMaskImage() with reduced number of parameters; creates a b/w mask -'+ [Carsten Klein] added wrapper function FreeImage_CreateSimpleBWMaskInPlace(): wrapper for FreeImage_CreateMaskInPlace() with reduced number of parameters; creates a b/w mask -'+ [Carsten Klein] added function declaration for FreeImage_MakeThumbnail() -'+ [Carsten Klein] added function for FreeImage_GetOlePictureThumbnail() -'+ [Carsten Klein] added function for FreeImage_MakeThumbnailIOP() -'+ [Carsten Klein] documented function FreeImage_ReadMemoryEx() -'+ [Carsten Klein] documented function FreeImage_WriteMemoryEx() -'! [Carsten Klein] divided FreeImage_TagFromPointer into an interface only function with a private helper function pGetTagFromTagPtr(): -'+ added helper function pGetTagFromTagPtr() -'! [Carsten Klein] added private helper functions to leverage the FIDT_RATIONAL and FIDT_SRATIONAL data type: -'+ added helper function pNormalizeRational() -'+ added helper function pNormalizeSRational() -'+ added helper function gcd() -'+ added helper function floor() -'! [Carsten Klein] changed name of structure 'FITAG_int' to 'FITAG': is now as in FreeImage library -'! [Carsten Klein] changed name of structure 'FITAG' to 'FREE_IMAGE_TAG': this new structure plays an important role in the wrapper's new VB friendly tag accessing concept -'! [Carsten Klein] changed function declaration of FreeImage_GetMetadataCount(): parameter 'model' is now 'ByVal' -'! [Carsten Klein] changed function declaration of FreeImage_TagToString(): parameter 'model' is now 'ByVal' and function returns a Long -'! [Carsten Klein] renamed function declaration of FreeImage_TagToString() to FreeImage_TagToStringInt(): function is now Private and wrapped by a VB String returning function -'+ [Carsten Klein] added wrapper function FreeImage_TagToString() returning a real VB String -'+ [Carsten Klein] added structure FIRATIONAL: structure to hold an image tag's rational value -'+ [Carsten Klein] added new items to structure FREE_IMAGE_TAG: -'+ added item 'StringValue As String' -'+ added item 'Palette() As RGBQUAD' -'+ added item 'RationalValue() As FIRATIONAL' -' -'June 13, 2006 - 1.5.1 -'! [Carsten Klein] changed version constant 'FREEIMAGE_MINOR_VERSION' to 9 to meet version 3.9.0 -'* [Carsten Klein] fixed and adjusted page numbers of the API documentation in header comments in FreeImage function declarations to match FreeImage 3.9.0 API documentation -'+ [Carsten Klein] added function declaration for new Memory I/O functions in 3.9.0 -'+ added declaration FreeImage_ReadMemory() -'+ added declaration FreeImage_WriteMemory() -'! [Carsten Klein] changed/added optional parameter 'element_size' to private function pGetMemoryBlockPtrFromVariant(): caller now can get size in bytes one array element -'+ [Carsten Klein] added wrapper functions for new Memory I/O functions in 3.9.0 -'+ added function FreeImage_ReadMemoryEx() -'+ added function FreeImage_WriteMemoryEx() -'+ [Carsten Klein] added constants and updated enumerations for new 3.9.0 file formats 'FAXG3' and 'SGI' -'+ [Carsten Klein] added Windows GDI icon related declarations: -'+ added function declaration for CreateIconIndirect() -'+ added function declaration for DestroyIcon() -'+ added structure ICONINFO -'+ [Carsten Klein] added function FreeImage_GetIcon(): returns a hIcon handle -'+ [Carsten Klein] added function FreeImage_GetOlePictureIcon(): returns a VB Picture object of type vbPicTypeIcon -'+ [Carsten Klein] added enumeration FREE_IMAGE_MASK_FLAGS -'+ [Carsten Klein] added function FreeImage_CreateMaskColors(): returns an array filled with items from an argument list; synonym for VB's Array() function -'+ [Carsten Klein] added enumeration FREE_IMAGE_teMask(): this creates a monochrome mask from a source image -'+ [Carsten Klein] added function FreeImage_CreaMASK_CREATION_OPTION_FLAGS -' -'! now FreeImage version 3.9.0 -' -'June 12, 2006 - 1.5 -'* [Carsten Klein] fixed bug in wrapper function FreeImage_PaintDCEx(): now handles boolean test correctly: 'If ((hDC <> 0) And (hDIB <> 0)) Then -> Thanks to ender_wiggin for reporting that bug. -'+ [Carsten Klein] added private function pGetIOlePictureFromContainer(): used to get IPicture from image hosting control (Form, PictureBox) including custom drawings -'+ [Carsten Klein] added wrapper function FreeImage_CreateFromImageContainer(): used to create FreeImage DIB from image hosting control (Form, PictureBox) including custom drawings -'+ [Carsten Klein] added wrapper function SaveImageContainerEx(): derivate of wrapper function 'SavePictureEx()': saves content of image hosting control (Form, PictureBox) including custom drawings -' -'February 27, 2006 - 1.4.8 -'+ [Carsten Klein] added inline documentation for these wrapper functions: -'+ documented function FreeImage_CompareColorsLongLong() -'+ documented function FreeImage_CompareColorsRGBTRIPLELong() -'+ documented function FreeImage_CompareColorsRGBQUADLong() -'+ documented function FreeImage_SearchPalette() -'! [Carsten Klein] changed and updated general remarks in section "General notes on implementation and design" -'! [Carsten Klein] changed all function declarations of FreeImage functions that return a BOOL in C/C++: see "Functions returning Booleans" in section "General notes on implementation and design" -'! [Carsten Klein] changed all function signatures of functions that are derived from or extend FreeImage BOOL functions: see "Functions returning Booleans" in section "General notes on implementation and design" -'+ [Carsten Klein] added wrapper functions for all FreeImage functions that return a BOOL in C/C++: see "Functions returning Booleans" in section "General notes on implementation and design" -'+ [Carsten Klein] added wrapper function FreeImage_CreateFromDC(): creates an DIB from a DC. Thanks to Evan (wxforecaster) for this suggestion. -'+ [Carsten Klein] added declaration of GDI function GetCurrentObject() and constant OBJ_BITMAP -'+ [Carsten Klein] added wrapper function FreeImage_IsAvailable(): used to test for existence of FreeImage Library (FreeImage.dll) -' -'February 9, 2006 - 1.4.7 -'+ [Carsten Klein] added private helper function pGetPreviousColorDepth() -'+ [Carsten Klein] added private helper function pGetNextColorDepth() -'! [Carsten Klein] changed/extended signature of wrapper function SavePictureEx(): now includes a parameter 'ColorDepth' -'+ [Carsten Klein] added enumeration FREE_IMAGE_COLOR_DEPTH -'+ [Carsten Klein] added error handling capabilities to wrapper function SavePictureEx() -'+ [Carsten Klein] added/updated inline documentation of wrapper function SavePictureEx() -' -'October 31, 2005 - 1.4.6 -'+ [Carsten Klein] added wrapper function FreeImage_SwapColorLong(): this converts from a RGB to a BGR color value stored in a Long and vice versa -' -'October 27, 2005 - 1.4.5 -'+ [Carsten Klein] added function FreeImage_IsTransparencyTableTransparent(): checks for transparency directly on the transparency table -' -'October 13, 2005 - 1.4.4 -'+ [Carsten Klein] added some functions to compare colors in different formats and with tolerance: -'+ added function FreeImage_CompareColorsLongLong() -'+ added function FreeImage_CompareColorsRGBTRIPLELong() -'+ added function FreeImage_CompareColorsRGBQUADLong() -'+ [Carsten Klein] added enumeration FREE_IMAGE_COLOR_FORMAT_FLAGS -'+ [Carsten Klein] added enumeration FREE_IMAGE_TRANSPARENCY_STATE_FLAGS -'+ [Carsten Klein] added function FreeImage_SearchPalette(): to search the palette index for a given color -' -'October 13, 2005 - 1.4.3 -'+ [Carsten Klein] added additional function declaration FreeImage_SetPixelColorByLong(): now color values may be provided in a long value -'+ [Carsten Klein] added additional function declaration FreeImage_GetPixelColorByLong(): now color values may be received in a long value -'+ [Carsten Klein] added function FreeImage_SetPixelColorEx(): color values may be provided by four different byte values -'+ [Carsten Klein] added function FreeImage_GetPixelColorEx(): color values are returned through four different byte values -' -'October 11, 2005 - 1.4.2 -'* [Carsten Klein] fixed bug in wrapper function FreeImage_GetBitsExRGBQUAD(): now tests for and works with 32 bit images -' -'October 10, 2005 - 1.4.1 -'* [Carsten Klein] fixed serious bug in FreeImage_GetBitsEx...() functions: created custom array descriptor now really has two dimensions -'* fixed wrapper function FreeImage_GetBitsEx() -'* fixed wrapper function FreeImage_GetBitsExRGBTRIPLE() -'* fixed wrapper function FreeImage_GetBitsExRGBQUAD() -' -'September 9, 2005 - 1.4 -'! [Carsten Klein] changed wrapper function FreeImage_ConvertColorDepth(): now uses FreeImage_ConvertToGreyscale -'+ [Carsten Klein] added version numbers to change log -'+ [Carsten Klein] added comments to IOlePicture aware toolkit and conversion functions -'* [Carsten Klein] fixed and adjusted page numbers of the API documentation in header comments in FreeImage function declarations -' -'! now FreeImage version 3.8.0 -' -'September 8, 2005 - 1.3.5 -'! [Carsten Klein] changed version constant 'FREEIMAGE_MINOR_VERSION' to 8 to meet version 3.8.0 -'+ [Carsten Klein] added function declarations for UNICODE dealing functions with additional token 'Int' appended: -'+ added function FreeImage_LoadUInt() -'+ added function FreeImage_SaveUInt() -'+ added function FreeImage_GetFileTypeUInt() -'+ added function FreeImage_GetFIFFromFilenameUInt() -'+ [Carsten Klein] added wrapper functions to ease the use of UNICODE dealing functions: -'+ added function FreeImage_LoadU() -'+ added function FreeImage_SaveU() -'+ added function FreeImage_GetFileTypeU() -'+ added function FreeImage_GetFIFFromFilenameU() -'+ [Carsten Klein] added function declaration for FreeImage_ConvertToGreyscale() -' -'July 18, 2005 - 1.3.4 -'! [Carsten Klein] changed inline comments in these wrapper functions: -'! changed FreeImage_GetBitsEx(): mixed up width and height in SAFEAARAY creation -'! changed FreeImage_GetBitsExRGBTRIPLE(): mixed up width and height in SAFEAARAY creation -'! changed FreeImage_GetBitsExRGBQUAD(): mixed up width and height in SAFEAARAY creation -'+ [Carsten Klein] added wrapper function FreeImage_GetScanLinesRGBTRIPLE(): -' -'June 30, 2005 - 1.3.3 -'+ [Carsten Klein] added Kernel32 function FillMemory() -' -'June 24, 2005 - 1.3.2 -'+ [Carsten Klein] added pixel access functions FreeImage_GetBitsExRGBTRIPLE() and FreeImage_GetBitsExRGBQUAD() -'+ [Carsten Klein] added IOlePicture based wrapper function FreeImage_ConvertColorDepthIOP() -'+ [Carsten Klein] added IOlePicture based wrapper functions for FreeImage_RescaleIOP(): -'+ added function FreeImage_FreeImage_RescaleByPixelIOP() -'+ added function FreeImage_FreeImage_RescaleByPercentIOP() -'+ added function FreeImage_FreeImage_RescaleByFactorIOP() -'+ [Carsten Klein] added IOlePicture based wrapper function FreeImage_RescaleIOP() -'* [Carsten Klein] fixed a bug in FreeImage_GetOlePicture(): now OlePictures returned through IPicture may be used directly by other functions accepting IPicture types without any assignment to IPictureDisp -' -'June 24, 2005 - 1.3.1 -'! [Carsten Klein] changed improper function declaration of function FreeImage_AdjustCurve(): now parameter 'LUT' is passed ByVal -'+ [Carsten Klein] added wrapper function FreeImage_AdjustCurveEx() -'+ [Carsten Klein] added IOlePicture based wrapper functions for FreeImage toolkit functions: -'+ added function FreeImage_RotateClassicIOP() -'+ added function FreeImage_RotateExIOP() -'+ added function FreeImage_FlipHorizontalIOP() -'+ added function FreeImage_FlipVerticalIOP() -'+ added function FreeImage_AdjustCurveIOP() -'+ added function FreeImage_AdjustGammaIOP() -'+ added function FreeImage_AdjustBrightnessIOP() -'+ added function FreeImage_AdjustContrastIOP() -'+ added function FreeImage_InvertIOP() -'+ added function FreeImage_GetChannelIOP() -'+ added function FreeImage_CopyIOP() -'+ added function FreeImage_PasteIOP() -' -'June 22, 2005 - 1.3 -'+ [Carsten Klein] added inline comments and documentation for pixel access functions -' -'June 18, 2005 - 1.2.9 -'+ [Carsten Klein] added function FreeImage_GetBitsEx() -'+ [Carsten Klein] added structure SAFEARRAY2D to create 2 dimensional custom arrays -'+ [Carsten Klein] added function declarations for converting scanlines to 4 bpp: -'+ added declaration for FreeImage_ConvertLine1To4() -'+ added declaration for FreeImage_ConvertLine8To4() -'+ added declaration for FreeImage_ConvertLine16To4_555() -'+ added declaration for FreeImage_ConvertLine16To4_565() -'+ added declaration for FreeImage_ConvertLine24To4() -'+ added declaration for FreeImage_ConvertLine32To4() -' -'June 16, 2005 - 1.2.8 -'! [Carsten Klein] changed improper function declaration for all functions FreeImage_ConvertLineXXXX(): now parameters 'target' and 'Source' are passed ByVal -' -'June 15, 2005 - 1.2.7 -'+ [Carsten Klein] added function FreeImage_DestroyLockedArrayByPtr() to destroy a locked array by it's pointer (VB can't pass a array of structures through a Variant type) -'+ [Carsten Klein] added some wrapper functions for FreeImage_DestroyLockedArrayByPtr() for common FreeImage structures: -'+ added function FreeImage_DestroyLockedArrayRGBTRIPLE() -'+ added function FreeImage_DestroyLockedArrayRGBQUAD() -'+ added function FreeImage_DestroyLockedArrayFICOMPLEX() -'+ added function FreeImage_DestroyLockedArrayFIRGB16() -'+ added function FreeImage_DestroyLockedArrayFIRGBA16() -'+ added function FreeImage_DestroyLockedArrayFIRGBF() -'+ added function FreeImage_DestroyLockedArrayFIRGBAF() -'+ [Carsten Klein] added functions to return scanlines as VB style arrays in all supported FreeImage formats: -'+ added function FreeImage_GetScanLineBITMAP8() -'+ added function FreeImage_GetScanLineBITMAP16() -'+ added function FreeImage_GetScanLineBITMAP24() -'+ added function FreeImage_GetScanLineBITMAP32() -'+ added function FreeImage_GetScanLineINT16() -'+ added function FreeImage_GetScanLineINT32() -'+ added function FreeImage_GetScanLineFLOAT() -'+ added function FreeImage_GetScanLineDOUBLE() -'+ added function FreeImage_GetScanLineCOMPLEX() -'+ added function FreeImage_GetScanLineRGB16() -'+ added function FreeImage_GetScanLineRGBA16() -'+ added function FreeImage_GetScanLineRGBF() -'+ added function FreeImage_GetScanLineRGBAF() -' -'June 14, 2005 - 1.2.6 -'! [Carsten Klein] updated documentation on array-dealing functions using arrays with custom array descriptors -'+ [Carsten Klein] added function FreeImage_DestroyLockedArray() to destroy a self created array 'FADF_AUTO Or FADF_FIXEDSIZE' array -'+ [Carsten Klein] added function FreeImage_GetPaletteExLong() to return palette data in an array of type Long -'+ [Carsten Klein] added parameters 'lPaletteSize', 'vntReservePalette' and 'lReserveSize' to FreeImage_ConvertColorDepth() -' -'June 13, 2005 - 1.2.5 -'* [Carsten Klein] fixed a bug in helper function pGetMemoryBlockPtrFromVariant(): now 'size_in_bytes' will never exceed the size of an array provided -' -'June 12, 2005 - 1.2.4 -'+ [Carsten Klein] added ZLib compression function wrappers dealing with VB style arrays: -'+ added function FreeImage_ZLibCompressVB() -'+ added function FreeImage_ZLibUncompressVB() -'+ added function FreeImage_ZLibGZipVB() -'+ added function FreeImage_ZLibGUnzipVB() -' -'June 10, 2005 - 1.2.3 -'+ [Carsten Klein] added ZLib compression function wrappers dealing with VB style arrays: -'+ added function FreeImage_ZLibCompressEx() -'+ added function FreeImage_ZLibUncompressEx() -'+ added function FreeImage_ZLibGZipEx() -'+ added function FreeImage_ZLibCRC32Ex() -'+ added function FreeImage_ZLibGUnzipEx() -'+ [Carsten Klein] added more VB friendly ZLib compression function wrappers: -'+ added function FreeImage_ZLibCompressVB() -'+ added function FreeImage_ZLibUncompressVB() -'+ added function FreeImage_ZLibGZipVB() -'+ added function FreeImage_ZLibGUnzipVB() -'! [Carsten Klein] fixed wrong function declaration of functions FreeImage_ZLibGUnzip(): alias was '_FreeImage_ZLibZlibGUnzip@16' (double ZLib) -'! [Carsten Klein] fixed function pGetArrayPtrFromVariantArray() that now can deal with uninitialized arrays -'! fixed function pGetMemoryBlockPtrFromVariant() that now can deal with uninitialized arrays -'! [Carsten Klein] fixed wrong function declaration of functions FreeImage_AdjustBrightness(): ...@8 -> ...@12 -'! fixed wrong function declaration of functions FreeImage_AdjustContrast(): ...@8 -> ...@12 -'! fixed wrong function declaration of functions FreeImage_AdjustGamma(): ...@8 -> ...@12 -'! fixed wrong function declaration of functions FreeImage_RotateClassic(): ...@8 -> ...@12 -'! fixed wrong function declaration of functions FreeImage_RotateEx(): ...@28 -> ...@48 -' -'June 9, 2005 - 1.2.2 -'! [Carsten Klein] fixed wrong function declaration of function FreeImage_OpenMultiBitmap(): added parameter 'flags' (...@20 -> ...@24) -' -'June 8, 2005 - 1.2.1 -'! [Carsten Klein] refactored function FreeImage_LoadFromMemoryEx(): now using pGetMemoryBlockPtrFromVariant() -'+ [Carsten Klein] added private function pGetMemoryBlockPtrFromVariant() to get poiner and size of a memory block from a Variant parameter -'! [Carsten Klein] changed declaration of ZLib related functions: 'target' and 'Source' are now 'ByVal Long' -' -'June 7, 2005 - 1.2 -'+ [Carsten Klein] added some more inline comments and documentation -'+ [Carsten Klein] added optional parameter 'UnloadSource' to function FreeImage_SaveToMemoryEx() -'+ added optional parameter 'UnloadSource' to function FreeImage_SaveToMemoryEx2() -'+ [Carsten Klein] added optional parameter 'InPercent' to function SavePictureEx() -'! implemented the capability to resize the image on saving in function SavePictureEx() -'+ [Carsten Klein] added parameters 'InPercent' and 'Format' to function LoadPictureEx() -'* [Carsten Klein] fixed wrong function declaration of function FreeImage_JPEGTransform() (...@12 -> ...@16) -' -'June 6, 2005 - 1.1.2 -'+ [Carsten Klein] added some more inline comments and documentation -' -'May 30, 2005 - 1.1.1 -'* [Carsten Klein] fixed percent calculating bug in function FreeImage_RescaleEx() -'! changed behaviour of parameter 'bIsPercentValue' -> it now has no effect on integer values -'+ added function FreeImage_RescaleByPixel() to avoid confusion with overloading -'+ added function FreeImage_RescaleByPercent() to avoid confusion with overloading -'+ added function FreeImage_RescaleByFactor() to avoid confusion with overloading -'! [Carsten Klein] changed name of parameter 'bUnloadDIB' to 'UnloadSource' of function FreeImage_GetOlePicture() -'+ [Carsten Klein] added some more inline comments and documentation -'* [Carsten Klein] fixed a potential runtime error in function FreeImage_SetTransparencyTableEx(): 'Count' will no longer exceed 256 -' -'May 24, 2005 - 1.1 -'+ [Carsten Klein] added a new VB wrapper - - -'-------------------------------------------------------------------------------- -' Win32 API function, struct and constant declarations -'-------------------------------------------------------------------------------- - -Private Const ERROR_SUCCESS As Long = 0 - -'KERNEL32 -Private Declare Sub CopyMemory Lib "kernel32.dll" Alias "RtlMoveMemory" ( _ - ByRef Destination As Any, _ - ByRef Source As Any, _ - ByVal Length As Long) - -Private Declare Sub FillMemory Lib "kernel32.dll" Alias "RtlFillMemory" ( _ - ByRef Destination As Any, _ - ByVal Length As Long, _ - ByVal Fill As Byte) - -Private Declare Function lstrlen Lib "kernel32.dll" Alias "lstrlenA" ( _ - ByVal lpString As Long) As Long - - -'OLEAUT32 -Private Declare Function OleCreatePictureIndirect Lib "oleaut32.dll" ( _ - ByRef lpPictDesc As PictDesc, _ - ByRef riid As Guid, _ - ByVal fOwn As Long, _ - ByRef lplpvObj As IPicture) As Long - -Private Declare Function SafeArrayAllocDescriptor Lib "oleaut32.dll" ( _ - ByVal cDims As Long, _ - ByRef ppsaOut As Long) As Long - -Private Declare Function SafeArrayDestroyDescriptor Lib "oleaut32.dll" ( _ - ByVal psa As Long) As Long - -Private Declare Sub SafeArrayDestroyData Lib "oleaut32.dll" ( _ - ByVal psa As Long) - -Private Declare Function OleTranslateColor Lib "oleaut32.dll" ( _ - ByVal clr As OLE_COLOR, _ - ByVal hPal As Long, _ - ByRef lpcolorref As Long) As Long - -Private Const CLR_INVALID As Long = &HFFFF& - - -'SAFEARRAY -Private Const FADF_AUTO As Long = (&H1) -Private Const FADF_FIXEDSIZE As Long = (&H10) - -Private Type SAVEARRAY1D - cDims As Integer - fFeatures As Integer - cbElements As Long - cLocks As Long - pvData As Long - cElements As Long - lLbound As Long -End Type - -Private Type SAVEARRAY2D - cDims As Integer - fFeatures As Integer - cbElements As Long - cLocks As Long - pvData As Long - cElements1 As Long - lLbound1 As Long - cElements2 As Long - lLbound2 As Long -End Type - - -'MSVBVM60 -Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" ( _ - ByRef Ptr() As Any) As Long - - -'USER32 -Private Declare Function ReleaseDC Lib "user32.dll" ( _ - ByVal hWnd As Long, _ - ByVal hDC As Long) As Long - -Private Declare Function GetDC Lib "user32.dll" ( _ - ByVal hWnd As Long) As Long - -Private Declare Function GetDesktopWindow Lib "user32.dll" () As Long - -Private Declare Function GetDCEx Lib "user32.dll" ( _ - ByVal hWnd As Long, _ - ByVal hrgnclip As Long, _ - ByVal fdwOptions As Long) As Long - -Private Const DCX_WINDOW As Long = &H1& - -Private Declare Function GetWindowRect Lib "user32.dll" ( _ - ByVal hWnd As Long, _ - ByRef lpRect As RECT) As Long - -Private Declare Function GetClientRect Lib "user32.dll" ( _ - ByVal hWnd As Long, _ - ByRef lpRect As RECT) As Long - - -Private Type RECT - Left As Long - Top As Long - Right As Long - Bottom As Long -End Type - -Private Type Guid - Data1 As Long - Data2 As Integer - Data3 As Integer - Data4(0 To 7) As Byte -End Type - -Private Type PictDesc - cbSizeofStruct As Long - picType As Long - hImage As Long - xExt As Long - yExt As Long -End Type - -Private Type BITMAP_API - bmType As Long - bmWidth As Long - bmHeight As Long - bmWidthBytes As Long - bmPlanes As Integer - bmBitsPixel As Integer - bmBits As Long -End Type - -Private Type ICONINFO - fIcon As Long - xHotspot As Long - yHotspot As Long - hBmMask As Long - hbmColor As Long -End Type - -Private Type BLENDFUNCTION - BlendOp As Byte - BlendFlags As Byte - SourceConstantAlpha As Byte - AlphaFormat As Byte -End Type - -'GDI32 -Private Declare Function GetDeviceCaps Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal nIndex As Long) As Long - -Private Const HORZRES As Long = 8 -Private Const VERTRES As Long = 10 - -Private Declare Function GetStretchBltMode Lib "gdi32.dll" ( _ - ByVal hDC As Long) As Long - -Private Declare Function SetStretchBltMode Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal nStretchMode As Long) As Long - -Private Declare Function SetDIBitsToDevice Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByVal dx As Long, _ - ByVal dy As Long, _ - ByVal SrcX As Long, _ - ByVal SrcY As Long, _ - ByVal Scan As Long, _ - ByVal NumScans As Long, _ - ByVal Bits As Long, _ - ByVal BitsInfo As Long, _ - ByVal wUsage As Long) As Long - -Private Declare Function StretchDIBits Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByVal dx As Long, _ - ByVal dy As Long, _ - ByVal SrcX As Long, _ - ByVal SrcY As Long, _ - ByVal wSrcWidth As Long, _ - ByVal wSrcHeight As Long, _ - ByVal lpBits As Long, _ - ByVal lpBitsInfo As Long, _ - ByVal wUsage As Long, _ - ByVal dwRop As Long) As Long - -Private Declare Function CreateDIBitmap Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal lpInfoHeader As Long, _ - ByVal dwUsage As Long, _ - ByVal lpInitBits As Long, _ - ByVal lpInitInfo As Long, _ - ByVal wUsage As Long) As Long - -Private Declare Function CreateDIBSection Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal pbmi As Long, _ - ByVal iUsage As Long, _ - ByRef ppvBits As Long, _ - ByVal hSection As Long, _ - ByVal dwOffset As Long) As Long - -Private Const CBM_INIT As Long = &H4 - -Private Declare Function CreateCompatibleBitmap Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal nWidth As Long, _ - ByVal nHeight As Long) As Long - -Private Declare Function CreateCompatibleDC Lib "gdi32.dll" ( _ - ByVal hDC As Long) As Long - -Private Declare Function DeleteDC Lib "gdi32.dll" ( _ - ByVal hDC As Long) As Long - -Private Declare Function BitBlt Lib "gdi32.dll" ( _ - ByVal hDestDC As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByVal nWidth As Long, _ - ByVal nHeight As Long, _ - ByVal hSrcDC As Long, _ - ByVal XSrc As Long, _ - ByVal YSrc As Long, _ - ByVal dwRop As Long) As Long - -Private Declare Function GetDIBits Lib "gdi32.dll" ( _ - ByVal aHDC As Long, _ - ByVal hBitmap As Long, _ - ByVal nStartScan As Long, _ - ByVal nNumScans As Long, _ - ByVal lpBits As Long, _ - ByVal lpBI As Long, _ - ByVal wUsage As Long) As Long - -Private Declare Function GetObjectAPI Lib "gdi32.dll" Alias "GetObjectA" ( _ - ByVal hObject As Long, _ - ByVal nCount As Long, _ - ByRef lpObject As Any) As Long - -Private Declare Function SelectObject Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal hObject As Long) As Long - -Private Declare Function DeleteObject Lib "gdi32.dll" ( _ - ByVal hObject As Long) As Long - -Private Declare Function GetCurrentObject Lib "gdi32.dll" ( _ - ByVal hDC As Long, _ - ByVal uObjectType As Long) As Long - -Private Const OBJ_BITMAP As Long = 7 - - -Private Declare Function DestroyIcon Lib "user32.dll" ( _ - ByVal hIcon As Long) As Long - -Private Declare Function CreateIconIndirect Lib "user32.dll" ( _ - ByRef piconinfo As ICONINFO) As Long - -Private Const BLACKONWHITE As Long = 1 -Private Const WHITEONBLACK As Long = 2 -Private Const COLORONCOLOR As Long = 3 - -'MSIMG32 -Private Declare Function AlphaBlend Lib "msimg32.dll" ( _ - ByVal hdcDest As Long, _ - ByVal nXOriginDest As Long, _ - ByVal nYOriginDest As Long, _ - ByVal nWidthDest As Long, _ - ByVal nHeightDest As Long, _ - ByVal hdcSrc As Long, _ - ByVal nXOriginSrc As Long, _ - ByVal nYOriginSrc As Long, _ - ByVal nWidthSrc As Long, _ - ByVal nHeightSrc As Long, _ - ByVal lBlendFunction As Long) As Long - -Private Const AC_SRC_OVER = &H0 -Private Const AC_SRC_ALPHA = &H1 - - -Public Enum STRETCH_MODE - SM_BLACKONWHITE = BLACKONWHITE - SM_WHITEONBLACK = WHITEONBLACK - SM_COLORONCOLOR = COLORONCOLOR -End Enum -#If False Then - Const SM_BLACKONWHITE = BLACKONWHITE - Const SM_WHITEONBLACK = WHITEONBLACK - Const SM_COLORONCOLOR = COLORONCOLOR -#End If - - -Private Const SRCAND As Long = &H8800C6 -Private Const SRCCOPY As Long = &HCC0020 -Private Const SRCERASE As Long = &H440328 -Private Const SRCINVERT As Long = &H660046 -Private Const SRCPAINT As Long = &HEE0086 -Private Const CAPTUREBLT As Long = &H40000000 - -Public Enum RASTER_OPERATOR - ROP_SRCAND = SRCAND - ROP_SRCCOPY = SRCCOPY - ROP_SRCERASE = SRCERASE - ROP_SRCINVERT = SRCINVERT - ROP_SRCPAINT = SRCPAINT -End Enum -#If False Then - Const ROP_SRCAND = SRCAND - Const ROP_SRCCOPY = SRCCOPY - Const ROP_SRCERASE = SRCERASE - Const ROP_SRCINVERT = SRCINVERT - Const ROP_SRCPAINT = SRCPAINT -#End If - -Private Const DIB_PAL_COLORS As Long = 1 -Private Const DIB_RGB_COLORS As Long = 0 - -Public Enum DRAW_MODE - DM_DRAW_DEFAULT = &H0 - DM_MIRROR_NONE = DM_DRAW_DEFAULT - DM_MIRROR_VERTICAL = &H1 - DM_MIRROR_HORIZONTAL = &H2 - DM_MIRROR_BOTH = DM_MIRROR_VERTICAL Or DM_MIRROR_HORIZONTAL -End Enum -#If False Then - Const DM_DRAW_DEFAULT = &H0 - Const DM_MIRROR_NONE = DM_DRAW_DEFAULT - Const DM_MIRROR_VERTICAL = &H1 - Const DM_MIRROR_HORIZONTAL = &H2 - Const DM_MIRROR_BOTH = DM_MIRROR_VERTICAL Or DM_MIRROR_HORIZONTAL -#End If - -Public Enum HISTOGRAM_ORIENTATION - HOR_TOP_DOWN = &H0 - HOR_BOTTOM_UP = &H1 -End Enum -#If False Then - Const HOR_TOP_DOWN = &H0 - Const HOR_BOTTOM_UP = &H1 -#End If - - -'-------------------------------------------------------------------------------- -' FreeImage 3 types, constants and enumerations -'-------------------------------------------------------------------------------- - -'FREEIMAGE - -' Version information -Public Const FREEIMAGE_MAJOR_VERSION As Long = 3 -Public Const FREEIMAGE_MINOR_VERSION As Long = 13 -Public Const FREEIMAGE_RELEASE_SERIAL As Long = 1 - -' Memory stream pointer operation flags -Public Const SEEK_SET As Long = 0 -Public Const SEEK_CUR As Long = 1 -Public Const SEEK_END As Long = 2 - -' Indexes for byte arrays, masks and shifts for treating pixels as words -' These coincide with the order of RGBQUAD and RGBTRIPLE -' Little Endian (x86 / MS Windows, Linux) : BGR(A) order -Public Const FI_RGBA_RED As Long = 2 -Public Const FI_RGBA_GREEN As Long = 1 -Public Const FI_RGBA_BLUE As Long = 0 -Public Const FI_RGBA_ALPHA As Long = 3 -Public Const FI_RGBA_RED_MASK As Long = &HFF0000 -Public Const FI_RGBA_GREEN_MASK As Long = &HFF00 -Public Const FI_RGBA_BLUE_MASK As Long = &HFF -Public Const FI_RGBA_ALPHA_MASK As Long = &HFF000000 -Public Const FI_RGBA_RED_SHIFT As Long = 16 -Public Const FI_RGBA_GREEN_SHIFT As Long = 8 -Public Const FI_RGBA_BLUE_SHIFT As Long = 0 -Public Const FI_RGBA_ALPHA_SHIFT As Long = 24 - -' The 16 bit macros only include masks and shifts, since each color element is not byte aligned -Public Const FI16_555_RED_MASK As Long = &H7C00 -Public Const FI16_555_GREEN_MASK As Long = &H3E0 -Public Const FI16_555_BLUE_MASK As Long = &H1F -Public Const FI16_555_RED_SHIFT As Long = 10 -Public Const FI16_555_GREEN_SHIFT As Long = 5 -Public Const FI16_555_BLUE_SHIFT As Long = 0 -Public Const FI16_565_RED_MASK As Long = &HF800 -Public Const FI16_565_GREEN_MASK As Long = &H7E0 -Public Const FI16_565_BLUE_MASK As Long = &H1F -Public Const FI16_565_RED_SHIFT As Long = 11 -Public Const FI16_565_GREEN_SHIFT As Long = 5 -Public Const FI16_565_BLUE_SHIFT As Long = 0 - -' ICC profile support -Public Const FIICC_DEFAULT As Long = &H0 -Public Const FIICC_COLOR_IS_CMYK As Long = &H1 - -Private Const FREE_IMAGE_ICC_COLOR_MODEL_MASK As Long = &H1 -Public Enum FREE_IMAGE_ICC_COLOR_MODEL - FIICC_COLOR_MODEL_RGB = &H0 - FIICC_COLOR_MODEL_CMYK = &H1 -End Enum - -' Load / Save flag constants -Public Const FIF_LOAD_NOPIXELS = &H8000 ' load the image header only (not supported by all plugins) - -Public Const BMP_DEFAULT As Long = 0 -Public Const BMP_SAVE_RLE As Long = 1 -Public Const CUT_DEFAULT As Long = 0 -Public Const DDS_DEFAULT As Long = 0 -Public Const EXR_DEFAULT As Long = 0 ' save data as half with piz-based wavelet compression -Public Const EXR_FLOAT As Long = &H1 ' save data as float instead of as half (not recommended) -Public Const EXR_NONE As Long = &H2 ' save with no compression -Public Const EXR_ZIP As Long = &H4 ' save with zlib compression, in blocks of 16 scan lines -Public Const EXR_PIZ As Long = &H8 ' save with piz-based wavelet compression -Public Const EXR_PXR24 As Long = &H10 ' save with lossy 24-bit float compression -Public Const EXR_B44 As Long = &H20 ' save with lossy 44% float compression - goes to 22% when combined with EXR_LC -Public Const EXR_LC As Long = &H40 ' save images with one luminance and two chroma channels, rather than as RGB (lossy compression) -Public Const FAXG3_DEFAULT As Long = 0 -Public Const GIF_DEFAULT As Long = 0 -Public Const GIF_LOAD256 As Long = 1 ' Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color -Public Const GIF_PLAYBACK As Long = 2 ''Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading -Public Const HDR_DEFAULT As Long = 0 -Public Const ICO_DEFAULT As Long = 0 -Public Const ICO_MAKEALPHA As Long = 1 ' convert to 32bpp and create an alpha channel from the AND-mask when loading -Public Const IFF_DEFAULT As Long = 0 -Public Const J2K_DEFAULT As Long = 0 ' save with a 16:1 rate -Public Const JP2_DEFAULT As Long = 0 ' save with a 16:1 rate -Public Const JPEG_DEFAULT As Long = 0 ' loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420) -Public Const JPEG_FAST As Long = &H1 ' load the file as fast as possible, sacrificing some quality -Public Const JPEG_ACCURATE As Long = &H2 ' load the file with the best quality, sacrificing some speed -Public Const JPEG_CMYK As Long = &H4 ' load separated CMYK "as is" (use 'OR' to combine with other flags) -Public Const JPEG_EXIFROTATE As Long = &H8 ' load and rotate according to Exif 'Orientation' tag if available -Public Const JPEG_QUALITYSUPERB As Long = &H80 ' save with superb quality (100:1) -Public Const JPEG_QUALITYGOOD As Long = &H100 ' save with good quality (75:1) -Public Const JPEG_QUALITYNORMAL As Long = &H200 ' save with normal quality (50:1) -Public Const JPEG_QUALITYAVERAGE As Long = &H400 ' save with average quality (25:1) -Public Const JPEG_QUALITYBAD As Long = &H800 ' save with bad quality (10:1) -Public Const JPEG_PROGRESSIVE As Long = &H2000 ' save as a progressive-JPEG (use 'OR' to combine with other save flags) -Public Const JPEG_SUBSAMPLING_411 As Long = &H1000 ' save with high 4x1 chroma subsampling (4:1:1) -Public Const JPEG_SUBSAMPLING_420 As Long = &H4000 ' save with medium 2x2 medium chroma subsampling (4:2:0) - default value -Public Const JPEG_SUBSAMPLING_422 As Long = &H8000 ' save with low 2x1 chroma subsampling (4:2:2) -Public Const JPEG_SUBSAMPLING_444 As Long = &H10000 ' save with no chroma subsampling (4:4:4) -Public Const JPEG_OPTIMIZE As Long = &H20000 ' on saving, compute optimal Huffman coding tables (can reduce a few percent of file size) -Public Const KOALA_DEFAULT As Long = 0 -Public Const LBM_DEFAULT As Long = 0 -Public Const MNG_DEFAULT As Long = 0 -Public Const PCD_DEFAULT As Long = 0 -Public Const PCD_BASE As Long = 1 ' load the bitmap sized 768 x 512 -Public Const PCD_BASEDIV4 As Long = 2 ' load the bitmap sized 384 x 256 -Public Const PCD_BASEDIV16 As Long = 3 ' load the bitmap sized 192 x 128 -Public Const PCX_DEFAULT As Long = 0 -Public Const PFM_DEFAULT As Long = 0 -Public Const PICT_DEFAULT As Long = 0 -Public Const PNG_DEFAULT As Long = 0 -Public Const PNG_IGNOREGAMMA As Long = 1 ' avoid gamma correction -Public Const PNG_Z_BEST_SPEED As Long = &H1 ' save using ZLib level 1 compression flag (default value is 6) -Public Const PNG_Z_DEFAULT_COMPRESSION As Long = &H6 ' save using ZLib level 6 compression flag (default recommended value) -Public Const PNG_Z_BEST_COMPRESSION As Long = &H9 ' save using ZLib level 9 compression flag (default value is 6) -Public Const PNG_Z_NO_COMPRESSION As Long = &H100 ' save without ZLib compression -Public Const PNG_INTERLACED As Long = &H200 ' save using Adam7 interlacing (use | to combine with other save flags) -Public Const PNM_DEFAULT As Long = 0 -Public Const PNM_SAVE_RAW As Long = 0 ' if set, the writer saves in RAW format (i.e. P4, P5 or P6) -Public Const PNM_SAVE_ASCII As Long = 1 ' if set, the writer saves in ASCII format (i.e. P1, P2 or P3) -Public Const PSD_DEFAULT As Long = 0 -Public Const PSD_CMYK As Long = 1 ' reads tags for separated CMYK (default is conversion to RGB) -Public Const PSD_LAB As Long = 2 ' reads tags for CIELab (default is conversion to RGB) -Public Const RAS_DEFAULT As Long = 0 -Public Const RAW_DEFAULT As Long = 0 ' load the file as linear RGB 48-bit -Public Const RAW_PREVIEW = 1 ' try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit -Public Const RAW_DISPLAY = 2 ' load the file as RGB 24-bit -Public Const SGI_DEFAULT As Long = 0 -Public Const TARGA_DEFAULT As Long = 0 -Public Const TARGA_LOAD_RGB888 As Long = 1 ' if set, the loader converts RGB555 and ARGB8888 -> RGB888 -Public Const TARGA_SAVE_RLE As Long = 2 ' if set, the writer saves with RLE compression -Public Const TIFF_DEFAULT As Long = 0 -Public Const TIFF_CMYK As Long = &H1 ' reads/stores tags for separated CMYK (use 'OR' to combine with compression flags) -Public Const TIFF_PACKBITS As Long = &H100 ' save using PACKBITS compression -Public Const TIFF_DEFLATE As Long = &H200 ' save using DEFLATE compression (a.k.a. ZLIB compression) -Public Const TIFF_ADOBE_DEFLATE As Long = &H400 ' save using ADOBE DEFLATE compression -Public Const TIFF_NONE As Long = &H800 ' save without any compression -Public Const TIFF_CCITTFAX3 As Long = &H1000 ' save using CCITT Group 3 fax encoding -Public Const TIFF_CCITTFAX4 As Long = &H2000 ' save using CCITT Group 4 fax encoding -Public Const TIFF_LZW As Long = &H4000 ' save using LZW compression -Public Const TIFF_JPEG As Long = &H8000 ' save using JPEG compression -Public Const TIFF_LOGLUV As Long = &H10000 ' save using LogLuv compression -Public Const WBMP_DEFAULT As Long = 0 -Public Const XBM_DEFAULT As Long = 0 -Public Const XPM_DEFAULT As Long = 0 - -Public Enum FREE_IMAGE_FORMAT - FIF_UNKNOWN = -1 - FIF_BMP = 0 - FIF_ICO = 1 - FIF_JPEG = 2 - FIF_JNG = 3 - FIF_KOALA = 4 - FIF_LBM = 5 - FIF_IFF = FIF_LBM - FIF_MNG = 6 - FIF_PBM = 7 - FIF_PBMRAW = 8 - FIF_PCD = 9 - FIF_PCX = 10 - FIF_PGM = 11 - FIF_PGMRAW = 12 - FIF_PNG = 13 - FIF_PPM = 14 - FIF_PPMRAW = 15 - FIF_RAS = 16 - FIF_TARGA = 17 - FIF_TIFF = 18 - FIF_WBMP = 19 - FIF_PSD = 20 - FIF_CUT = 21 - FIF_XBM = 22 - FIF_XPM = 23 - FIF_DDS = 24 - FIF_GIF = 25 - FIF_HDR = 26 - FIF_FAXG3 = 27 - FIF_SGI = 28 - FIF_EXR = 29 - FIF_J2K = 30 - FIF_JP2 = 31 - FIF_PFM = 32 - FIF_PICT = 33 - FIF_RAW = 34 -End Enum -#If False Then - Const FIF_UNKNOWN = -1 - Const FIF_BMP = 0 - Const FIF_ICO = 1 - Const FIF_JPEG = 2 - Const FIF_JNG = 3 - Const FIF_KOALA = 4 - Const FIF_LBM = 5 - Const FIF_IFF = FIF_LBM - Const FIF_MNG = 6 - Const FIF_PBM = 7 - Const FIF_PBMRAW = 8 - Const FIF_PCD = 9 - Const FIF_PCX = 10 - Const FIF_PGM = 11 - Const FIF_PGMRAW = 12 - Const FIF_PNG = 13 - Const FIF_PPM = 14 - Const FIF_PPMRAW = 15 - Const FIF_RAS = 16 - Const FIF_TARGA = 17 - Const FIF_TIFF = 18 - Const FIF_WBMP = 19 - Const FIF_PSD = 20 - Const FIF_CUT = 21 - Const FIF_XBM = 22 - Const FIF_XPM = 23 - Const FIF_DDS = 24 - Const FIF_GIF = 25 - Const FIF_HDR = 26 - Const FIF_FAXG3 = 27 - Const FIF_SGI = 28 - Const FIF_EXR = 29 - Const FIF_J2K = 30 - Const FIF_JP2 = 31 - Const FIF_PFM = 32 - Const FIF_PICT = 33 - Const FIF_RAW = 34 -#End If - -Public Enum FREE_IMAGE_LOAD_OPTIONS - FILO_LOAD_NOPIXELS = &H8000 ' load the image header only (not supported by all plugins) - FILO_LOAD_DEFAULT = 0 - FILO_GIF_DEFAULT = GIF_DEFAULT - FILO_GIF_LOAD256 = GIF_LOAD256 ' load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color - FILO_GIF_PLAYBACK = GIF_PLAYBACK ' 'play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading - FILO_ICO_DEFAULT = ICO_DEFAULT - FILO_ICO_MAKEALPHA = ICO_MAKEALPHA ' convert to 32bpp and create an alpha channel from the AND-mask when loading - FILO_JPEG_DEFAULT = JPEG_DEFAULT ' for loading this is a synonym for FILO_JPEG_FAST - FILO_JPEG_FAST = JPEG_FAST ' load the file as fast as possible, sacrificing some quality - FILO_JPEG_ACCURATE = JPEG_ACCURATE ' load the file with the best quality, sacrificing some speed - FILO_JPEG_CMYK = JPEG_CMYK ' load separated CMYK "as is" (use 'OR' to combine with other load flags) - FILO_JPEG_EXIFROTATE = JPEG_EXIFROTATE ' load and rotate according to Exif 'Orientation' tag if available - FILO_PCD_DEFAULT = PCD_DEFAULT - FILO_PCD_BASE = PCD_BASE ' load the bitmap sized 768 x 512 - FILO_PCD_BASEDIV4 = PCD_BASEDIV4 ' load the bitmap sized 384 x 256 - FILO_PCD_BASEDIV16 = PCD_BASEDIV16 ' load the bitmap sized 192 x 128 - FILO_PNG_DEFAULT = PNG_DEFAULT - FILO_PNG_IGNOREGAMMA = PNG_IGNOREGAMMA ' avoid gamma correction - FILO_PSD_CMYK = PSD_CMYK ' reads tags for separated CMYK (default is conversion to RGB) - FILO_PSD_LAB = PSD_LAB ' reads tags for CIELab (default is conversion to RGB) - FILO_RAW_DEFAULT = RAW_DEFAULT ' load the file as linear RGB 48-bit - FILO_RAW_PREVIEW = RAW_PREVIEW ' try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit - FILO_RAW_DISPLAY = RAW_DISPLAY ' load the file as RGB 24-bit - FILO_TARGA_DEFAULT = TARGA_LOAD_RGB888 - FILO_TARGA_LOAD_RGB888 = TARGA_LOAD_RGB888 ' if set, the loader converts RGB555 and ARGB8888 -> RGB888 - FISO_TIFF_DEFAULT = TIFF_DEFAULT - FISO_TIFF_CMYK = TIFF_CMYK ' reads tags for separated CMYK -End Enum -#If False Then - Const FILO_LOAD_NOPIXELS = &H8000 - Const FILO_LOAD_DEFAULT = 0 - Const FILO_GIF_DEFAULT = GIF_DEFAULT - Const FILO_GIF_LOAD256 = GIF_LOAD256 - Const FILO_GIF_PLAYBACK = GIF_PLAYBACK - Const FILO_ICO_DEFAULT = ICO_DEFAULT - Const FILO_ICO_MAKEALPHA = ICO_MAKEALPHA - Const FILO_JPEG_DEFAULT = JPEG_DEFAULT - Const FILO_JPEG_FAST = JPEG_FAST - Const FILO_JPEG_ACCURATE = JPEG_ACCURATE - Const FILO_JPEG_CMYK = JPEG_CMYK - Const FILO_JPEG_EXIFROTATE = JPEG_EXIFROTATE - Const FILO_PCD_DEFAULT = PCD_DEFAULT - Const FILO_PCD_BASE = PCD_BASE - Const FILO_PCD_BASEDIV4 = PCD_BASEDIV4 - Const FILO_PCD_BASEDIV16 = PCD_BASEDIV16 - Const FILO_PNG_DEFAULT = PNG_DEFAULT - Const FILO_PNG_IGNOREGAMMA = PNG_IGNOREGAMMA - Const FILO_TARGA_DEFAULT = TARGA_LOAD_RGB888 - Const FILO_TARGA_LOAD_RGB888 = TARGA_LOAD_RGB888 - Const FISO_TIFF_DEFAULT = TIFF_DEFAULT - Const FISO_TIFF_CMYK = TIFF_CMYK -#End If - -Public Enum FREE_IMAGE_SAVE_OPTIONS - FISO_SAVE_DEFAULT = 0 - FISO_BMP_DEFAULT = BMP_DEFAULT - FISO_BMP_SAVE_RLE = BMP_SAVE_RLE - FISO_EXR_DEFAULT = EXR_DEFAULT ' save data as half with piz-based wavelet compression - FISO_EXR_FLOAT = EXR_FLOAT ' save data as float instead of as half (not recommended) - FISO_EXR_NONE = EXR_NONE ' save with no compression - FISO_EXR_ZIP = EXR_ZIP ' save with zlib compression, in blocks of 16 scan lines - FISO_EXR_PIZ = EXR_PIZ ' save with piz-based wavelet compression - FISO_EXR_PXR24 = EXR_PXR24 ' save with lossy 24-bit float compression - FISO_EXR_B44 = EXR_B44 ' save with lossy 44% float compression - goes to 22% when combined with EXR_LC - FISO_EXR_LC = EXR_LC ' save images with one luminance and two chroma channels, rather than as RGB (lossy compression) - FISO_JPEG_DEFAULT = JPEG_DEFAULT ' for saving this is a synonym for FISO_JPEG_QUALITYGOOD - FISO_JPEG_QUALITYSUPERB = JPEG_QUALITYSUPERB ' save with superb quality (100:1) - FISO_JPEG_QUALITYGOOD = JPEG_QUALITYGOOD ' save with good quality (75:1) - FISO_JPEG_QUALITYNORMAL = JPEG_QUALITYNORMAL ' save with normal quality (50:1) - FISO_JPEG_QUALITYAVERAGE = JPEG_QUALITYAVERAGE ' save with average quality (25:1) - FISO_JPEG_QUALITYBAD = JPEG_QUALITYBAD ' save with bad quality (10:1) - FISO_JPEG_PROGRESSIVE = JPEG_PROGRESSIVE ' save as a progressive-JPEG (use 'OR' to combine with other save flags) - FISO_JPEG_SUBSAMPLING_411 = JPEG_SUBSAMPLING_411 ' save with high 4x1 chroma subsampling (4:1:1) - FISO_JPEG_SUBSAMPLING_420 = JPEG_SUBSAMPLING_420 ' save with medium 2x2 medium chroma subsampling (4:2:0) - default value - FISO_JPEG_SUBSAMPLING_422 = JPEG_SUBSAMPLING_422 ' save with low 2x1 chroma subsampling (4:2:2) - FISO_JPEG_SUBSAMPLING_444 = JPEG_SUBSAMPLING_444 ' save with no chroma subsampling (4:4:4) - FISO_JPEG_OPTIMIZE = JPEG_OPTIMIZE ' compute optimal Huffman coding tables (can reduce a few percent of file size) - FISO_PNG_Z_BEST_SPEED = PNG_Z_BEST_SPEED ' save using ZLib level 1 compression flag (default value is 6) - FISO_PNG_Z_DEFAULT_COMPRESSION = PNG_Z_DEFAULT_COMPRESSION ' save using ZLib level 6 compression flag (default recommended value) - FISO_PNG_Z_BEST_COMPRESSION = PNG_Z_BEST_COMPRESSION ' save using ZLib level 9 compression flag (default value is 6) - FISO_PNG_Z_NO_COMPRESSION = PNG_Z_NO_COMPRESSION ' save without ZLib compression - FISO_PNG_INTERLACED = PNG_INTERLACED ' save using Adam7 interlacing (use | to combine with other save flags) - FISO_PNM_DEFAULT = PNM_DEFAULT - FISO_PNM_SAVE_RAW = PNM_SAVE_RAW ' if set, the writer saves in RAW format (i.e. P4, P5 or P6) - FISO_PNM_SAVE_ASCII = PNM_SAVE_ASCII ' if set, the writer saves in ASCII format (i.e. P1, P2 or P3) - FISO_TARGA_SAVE_RLE = TARGA_SAVE_RLE ' if set, the writer saves with RLE compression - FISO_TIFF_DEFAULT = TIFF_DEFAULT - FISO_TIFF_CMYK = TIFF_CMYK ' stores tags for separated CMYK (use 'OR' to combine with compression flags) - FISO_TIFF_PACKBITS = TIFF_PACKBITS ' save using PACKBITS compression - FISO_TIFF_DEFLATE = TIFF_DEFLATE ' save using DEFLATE compression (a.k.a. ZLIB compression) - FISO_TIFF_ADOBE_DEFLATE = TIFF_ADOBE_DEFLATE ' save using ADOBE DEFLATE compression - FISO_TIFF_NONE = TIFF_NONE ' save without any compression - FISO_TIFF_CCITTFAX3 = TIFF_CCITTFAX3 ' save using CCITT Group 3 fax encoding - FISO_TIFF_CCITTFAX4 = TIFF_CCITTFAX4 ' save using CCITT Group 4 fax encoding - FISO_TIFF_LZW = TIFF_LZW ' save using LZW compression - FISO_TIFF_JPEG = TIFF_JPEG ' save using JPEG compression - FISO_TIFF_LOGLUV = TIFF_LOGLUV ' save using LogLuv compression -End Enum -#If False Then - Const FISO_SAVE_DEFAULT = 0 - Const FISO_BMP_DEFAULT = BMP_DEFAULT - Const FISO_BMP_SAVE_RLE = BMP_SAVE_RLE - Const FISO_JPEG_DEFAULT = JPEG_DEFAULT - Const FISO_JPEG_QUALITYSUPERB = JPEG_QUALITYSUPERB - Const FISO_JPEG_QUALITYGOOD = JPEG_QUALITYGOOD - Const FISO_JPEG_QUALITYNORMAL = JPEG_QUALITYNORMAL - Const FISO_JPEG_QUALITYAVERAGE = JPEG_QUALITYAVERAGE - Const FISO_JPEG_QUALITYBAD = JPEG_QUALITYBAD - Const FISO_JPEG_PROGRESSIVE = JPEG_PROGRESSIVE - Const FISO_JPEG_SUBSAMPLING_411 = JPEG_SUBSAMPLING_411 - Const FISO_JPEG_SUBSAMPLING_420 = JPEG_SUBSAMPLING_420 - Const FISO_JPEG_SUBSAMPLING_422 = JPEG_SUBSAMPLING_422 - Const FISO_JPEG_SUBSAMPLING_444 = JPEG_SUBSAMPLING_444 - Const FISO_PNM_DEFAULT = PNM_DEFAULT - Const FISO_PNM_SAVE_RAW = PNM_SAVE_RAW - Const FISO_PNM_SAVE_ASCII = PNM_SAVE_ASCII - Const FISO_TARGA_SAVE_RLE = TARGA_SAVE_RLE - Const FISO_TIFF_DEFAULT = TIFF_DEFAULT - Const FISO_TIFF_CMYK = TIFF_CMYK - Const FISO_TIFF_PACKBITS = TIFF_PACKBITS - Const FISO_TIFF_DEFLATE = TIFF_DEFLATE - Const FISO_TIFF_ADOBE_DEFLATE = TIFF_ADOBE_DEFLATE - Const FISO_TIFF_NONE = TIFF_NONE - Const FISO_TIFF_CCITTFAX3 = TIFF_CCITTFAX3 - Const FISO_TIFF_CCITTFAX4 = TIFF_CCITTFAX4 - Const FISO_TIFF_LZW = TIFF_LZW - Const FISO_TIFF_JPEG = TIFF_JPEG -#End If - -Public Enum FREE_IMAGE_TYPE - FIT_UNKNOWN = 0 ' unknown type - FIT_BITMAP = 1 ' standard image : 1-, 4-, 8-, 16-, 24-, 32-bit - FIT_UINT16 = 2 ' array of unsigned short : unsigned 16-bit - FIT_INT16 = 3 ' array of short : signed 16-bit - FIT_UINT32 = 4 ' array of unsigned long : unsigned 32-bit - FIT_INT32 = 5 ' array of long : signed 32-bit - FIT_FLOAT = 6 ' array of float : 32-bit IEEE floating point - FIT_DOUBLE = 7 ' array of double : 64-bit IEEE floating point - FIT_COMPLEX = 8 ' array of FICOMPLEX : 2 x 64-bit IEEE floating point - FIT_RGB16 = 9 ' 48-bit RGB image : 3 x 16-bit - FIT_RGBA16 = 10 ' 64-bit RGBA image : 4 x 16-bit - FIT_RGBF = 11 ' 96-bit RGB float image : 3 x 32-bit IEEE floating point - FIT_RGBAF = 12 ' 128-bit RGBA float image : 4 x 32-bit IEEE floating point -End Enum -#If False Then - Const FIT_UNKNOWN = 0 - Const FIT_BITMAP = 1 - Const FIT_UINT16 = 2 - Const FIT_INT16 = 3 - Const FIT_UINT32 = 4 - Const FIT_INT32 = 5 - Const FIT_FLOAT = 6 - Const FIT_DOUBLE = 7 - Const FIT_COMPLEX = 8 - Const FIT_RGB16 = 9 - Const FIT_RGBA16 = 10 - Const FIT_RGBF = 11 - Const FIT_RGBAF = 12 -#End If - -Public Enum FREE_IMAGE_COLOR_TYPE - FIC_MINISWHITE = 0 ' min value is white - FIC_MINISBLACK = 1 ' min value is black - FIC_RGB = 2 ' RGB color model - FIC_PALETTE = 3 ' color map indexed - FIC_RGBALPHA = 4 ' RGB color model with alpha channel - FIC_CMYK = 5 ' CMYK color model -End Enum -#If False Then - Const FIC_MINISWHITE = 0 - Const FIC_MINISBLACK = 1 - Const FIC_RGB = 2 - Const FIC_PALETTE = 3 - Const FIC_RGBALPHA = 4 - Const FIC_CMYK = 5 -#End If - -Public Enum FREE_IMAGE_QUANTIZE - FIQ_WUQUANT = 0 ' Xiaolin Wu color quantization algorithm - FIQ_NNQUANT = 1 ' NeuQuant neural-net quantization algorithm by Anthony Dekker -End Enum -#If False Then - Const FIQ_WUQUANT = 0 - Const FIQ_NNQUANT = 1 -#End If - -Public Enum FREE_IMAGE_DITHER - FID_FS = 0 ' Floyd & Steinberg error diffusion - FID_BAYER4x4 = 1 ' Bayer ordered dispersed dot dithering (order 2 dithering matrix) - FID_BAYER8x8 = 2 ' Bayer ordered dispersed dot dithering (order 3 dithering matrix) - FID_CLUSTER6x6 = 3 ' Ordered clustered dot dithering (order 3 - 6x6 matrix) - FID_CLUSTER8x8 = 4 ' Ordered clustered dot dithering (order 4 - 8x8 matrix) - FID_CLUSTER16x16 = 5 ' Ordered clustered dot dithering (order 8 - 16x16 matrix) - FID_BAYER16x16 = 6 ' Bayer ordered dispersed dot dithering (order 4 dithering matrix) -End Enum -#If False Then - Const FID_FS = 0 - Const FID_BAYER4x4 = 1 - Const FID_BAYER8x8 = 2 - Const FID_CLUSTER6x6 = 3 - Const FID_CLUSTER8x8 = 4 - Const FID_CLUSTER16x16 = 5 - Const FID_BAYER16x16 = 6 -#End If - -Public Enum FREE_IMAGE_JPEG_OPERATION - FIJPEG_OP_NONE = 0 ' no transformation - FIJPEG_OP_FLIP_H = 1 ' horizontal flip - FIJPEG_OP_FLIP_V = 2 ' vertical flip - FIJPEG_OP_TRANSPOSE = 3 ' transpose across UL-to-LR axis - FIJPEG_OP_TRANSVERSE = 4 ' transpose across UR-to-LL axis - FIJPEG_OP_ROTATE_90 = 5 ' 90-degree clockwise rotation - FIJPEG_OP_ROTATE_180 = 6 ' 180-degree rotation - FIJPEG_OP_ROTATE_270 = 7 ' 270-degree clockwise (or 90 ccw) -End Enum -#If False Then - Const FIJPEG_OP_NONE = 0 - Const FIJPEG_OP_FLIP_H = 1 - Const FIJPEG_OP_FLIP_V = 2 - Const FIJPEG_OP_TRANSPOSE = 3 - Const FIJPEG_OP_TRANSVERSE = 4 - Const FIJPEG_OP_ROTATE_90 = 5 - Const FIJPEG_OP_ROTATE_180 = 6 - Const FIJPEG_OP_ROTATE_270 = 7 -#End If - -Public Enum FREE_IMAGE_TMO - FITMO_DRAGO03 = 0 ' Adaptive logarithmic mapping (F. Drago, 2003) - FITMO_REINHARD05 = 1 ' Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) - FITMO_FATTAL02 = 2 ' Gradient domain high dynamic range compression (R. Fattal, 2002) -End Enum -#If False Then - Const FITMO_DRAGO03 = 0 - Const FITMO_REINHARD05 = 1 - Const FITMO_FATTAL02 = 2 -#End If - -Public Enum FREE_IMAGE_FILTER - FILTER_BOX = 0 ' Box, pulse, Fourier window, 1st order (constant) b-spline - FILTER_BICUBIC = 1 ' Mitchell & Netravali's two-param cubic filter - FILTER_BILINEAR = 2 ' Bilinear filter - FILTER_BSPLINE = 3 ' 4th order (cubic) b-spline - FILTER_CATMULLROM = 4 ' Catmull-Rom spline, Overhauser spline - FILTER_LANCZOS3 = 5 ' Lanczos3 filter -End Enum -#If False Then - Const FILTER_BOX = 0 - Const FILTER_BICUBIC = 1 - Const FILTER_BILINEAR = 2 - Const FILTER_BSPLINE = 3 - Const FILTER_CATMULLROM = 4 - Const FILTER_LANCZOS3 = 5 -#End If - -Public Enum FREE_IMAGE_COLOR_CHANNEL - FICC_RGB = 0 ' Use red, green and blue channels - FICC_RED = 1 ' Use red channel - FICC_GREEN = 2 ' Use green channel - FICC_BLUE = 3 ' Use blue channel - FICC_ALPHA = 4 ' Use alpha channel - FICC_BLACK = 5 ' Use black channel - FICC_REAL = 6 ' Complex images: use real part - FICC_IMAG = 7 ' Complex images: use imaginary part - FICC_MAG = 8 ' Complex images: use magnitude - FICC_PHASE = 9 ' Complex images: use phase -End Enum -#If False Then - Const FICC_RGB = 0 - Const FICC_RED = 1 - Const FICC_GREEN = 2 - Const FICC_BLUE = 3 - Const FICC_ALPHA = 4 - Const FICC_BLACK = 5 - Const FICC_REAL = 6 - Const FICC_IMAG = 7 - Const FICC_MAG = 8 - Const FICC_PHASE = 9 -#End If - -Public Enum FREE_IMAGE_MDTYPE - FIDT_NOTYPE = 0 ' placeholder - FIDT_BYTE = 1 ' 8-bit unsigned integer - FIDT_ASCII = 2 ' 8-bit bytes w/ last byte null - FIDT_SHORT = 3 ' 16-bit unsigned integer - FIDT_LONG = 4 ' 32-bit unsigned integer - FIDT_RATIONAL = 5 ' 64-bit unsigned fraction - FIDT_SBYTE = 6 ' 8-bit signed integer - FIDT_UNDEFINED = 7 ' 8-bit untyped data - FIDT_SSHORT = 8 ' 16-bit signed integer - FIDT_SLONG = 9 ' 32-bit signed integer - FIDT_SRATIONAL = 10 ' 64-bit signed fraction - FIDT_FLOAT = 11 ' 32-bit IEEE floating point - FIDT_DOUBLE = 12 ' 64-bit IEEE floating point - FIDT_IFD = 13 ' 32-bit unsigned integer (offset) - FIDT_PALETTE = 14 ' 32-bit RGBQUAD -End Enum -#If False Then - Const FIDT_NOTYPE = 0 - Const FIDT_BYTE = 1 - Const FIDT_ASCII = 2 - Const FIDT_SHORT = 3 - Const FIDT_LONG = 4 - Const FIDT_RATIONAL = 5 - Const FIDT_SBYTE = 6 - Const FIDT_UNDEFINED = 7 - Const FIDT_SSHORT = 8 - Const FIDT_SLONG = 9 - Const FIDT_SRATIONAL = 10 - Const FIDT_FLOAT = 11 - Const FIDT_DOUBLE = 12 - Const FIDT_IFD = 13 - Const FIDT_PALETTE = 14 -#End If - -Public Enum FREE_IMAGE_MDMODEL - FIMD_NODATA = -1 ' - FIMD_COMMENTS = 0 ' single comment or keywords - FIMD_EXIF_MAIN = 1 ' Exif-TIFF metadata - FIMD_EXIF_EXIF = 2 ' Exif-specific metadata - FIMD_EXIF_GPS = 3 ' Exif GPS metadata - FIMD_EXIF_MAKERNOTE = 4 ' Exif maker note metadata - FIMD_EXIF_INTEROP = 5 ' Exif interoperability metadata - FIMD_IPTC = 6 ' IPTC/NAA metadata - FIMD_XMP = 7 ' Abobe XMP metadata - FIMD_GEOTIFF = 8 ' GeoTIFF metadata - FIMD_ANIMATION = 9 ' Animation metadata - FIMD_CUSTOM = 10 ' Used to attach other metadata types to a dib - FIMD_EXIF_RAW = 11 ' Exif metadata as a raw buffer -End Enum -#If False Then - Const FIMD_NODATA = -1 - Const FIMD_COMMENTS = 0 - Const FIMD_EXIF_MAIN = 1 - Const FIMD_EXIF_EXIF = 2 - Const FIMD_EXIF_GPS = 3 - Const FIMD_EXIF_MAKERNOTE = 4 - Const FIMD_EXIF_INTEROP = 5 - Const FIMD_IPTC = 6 - Const FIMD_XMP = 7 - Const FIMD_GEOTIFF = 8 - Const FIMD_ANIMATION = 9 - Const FIMD_CUSTOM = 10 - Const FIMD_EXIF_RAW = 11 -#End If - -' These are the GIF_DISPOSAL metadata constants -Public Enum FREE_IMAGE_FRAME_DISPOSAL_METHODS - FIFD_GIF_DISPOSAL_UNSPECIFIED = 0 - FIFD_GIF_DISPOSAL_LEAVE = 1 - FIFD_GIF_DISPOSAL_BACKGROUND = 2 - FIFD_GIF_DISPOSAL_PREVIOUS = 3 -End Enum - -' Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas -Public Enum FREE_IMAGE_COLOR_OPTIONS - FI_COLOR_IS_RGB_COLOR = &H0 ' RGBQUAD color is a RGB color (contains no valid alpha channel) - FI_COLOR_IS_RGBA_COLOR = &H1 ' RGBQUAD color is a RGBA color (contains a valid alpha channel) - FI_COLOR_FIND_EQUAL_COLOR = &H2 ' For palettized images: lookup equal RGB color from palette - FI_COLOR_ALPHA_IS_INDEX = &H4 ' The color's rgbReserved member (alpha) contains the palette index to be used -End Enum -Public Const FI_COLOR_PALETTE_SEARCH_MASK = _ - (FI_COLOR_FIND_EQUAL_COLOR Or FI_COLOR_ALPHA_IS_INDEX) ' Flag to test, if any color lookup is performed - -' the next enums are only used by derived functions of the -' FreeImage 3 VB wrapper -Public Enum FREE_IMAGE_CONVERSION_FLAGS - FICF_MONOCHROME = &H1 - FICF_MONOCHROME_THRESHOLD = FICF_MONOCHROME - FICF_MONOCHROME_DITHER = &H3 - FICF_GREYSCALE_4BPP = &H4 - FICF_PALLETISED_8BPP = &H8 - FICF_GREYSCALE_8BPP = FICF_PALLETISED_8BPP Or FICF_MONOCHROME - FICF_GREYSCALE = FICF_GREYSCALE_8BPP - FICF_RGB_15BPP = &HF - FICF_RGB_16BPP = &H10 - FICF_RGB_24BPP = &H18 - FICF_RGB_32BPP = &H20 - FICF_RGB_ALPHA = FICF_RGB_32BPP - FICF_KEEP_UNORDERED_GREYSCALE_PALETTE = &H0 - FICF_REORDER_GREYSCALE_PALETTE = &H1000 -End Enum -#If False Then - Const FICF_MONOCHROME = &H1 - Const FICF_MONOCHROME_THRESHOLD = FICF_MONOCHROME - Const FICF_MONOCHROME_DITHER = &H3 - Const FICF_GREYSCALE_4BPP = &H4 - Const FICF_PALLETISED_8BPP = &H8 - Const FICF_GREYSCALE_8BPP = FICF_PALLETISED_8BPP Or FICF_MONOCHROME - Const FICF_GREYSCALE = FICF_GREYSCALE_8BPP - Const FICF_RGB_15BPP = &HF - Const FICF_RGB_16BPP = &H10 - Const FICF_RGB_24BPP = &H18 - Const FICF_RGB_32BPP = &H20 - Const FICF_RGB_ALPHA = FICF_RGB_32BPP - Const FICF_KEEP_UNORDERED_GREYSCALE_PALETTE = &H0 - Const FICF_REORDER_GREYSCALE_PALETTE = &H1000 -#End If - -Public Enum FREE_IMAGE_COLOR_DEPTH - FICD_AUTO = &H0 - FICD_MONOCHROME = &H1 - FICD_MONOCHROME_THRESHOLD = FICF_MONOCHROME - FICD_MONOCHROME_DITHER = &H3 - FICD_1BPP = FICD_MONOCHROME - FICD_4BPP = &H4 - FICD_8BPP = &H8 - FICD_15BPP = &HF - FICD_16BPP = &H10 - FICD_24BPP = &H18 - FICD_32BPP = &H20 -End Enum -#If False Then - Const FICD_AUTO = &H0 - Const FICD_MONOCHROME = &H1 - Const FICD_MONOCHROME_THRESHOLD = FICF_MONOCHROME - Const FICD_MONOCHROME_DITHER = &H3 - Const FICD_1BPP = FICD_MONOCHROME - Const FICD_4BPP = &H4 - Const FICD_8BPP = &H8 - Const FICD_15BPP = &HF - Const FICD_16BPP = &H10 - Const FICD_24BPP = &H18 - Const FICD_32BPP = &H20 -#End If - -Public Enum FREE_IMAGE_ADJUST_MODE - AM_STRECH = &H1 - AM_DEFAULT = AM_STRECH - AM_ADJUST_BOTH = AM_STRECH - AM_ADJUST_WIDTH = &H2 - AM_ADJUST_HEIGHT = &H4 - AM_ADJUST_OPTIMAL_SIZE = &H8 -End Enum -#If False Then - Const AM_STRECH = &H1 - Const AM_DEFAULT = AM_STRECH - Const AM_ADJUST_BOTH = AM_STRECH - Const AM_ADJUST_WIDTH = &H2 - Const AM_ADJUST_HEIGHT = &H4 - Const AM_ADJUST_OPTIMAL_SIZE = &H8 -#End If - -Public Enum FREE_IMAGE_MASK_FLAGS - FIMF_MASK_NONE = &H0 - FIMF_MASK_FULL_TRANSPARENCY = &H1 - FIMF_MASK_ALPHA_TRANSPARENCY = &H2 - FIMF_MASK_COLOR_TRANSPARENCY = &H4 - FIMF_MASK_FORCE_TRANSPARENCY = &H8 - FIMF_MASK_INVERSE_MASK = &H10 -End Enum -#If False Then - Const FIMF_MASK_NONE = &H0 - Const FIMF_MASK_FULL_TRANSPARENCY = &H1 - Const FIMF_MASK_ALPHA_TRANSPARENCY = &H2 - Const FIMF_MASK_COLOR_TRANSPARENCY = &H4 - Const FIMF_MASK_FORCE_TRANSPARENCY = &H8 - Const FIMF_MASK_INVERSE_MASK = &H10 -#End If - -Public Enum FREE_IMAGE_COLOR_FORMAT_FLAGS - FICFF_COLOR_RGB = &H1 - FICFF_COLOR_BGR = &H2 - FICFF_COLOR_PALETTE_INDEX = &H4 - - FICFF_COLOR_HAS_ALPHA = &H100 - - FICFF_COLOR_ARGB = FICFF_COLOR_RGB Or FICFF_COLOR_HAS_ALPHA - FICFF_COLOR_ABGR = FICFF_COLOR_BGR Or FICFF_COLOR_HAS_ALPHA - - FICFF_COLOR_FORMAT_ORDER_MASK = FICFF_COLOR_RGB Or FICFF_COLOR_BGR -End Enum -#If False Then - Const FICFF_COLOR_RGB = &H1 - Const FICFF_COLOR_BGR = &H2 - Const FICFF_COLOR_PALETTE_INDEX = &H4 - - Const FICFF_COLOR_HAS_ALPHA = &H100 - - Const FICFF_COLOR_ARGB = FICFF_COLOR_RGB Or FICFF_COLOR_HAS_ALPHA - Const FICFF_COLOR_ABGR = FICFF_COLOR_BGR Or FICFF_COLOR_HAS_ALPHA - - Const FICFF_COLOR_FORMAT_ORDER_MASK = FICFF_COLOR_RGB Or FICFF_COLOR_BGR -#End If - -Public Enum FREE_IMAGE_MASK_CREATION_OPTION_FLAGS - MCOF_CREATE_MASK_IMAGE = &H1 - MCOF_MODIFY_SOURCE_IMAGE = &H2 - MCOF_CREATE_AND_MODIFY = MCOF_CREATE_MASK_IMAGE Or MCOF_MODIFY_SOURCE_IMAGE -End Enum -#If False Then - Const MCOF_CREATE_MASK_IMAGE = &H1 - Const MCOF_MODIFY_SOURCE_IMAGE = &H2 - Const MCOF_CREATE_AND_MODIFY = MCOF_CREATE_MASK_IMAGE Or MCOF_MODIFY_SOURCE_IMAGE -#End If - -Public Enum FREE_IMAGE_TRANSPARENCY_STATE_FLAGS - FITSF_IGNORE_TRANSPARENCY = &H0 - FITSF_NONTRANSPARENT = &H1 - FITSF_TRANSPARENT = &H2 - FITSF_INCLUDE_ALPHA_TRANSPARENCY = &H4 -End Enum -#If False Then - Const FITSF_IGNORE_TRANSPARENCY = &H0 - Const FITSF_NONTRANSPARENT = &H1 - Const FITSF_TRANSPARENT = &H2 - Const FITSF_INCLUDE_ALPHA_TRANSPARENCY = &H4 -#End If - -Public Enum FREE_IMAGE_ICON_TRANSPARENCY_OPTION_FLAGS - ITOF_NO_TRANSPARENCY = &H0 - ITOF_USE_TRANSPARENCY_INFO = &H1 - ITOF_USE_TRANSPARENCY_INFO_ONLY = ITOF_USE_TRANSPARENCY_INFO - ITOF_USE_COLOR_TRANSPARENCY = &H2 - ITOF_USE_COLOR_TRANSPARENCY_ONLY = ITOF_USE_COLOR_TRANSPARENCY - ITOF_USE_TRANSPARENCY_INFO_OR_COLOR = ITOF_USE_TRANSPARENCY_INFO Or ITOF_USE_COLOR_TRANSPARENCY - ITOF_USE_DEFAULT_TRANSPARENCY = ITOF_USE_TRANSPARENCY_INFO_OR_COLOR - ITOF_USE_COLOR_TOP_LEFT_PIXEL = &H0 - ITOF_USE_COLOR_FIRST_PIXEL = ITOF_USE_COLOR_TOP_LEFT_PIXEL - ITOF_USE_COLOR_TOP_RIGHT_PIXEL = &H20 - ITOF_USE_COLOR_BOTTOM_LEFT_PIXEL = &H40 - ITOF_USE_COLOR_BOTTOM_RIGHT_PIXEL = &H80 - ITOF_USE_COLOR_SPECIFIED = &H100 - ITOF_FORCE_TRANSPARENCY_INFO = &H400 -End Enum -#If False Then - Const ITOF_NO_TRANSPARENCY = &H0 - Const ITOF_USE_TRANSPARENCY_INFO = &H1 - Const ITOF_USE_TRANSPARENCY_INFO_ONLY = ITOF_USE_TRANSPARENCY_INFO - Const ITOF_USE_COLOR_TRANSPARENCY = &H2 - Const ITOF_USE_COLOR_TRANSPARENCY_ONLY = ITOF_USE_COLOR_TRANSPARENCY - Const ITOF_USE_TRANSPARENCY_INFO_OR_COLOR = ITOF_USE_TRANSPARENCY_INFO Or ITOF_USE_COLOR_TRANSPARENCY - Const ITOF_USE_DEFAULT_TRANSPARENCY = ITOF_USE_TRANSPARENCY_INFO_OR_COLOR - Const ITOF_USE_COLOR_TOP_LEFT_PIXEL = &H0 - Const ITOF_USE_COLOR_FIRST_PIXEL = ITOF_USE_COLOR_TOP_LEFT_PIXEL - Const ITOF_USE_COLOR_TOP_RIGHT_PIXEL = &H20 - Const ITOF_USE_COLOR_BOTTOM_LEFT_PIXEL = &H40 - Const ITOF_USE_COLOR_BOTTOM_RIGHT_PIXEL = &H80 - Const ITOF_USE_COLOR_SPECIFIED = &H100 - Const ITOF_FORCE_TRANSPARENCY_INFO = &H400 -#End If - -Private Const ITOF_USE_COLOR_BITMASK As Long = ITOF_USE_COLOR_TOP_RIGHT_PIXEL Or _ - ITOF_USE_COLOR_BOTTOM_LEFT_PIXEL Or _ - ITOF_USE_COLOR_BOTTOM_RIGHT_PIXEL Or _ - ITOF_USE_COLOR_SPECIFIED - - -Public Type RGBQUAD - rgbBlue As Byte - rgbGreen As Byte - rgbRed As Byte - rgbReserved As Byte -End Type - -Public Type RGBTRIPLE - rgbtBlue As Byte - rgbtGreen As Byte - rgbtRed As Byte -End Type - -Public Type BITMAPINFOHEADER - biSize As Long - biWidth As Long - biHeight As Long - biPlanes As Integer - biBitCount As Integer - biCompression As Long - biSizeImage As Long - biXPelsPerMeter As Long - biYPelsPerMeter As Long - biClrUsed As Long - biClrImportant As Long -End Type - -Public Type BITMAPINFO - bmiHeader As BITMAPINFOHEADER - bmiColors(0) As RGBQUAD -End Type - -Public Const BI_RGB As Long = 0 -Public Const BI_RLE8 As Long = 1 -Public Const BI_RLE4 As Long = 2 -Public Const BI_BITFIELDS As Long = 3 -Public Const BI_JPEG As Long = 4 -Public Const BI_PNG As Long = 5 - -Public Type FIICCPROFILE - Flags As Integer - Size As Long - Data As Long -End Type - -Public Type FIRGB16 - Red As Integer - Green As Integer - Blue As Integer -End Type - -Public Type FIRGBA16 - Red As Integer - Green As Integer - Blue As Integer - Alpha As Integer -End Type - -Public Type FIRGBF - Red As Single - Green As Single - Blue As Single -End Type - -Public Type FIRGBAF - Red As Single - Green As Single - Blue As Single - Alpha As Single -End Type - -Public Type FICOMPLEX - r As Double ' real part - i As Double ' imaginary part -End Type - -Public Type FITAG - Key As Long - Description As Long - Id As Integer - Type As Integer - Count As Long - Length As Long - Value As Long -End Type - -Public Type FIRATIONAL - Numerator As Variant - Denominator As Variant -End Type - -Public Type FREE_IMAGE_TAG - Model As FREE_IMAGE_MDMODEL - TagPtr As Long - Key As String - Description As String - Id As Long - Type As FREE_IMAGE_MDTYPE - Count As Long - Length As Long - StringValue As String - Palette() As RGBQUAD - RationalValue() As FIRATIONAL - Value As Variant -End Type - -Public Type FreeImageIO - read_proc As Long - write_proc As Long - seek_proc As Long - tell_proc As Long -End Type - -Public Type Plugin - format_proc As Long - description_proc As Long - extension_proc As Long - regexpr_proc As Long - open_proc As Long - close_proc As Long - pagecount_proc As Long - pagecapability_proc As Long - load_proc As Long - save_proc As Long - validate_proc As Long - mime_proc As Long - supports_export_bpp_proc As Long - supports_export_type_proc As Long - supports_icc_profiles_proc As Long -End Type - -' the next structures are only used by derived functions of the -' FreeImage 3 VB wrapper -Public Type ScanLineRGBTRIBLE - Data() As RGBTRIPLE -End Type - -Public Type ScanLinesRGBTRIBLE - Scanline() As ScanLineRGBTRIBLE -End Type - -'-------------------------------------------------------------------------------- -' FreeImage 3 function declarations -'-------------------------------------------------------------------------------- - -' The FreeImage 3 functions are declared in the same order as they are described -' in the FreeImage 3 API documentation. The documentation's outline is included -' as comments. - -'-------------------------------------------------------------------------------- -' Bitmap functions -'-------------------------------------------------------------------------------- - -' General functions -Public Declare Sub FreeImage_Initialise Lib "FreeImage.dll" Alias "_FreeImage_Initialise@4" ( _ - Optional ByVal LoadLocalPluginsOnly As Long) - -Public Declare Sub FreeImage_DeInitialise Lib "FreeImage.dll" Alias "_FreeImage_DeInitialise@0" () - -Private Declare Function FreeImage_GetVersionInt Lib "FreeImage.dll" Alias "_FreeImage_GetVersion@0" () As Long - -Private Declare Function FreeImage_GetCopyrightMessageInt Lib "FreeImage.dll" Alias "_FreeImage_GetCopyrightMessage@0" () As Long - -Public Declare Sub FreeImage_SetOutputMessage Lib "FreeImage.dll" Alias "_FreeImage_SetOutputMessageStdCall@4" ( _ - ByVal omf As Long) - - -' Bitmap management functions -Public Declare Function FreeImage_Allocate Lib "FreeImage.dll" Alias "_FreeImage_Allocate@24" ( _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long) As Long - -Public Declare Function FreeImage_AllocateT Lib "FreeImage.dll" Alias "_FreeImage_AllocateT@28" ( _ - ByVal ImageType As FREE_IMAGE_TYPE, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - Optional ByVal BitsPerPixel As Long = 8, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long) As Long - -Public Declare Function FreeImage_HasPixelsInt Lib "FreeImage.dll" Alias "_FreeImage_HasPixels@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_Load Lib "FreeImage.dll" Alias "_FreeImage_Load@12" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As String, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Private Declare Function FreeImage_LoadUInt Lib "FreeImage.dll" Alias "_FreeImage_LoadU@12" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As Long, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Public Declare Function FreeImage_LoadFromHandle Lib "FreeImage.dll" Alias "_FreeImage_LoadFromHandle@16" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal IO As Long, _ - ByVal Handle As Long, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Private Declare Function FreeImage_SaveInt Lib "FreeImage.dll" Alias "_FreeImage_Save@16" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Filename As String, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - -Private Declare Function FreeImage_SaveUInt Lib "FreeImage.dll" Alias "_FreeImage_SaveU@16" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Filename As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - -Private Declare Function FreeImage_SaveToHandleInt Lib "FreeImage.dll" Alias "_FreeImage_SaveToHandle@20" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal IO As Long, _ - ByVal Handle As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - -Public Declare Function FreeImage_Clone Lib "FreeImage.dll" Alias "_FreeImage_Clone@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Sub FreeImage_Unload Lib "FreeImage.dll" Alias "_FreeImage_Unload@4" ( _ - ByVal Bitmap As Long) - - -' Bitmap information functions -Public Declare Function FreeImage_GetImageType Lib "FreeImage.dll" Alias "_FreeImage_GetImageType@4" ( _ - ByVal Bitmap As Long) As FREE_IMAGE_TYPE - -Public Declare Function FreeImage_GetColorsUsed Lib "FreeImage.dll" Alias "_FreeImage_GetColorsUsed@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetBPP Lib "FreeImage.dll" Alias "_FreeImage_GetBPP@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetWidth Lib "FreeImage.dll" Alias "_FreeImage_GetWidth@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetHeight Lib "FreeImage.dll" Alias "_FreeImage_GetHeight@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetLine Lib "FreeImage.dll" Alias "_FreeImage_GetLine@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetPitch Lib "FreeImage.dll" Alias "_FreeImage_GetPitch@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetDIBSize Lib "FreeImage.dll" Alias "_FreeImage_GetDIBSize@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetPalette Lib "FreeImage.dll" Alias "_FreeImage_GetPalette@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetDotsPerMeterX Lib "FreeImage.dll" Alias "_FreeImage_GetDotsPerMeterX@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetDotsPerMeterY Lib "FreeImage.dll" Alias "_FreeImage_GetDotsPerMeterY@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Sub FreeImage_SetDotsPerMeterX Lib "FreeImage.dll" Alias "_FreeImage_SetDotsPerMeterX@8" ( _ - ByVal Bitmap As Long, _ - ByVal Resolution As Long) - -Public Declare Sub FreeImage_SetDotsPerMeterY Lib "FreeImage.dll" Alias "_FreeImage_SetDotsPerMeterY@8" ( _ - ByVal Bitmap As Long, _ - ByVal Resolution As Long) - -Public Declare Function FreeImage_GetInfoHeader Lib "FreeImage.dll" Alias "_FreeImage_GetInfoHeader@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetInfo Lib "FreeImage.dll" Alias "_FreeImage_GetInfo@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetColorType Lib "FreeImage.dll" Alias "_FreeImage_GetColorType@4" ( _ - ByVal Bitmap As Long) As FREE_IMAGE_COLOR_TYPE - -Public Declare Function FreeImage_GetRedMask Lib "FreeImage.dll" Alias "_FreeImage_GetRedMask@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetGreenMask Lib "FreeImage.dll" Alias "_FreeImage_GetGreenMask@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetBlueMask Lib "FreeImage.dll" Alias "_FreeImage_GetBlueMask@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetTransparencyCount Lib "FreeImage.dll" Alias "_FreeImage_GetTransparencyCount@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetTransparencyTable Lib "FreeImage.dll" Alias "_FreeImage_GetTransparencyTable@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Sub FreeImage_SetTransparencyTable Lib "FreeImage.dll" Alias "_FreeImage_SetTransparencyTable@12" ( _ - ByVal Bitmap As Long, _ - ByVal TransTablePtr As Long, _ - ByVal Count As Long) - -Private Declare Sub FreeImage_SetTransparentInt Lib "FreeImage.dll" Alias "_FreeImage_SetTransparent@8" ( _ - ByVal Bitmap As Long, _ - ByVal Value As Long) - -Private Declare Function FreeImage_IsTransparentInt Lib "FreeImage.dll" Alias "_FreeImage_IsTransparent@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetTransparentIndex Lib "FreeImage.dll" Alias "_FreeImage_GetTransparentIndex@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_SetTransparentIndex Lib "FreeImage.dll" Alias "_FreeImage_SetTransparentIndex@8" ( _ - ByVal Bitmap As Long, _ - ByVal Index As Long) As Long - -Private Declare Function FreeImage_HasBackgroundColorInt Lib "FreeImage.dll" Alias "_FreeImage_HasBackgroundColor@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_GetBackgroundColorInt Lib "FreeImage.dll" Alias "_FreeImage_GetBackgroundColor@8" ( _ - ByVal Bitmap As Long, _ - ByRef BackColor As RGBQUAD) As Long - -Private Declare Function FreeImage_GetBackgroundColorAsLongInt Lib "FreeImage.dll" Alias "_FreeImage_GetBackgroundColor@8" ( _ - ByVal Bitmap As Long, _ - ByRef BackColor As Long) As Long - -Private Declare Function FreeImage_SetBackgroundColorInt Lib "FreeImage.dll" Alias "_FreeImage_SetBackgroundColor@8" ( _ - ByVal Bitmap As Long, _ - ByRef BackColor As RGBQUAD) As Long - -Private Declare Function FreeImage_SetBackgroundColorAsLongInt Lib "FreeImage.dll" Alias "_FreeImage_SetBackgroundColor@8" ( _ - ByVal Bitmap As Long, _ - ByRef BackColor As Long) As Long - - -' Filetype functions -Public Declare Function FreeImage_GetFileType Lib "FreeImage.dll" Alias "_FreeImage_GetFileType@8" ( _ - ByVal Filename As String, _ - Optional ByVal Size As Long) As FREE_IMAGE_FORMAT - -Private Declare Function FreeImage_GetFileTypeUInt Lib "FreeImage.dll" Alias "_FreeImage_GetFileTypeU@8" ( _ - ByVal Filename As Long, _ - Optional ByVal Size As Long) As FREE_IMAGE_FORMAT - -Public Declare Function FreeImage_GetFileTypeFromHandle Lib "FreeImage.dll" Alias "_FreeImage_GetFileTypeFromHandle@12" ( _ - ByVal IO As Long, _ - ByVal Handle As Long, _ - Optional ByVal Size As Long) As FREE_IMAGE_FORMAT - -Public Declare Function FreeImage_GetFileTypeFromMemory Lib "FreeImage.dll" Alias "_FreeImage_GetFileTypeFromMemory@8" ( _ - ByVal Stream As Long, _ - Optional ByVal Size As Long) As FREE_IMAGE_FORMAT - - -' Pixel access functions -Public Declare Function FreeImage_GetBits Lib "FreeImage.dll" Alias "_FreeImage_GetBits@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_GetScanline Lib "FreeImage.dll" Alias "_FreeImage_GetScanLine@8" ( _ - ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Long - -Private Declare Function FreeImage_GetPixelIndexInt Lib "FreeImage.dll" Alias "_FreeImage_GetPixelIndex@16" ( _ - ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As Byte) As Long - -Private Declare Function FreeImage_GetPixelColorInt Lib "FreeImage.dll" Alias "_FreeImage_GetPixelColor@16" ( _ - ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As RGBQUAD) As Long - -Private Declare Function FreeImage_GetPixelColorByLongInt Lib "FreeImage.dll" Alias "_FreeImage_GetPixelColor@16" ( _ - ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As Long) As Long - -Private Declare Function FreeImage_SetPixelIndexInt Lib "FreeImage.dll" Alias "_FreeImage_SetPixelIndex@16" ( _ - ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As Byte) As Long - -Private Declare Function FreeImage_SetPixelColorInt Lib "FreeImage.dll" Alias "_FreeImage_SetPixelColor@16" ( _ - ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As RGBQUAD) As Long - -Private Declare Function FreeImage_SetPixelColorByLongInt Lib "FreeImage.dll" Alias "_FreeImage_SetPixelColor@16" ( _ - ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As Long) As Long - - - -' Conversion functions -Public Declare Function FreeImage_ConvertTo4Bits Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo4Bits@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertTo8Bits Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo8Bits@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertToGreyscale Lib "FreeImage.dll" Alias "_FreeImage_ConvertToGreyscale@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertTo16Bits555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo16Bits555@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertTo16Bits565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo16Bits565@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertTo24Bits Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo24Bits@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertTo32Bits Lib "FreeImage.dll" Alias "_FreeImage_ConvertTo32Bits@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ColorQuantize Lib "FreeImage.dll" Alias "_FreeImage_ColorQuantize@8" ( _ - ByVal Bitmap As Long, _ - ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE) As Long - -Private Declare Function FreeImage_ColorQuantizeExInt Lib "FreeImage.dll" Alias "_FreeImage_ColorQuantizeEx@20" ( _ - ByVal Bitmap As Long, _ - Optional ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE = FIQ_WUQUANT, _ - Optional ByVal PaletteSize As Long = 256, _ - Optional ByVal ReserveSize As Long = 0, _ - Optional ByVal ReservePalettePtr As Long = 0) As Long - -Public Declare Function FreeImage_Threshold Lib "FreeImage.dll" Alias "_FreeImage_Threshold@8" ( _ - ByVal Bitmap As Long, _ - ByVal Threshold As Byte) As Long - -Public Declare Function FreeImage_Dither Lib "FreeImage.dll" Alias "_FreeImage_Dither@8" ( _ - ByVal Bitmap As Long, _ - ByVal DitherMethod As FREE_IMAGE_DITHER) As Long - -Private Declare Function FreeImage_ConvertFromRawBitsInt Lib "FreeImage.dll" Alias "_FreeImage_ConvertFromRawBits@36" ( _ - ByVal BitsPtr As Long, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - ByVal RedMask As Long, _ - ByVal GreenMask As Long, _ - ByVal BlueMask As Long, _ - ByVal TopDown As Long) As Long - -Private Declare Sub FreeImage_ConvertToRawBitsInt Lib "FreeImage.dll" Alias "_FreeImage_ConvertToRawBits@32" ( _ - ByVal BitsPtr As Long, _ - ByVal Bitmap As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - ByVal RedMask As Long, _ - ByVal GreenMask As Long, _ - ByVal BlueMask As Long, _ - ByVal TopDown As Long) - -Private Declare Function FreeImage_ConvertToStandardTypeInt Lib "FreeImage.dll" Alias "_FreeImage_ConvertToStandardType@8" ( _ - ByVal Bitmap As Long, _ - ByVal ScaleLinear As Long) As Long - -Private Declare Function FreeImage_ConvertToTypeInt Lib "FreeImage.dll" Alias "_FreeImage_ConvertToType@12" ( _ - ByVal Bitmap As Long, _ - ByVal DestinationType As FREE_IMAGE_TYPE, _ - ByVal ScaleLinear As Long) As Long - -Public Declare Function FreeImage_ConvertToRGBF Lib "FreeImage.dll" Alias "_FreeImage_ConvertToRGBF@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_ConvertToFloat Lib "FreeImage.dll" Alias "_FreeImage_ConvertToFloat@4" ( _ - ByVal Bitmap As Long) As Long - -' Tone mapping operators -Public Declare Function FreeImage_ToneMapping Lib "FreeImage.dll" Alias "_FreeImage_ToneMapping@24" ( _ - ByVal Bitmap As Long, _ - ByVal Operator As FREE_IMAGE_TMO, _ - Optional ByVal FirstArgument As Double, _ - Optional ByVal SecondArgument As Double) As Long - -Public Declare Function FreeImage_TmoDrago03 Lib "FreeImage.dll" Alias "_FreeImage_TmoDrago03@20" ( _ - ByVal Bitmap As Long, _ - Optional ByVal Gamma As Double = 2.2, _ - Optional ByVal Exposure As Double) As Long - -Public Declare Function FreeImage_TmoReinhard05 Lib "FreeImage.dll" Alias "_FreeImage_TmoReinhard05@20" ( _ - ByVal Bitmap As Long, _ - Optional ByVal Intensity As Double, _ - Optional ByVal Contrast As Double) As Long - -Public Declare Function FreeImage_TmoReinhard05Ex Lib "FreeImage.dll" Alias "_FreeImage_TmoReinhard05Ex@36" ( _ - ByVal Bitmap As Long, _ - Optional ByVal Intensity As Double, _ - Optional ByVal Contrast As Double, _ - Optional ByVal Adaptation As Double = 1, _ - Optional ByVal ColorCorrection As Double) As Long - -Public Declare Function FreeImage_TmoFattal02 Lib "FreeImage.dll" Alias "_FreeImage_TmoFattal02@20" ( _ - ByVal Bitmap As Long, _ - Optional ByVal ColorSaturation As Double = 0.5, _ - Optional ByVal Attenuation As Double = 0.85) As Long - - -' ICC profile functions -Private Declare Function FreeImage_GetICCProfileInt Lib "FreeImage.dll" Alias "_FreeImage_GetICCProfile@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_CreateICCProfile Lib "FreeImage.dll" Alias "_FreeImage_CreateICCProfile@12" ( _ - ByVal Bitmap As Long, _ - ByRef Data As Long, _ - ByVal Size As Long) As Long - -Public Declare Sub FreeImage_DestroyICCProfile Lib "FreeImage.dll" Alias "_FreeImage_DestroyICCProfile@4" ( _ - ByVal Bitmap As Long) - - -' Plugin functions -Public Declare Function FreeImage_GetFIFCount Lib "FreeImage.dll" Alias "_FreeImage_GetFIFCount@0" () As Long - -Public Declare Function FreeImage_SetPluginEnabled Lib "FreeImage.dll" Alias "_FreeImage_SetPluginEnabled@8" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Value As Long) As Long - -Public Declare Function FreeImage_IsPluginEnabled Lib "FreeImage.dll" Alias "_FreeImage_IsPluginEnabled@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Public Declare Function FreeImage_GetFIFFromFormat Lib "FreeImage.dll" Alias "_FreeImage_GetFIFFromFormat@4" ( _ - ByVal Format As String) As FREE_IMAGE_FORMAT - -Public Declare Function FreeImage_GetFIFFromMime Lib "FreeImage.dll" Alias "_FreeImage_GetFIFFromMime@4" ( _ - ByVal MimeType As String) As FREE_IMAGE_FORMAT - -Private Declare Function FreeImage_GetFIFMimeTypeInt Lib "FreeImage.dll" Alias "_FreeImage_GetFIFMimeType@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_GetFormatFromFIFInt Lib "FreeImage.dll" Alias "_FreeImage_GetFormatFromFIF@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_GetFIFExtensionListInt Lib "FreeImage.dll" Alias "_FreeImage_GetFIFExtensionList@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_GetFIFDescriptionInt Lib "FreeImage.dll" Alias "_FreeImage_GetFIFDescription@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_GetFIFRegExprInt Lib "FreeImage.dll" Alias "_FreeImage_GetFIFRegExpr@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Public Declare Function FreeImage_GetFIFFromFilename Lib "FreeImage.dll" Alias "_FreeImage_GetFIFFromFilename@4" ( _ - ByVal Filename As String) As FREE_IMAGE_FORMAT - -Private Declare Function FreeImage_GetFIFFromFilenameUInt Lib "FreeImage.dll" Alias "_FreeImage_GetFIFFromFilenameU@4" ( _ - ByVal Filename As Long) As FREE_IMAGE_FORMAT - -Private Declare Function FreeImage_FIFSupportsReadingInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsReading@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_FIFSupportsWritingInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsWriting@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_FIFSupportsExportTypeInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsExportType@8" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal ImageType As FREE_IMAGE_TYPE) As Long - -Private Declare Function FreeImage_FIFSupportsExportBPPInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsExportBPP@8" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal BitsPerPixel As Long) As Long - -Private Declare Function FreeImage_FIFSupportsICCProfilesInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsICCProfiles@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Private Declare Function FreeImage_FIFSupportsNoPixelsInt Lib "FreeImage.dll" Alias "_FreeImage_FIFSupportsNoPixels@4" ( _ - ByVal Format As FREE_IMAGE_FORMAT) As Long - -Public Declare Function FreeImage_RegisterLocalPlugin Lib "FreeImage.dll" Alias "_FreeImage_RegisterLocalPlugin@20" ( _ - ByVal InitProcAddress As Long, _ - Optional ByVal Format As String, _ - Optional ByVal Description As String, _ - Optional ByVal Extension As String, _ - Optional ByVal RegExpr As String) As FREE_IMAGE_FORMAT - -Public Declare Function FreeImage_RegisterExternalPlugin Lib "FreeImage.dll" Alias "_FreeImage_RegisterExternalPlugin@20" ( _ - ByVal Path As String, _ - Optional ByVal Format As String, _ - Optional ByVal Description As String, _ - Optional ByVal Extension As String, _ - Optional ByVal RegExpr As String) As FREE_IMAGE_FORMAT - - -' Multipage functions -Private Declare Function FreeImage_OpenMultiBitmapInt Lib "FreeImage.dll" Alias "_FreeImage_OpenMultiBitmap@24" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As String, _ - ByVal CreateNew As Long, _ - ByVal ReadOnly As Long, _ - ByVal KeepCacheInMemory As Long, _ - ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Private Declare Function FreeImage_CloseMultiBitmapInt Lib "FreeImage.dll" Alias "_FreeImage_CloseMultiBitmap@8" ( _ - ByVal Bitmap As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - -Public Declare Function FreeImage_GetPageCount Lib "FreeImage.dll" Alias "_FreeImage_GetPageCount@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Sub FreeImage_AppendPage Lib "FreeImage.dll" Alias "_FreeImage_AppendPage@8" ( _ - ByVal Bitmap As Long, _ - ByVal PageBitmap As Long) - -Public Declare Sub FreeImage_InsertPage Lib "FreeImage.dll" Alias "_FreeImage_InsertPage@12" ( _ - ByVal Bitmap As Long, _ - ByVal Page As Long, _ - ByVal PageBitmap As Long) - -Public Declare Sub FreeImage_DeletePage Lib "FreeImage.dll" Alias "_FreeImage_DeletePage@8" ( _ - ByVal Bitmap As Long, _ - ByVal Page As Long) - -Public Declare Function FreeImage_LockPage Lib "FreeImage.dll" Alias "_FreeImage_LockPage@8" ( _ - ByVal Bitmap As Long, _ - ByVal Page As Long) As Long - -Private Declare Sub FreeImage_UnlockPageInt Lib "FreeImage.dll" Alias "_FreeImage_UnlockPage@12" ( _ - ByVal Bitmap As Long, _ - ByVal PageBitmap As Long, _ - ByVal ApplyChanges As Long) - -Private Declare Function FreeImage_MovePageInt Lib "FreeImage.dll" Alias "_FreeImage_MovePage@12" ( _ - ByVal Bitmap As Long, _ - ByVal TargetPage As Long, _ - ByVal SourcePage As Long) As Long - -Private Declare Function FreeImage_GetLockedPageNumbersInt Lib "FreeImage.dll" Alias "_FreeImage_GetLockedPageNumbers@12" ( _ - ByVal Bitmap As Long, _ - ByRef PagesPtr As Long, _ - ByRef Count As Long) As Long - - -' Memory I/O streams -Public Declare Function FreeImage_OpenMemory Lib "FreeImage.dll" Alias "_FreeImage_OpenMemory@8" ( _ - Optional ByRef Data As Byte, _ - Optional ByVal SizeInBytes As Long) As Long - -Public Declare Function FreeImage_OpenMemoryByPtr Lib "FreeImage.dll" Alias "_FreeImage_OpenMemory@8" ( _ - Optional ByVal DataPtr As Long, _ - Optional ByVal SizeInBytes As Long) As Long - -Public Declare Sub FreeImage_CloseMemory Lib "FreeImage.dll" Alias "_FreeImage_CloseMemory@4" ( _ - ByVal Stream As Long) - -Public Declare Function FreeImage_LoadFromMemory Lib "FreeImage.dll" Alias "_FreeImage_LoadFromMemory@12" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Private Declare Function FreeImage_SaveToMemoryInt Lib "FreeImage.dll" Alias "_FreeImage_SaveToMemory@16" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - -Private Declare Function FreeImage_AcquireMemoryInt Lib "FreeImage.dll" Alias "_FreeImage_AcquireMemory@12" ( _ - ByVal Stream As Long, _ - ByRef DataPtr As Long, _ - ByRef SizeInBytes As Long) As Long - -Public Declare Function FreeImage_TellMemory Lib "FreeImage.dll" Alias "_FreeImage_TellMemory@4" ( _ - ByVal Stream As Long) As Long - -Private Declare Function FreeImage_SeekMemoryInt Lib "FreeImage.dll" Alias "_FreeImage_SeekMemory@12" ( _ - ByVal Stream As Long, _ - ByVal Offset As Long, _ - ByVal Origin As Long) As Long - -Public Declare Function FreeImage_ReadMemory Lib "FreeImage.dll" Alias "_FreeImage_ReadMemory@16" ( _ - ByVal BufferPtr As Long, _ - ByVal Size As Long, _ - ByVal Count As Long, _ - ByVal Stream As Long) As Long - -Public Declare Function FreeImage_WriteMemory Lib "FreeImage.dll" Alias "_FreeImage_WriteMemory@16" ( _ - ByVal BufferPtr As Long, _ - ByVal Size As Long, _ - ByVal Count As Long, _ - ByVal Stream As Long) As Long - -Public Declare Function FreeImage_LoadMultiBitmapFromMemory Lib "FreeImage.dll" Alias "_FreeImage_LoadMultiBitmapFromMemory@12" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - -Public Declare Function FreeImage_SaveMultiBitmapToMemory Lib "FreeImage.dll" Alias "_FreeImage_SaveMultiBitmapToMemory@16" ( _ - ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Long - - -' Compression functions -Public Declare Function FreeImage_ZLibCompress Lib "FreeImage.dll" Alias "_FreeImage_ZLibCompress@16" ( _ - ByVal TargetPtr As Long, _ - ByVal TargetSize As Long, _ - ByVal SourcePtr As Long, _ - ByVal SourceSize As Long) As Long - -Public Declare Function FreeImage_ZLibUncompress Lib "FreeImage.dll" Alias "_FreeImage_ZLibUncompress@16" ( _ - ByVal TargetPtr As Long, _ - ByVal TargetSize As Long, _ - ByVal SourcePtr As Long, _ - ByVal SourceSize As Long) As Long - -Public Declare Function FreeImage_ZLibGZip Lib "FreeImage.dll" Alias "_FreeImage_ZLibGZip@16" ( _ - ByVal TargetPtr As Long, _ - ByVal TargetSize As Long, _ - ByVal SourcePtr As Long, _ - ByVal SourceSize As Long) As Long - -Public Declare Function FreeImage_ZLibGUnzip Lib "FreeImage.dll" Alias "_FreeImage_ZLibGUnzip@16" ( _ - ByVal TargetPtr As Long, _ - ByVal TargetSize As Long, _ - ByVal SourcePtr As Long, _ - ByVal SourceSize As Long) As Long - -Public Declare Function FreeImage_ZLibCRC32 Lib "FreeImage.dll" Alias "_FreeImage_ZLibCRC32@12" ( _ - ByVal CRC As Long, _ - ByVal SourcePtr As Long, _ - ByVal SourceSize As Long) As Long - - -' Helper functions -Private Declare Function FreeImage_IsLittleEndianInt Lib "FreeImage.dll" Alias "_FreeImage_IsLittleEndian@0" () As Long - -Private Declare Function FreeImage_LookupX11ColorInt Lib "FreeImage.dll" Alias "_FreeImage_LookupX11Color@16" ( _ - ByVal Color As String, _ - ByRef Red As Long, _ - ByRef Green As Long, _ - ByRef Blue As Long) As Long - -Private Declare Function FreeImage_LookupSVGColorInt Lib "FreeImage.dll" Alias "_FreeImage_LookupSVGColor@16" ( _ - ByVal Color As String, _ - ByRef Red As Long, _ - ByRef Green As Long, _ - ByRef Blue As Long) As Long - - -'-------------------------------------------------------------------------------- -' Metadata functions -'-------------------------------------------------------------------------------- - -' Tag creation and destruction -Private Declare Function FreeImage_CreateTag Lib "FreeImage.dll" Alias "_FreeImage_CreateTag@0" () As Long - -Private Declare Sub FreeImage_DeleteTag Lib "FreeImage.dll" Alias "_FreeImage_DeleteTag@4" ( _ - ByVal Tag As Long) - -Private Declare Function FreeImage_CloneTag Lib "FreeImage.dll" Alias "_FreeImage_CloneTag@4" ( _ - ByVal Tag As Long) As Long - - -' Tag accessors (only those needed by wrapper functions) -Private Declare Function FreeImage_SetTagKey Lib "FreeImage.dll" Alias "_FreeImage_SetTagKey@8" ( _ - ByVal Tag As Long, _ - ByVal Key As String) As Long - -Private Declare Function FreeImage_SetTagValue Lib "FreeImage.dll" Alias "_FreeImage_SetTagValue@8" ( _ - ByVal Tag As Long, _ - ByVal ValuePtr As Long) As Long - -' Metadata iterator -Public Declare Function FreeImage_FindFirstMetadata Lib "FreeImage.dll" Alias "_FreeImage_FindFirstMetadata@12" ( _ - ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Bitmap As Long, _ - ByRef Tag As Long) As Long - -Private Declare Function FreeImage_FindNextMetadataInt Lib "FreeImage.dll" Alias "_FreeImage_FindNextMetadata@8" ( _ - ByVal hFind As Long, _ - ByRef Tag As Long) As Long - -Public Declare Sub FreeImage_FindCloseMetadata Lib "FreeImage.dll" Alias "_FreeImage_FindCloseMetadata@4" ( _ - ByVal hFind As Long) - -Public Declare Function FreeImage_CloneMetadataInt Lib "FreeImage.dll" Alias "_FreeImage_CloneMetadata@8" ( _ - ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long) As Long - - -' Metadata accessors -Private Declare Function FreeImage_SetMetadataInt Lib "FreeImage.dll" Alias "_FreeImage_SetMetadata@16" ( _ - ByVal Model As Long, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByVal Tag As Long) As Long - -Private Declare Function FreeImage_GetMetadataInt Lib "FreeImage.dll" Alias "_FreeImage_GetMetadata@16" ( _ - ByVal Model As Long, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByRef Tag As Long) As Long - - -' Metadata helper functions -Public Declare Function FreeImage_GetMetadataCount Lib "FreeImage.dll" Alias "_FreeImage_GetMetadataCount@8" ( _ - ByVal Model As Long, _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_TagToStringInt Lib "FreeImage.dll" Alias "_FreeImage_TagToString@12" ( _ - ByVal Model As Long, _ - ByVal Tag As Long, _ - Optional ByVal Make As String = vbNullString) As Long - - -'-------------------------------------------------------------------------------- -' Toolkit functions -'-------------------------------------------------------------------------------- - -' Rotating and flipping -Public Declare Function FreeImage_RotateClassic Lib "FreeImage.dll" Alias "_FreeImage_RotateClassic@12" ( _ - ByVal Bitmap As Long, _ - ByVal Angle As Double) As Long - -Public Declare Function FreeImage_Rotate Lib "FreeImage.dll" Alias "_FreeImage_Rotate@16" ( _ - ByVal Bitmap As Long, _ - ByVal Angle As Double, _ - Optional ByRef Color As Any) As Long - -Private Declare Function FreeImage_RotateExInt Lib "FreeImage.dll" Alias "_FreeImage_RotateEx@48" ( _ - ByVal Bitmap As Long, _ - ByVal Angle As Double, _ - ByVal ShiftX As Double, _ - ByVal ShiftY As Double, _ - ByVal OriginX As Double, _ - ByVal OriginY As Double, _ - ByVal UseMask As Long) As Long - -Private Declare Function FreeImage_FlipHorizontalInt Lib "FreeImage.dll" Alias "_FreeImage_FlipHorizontal@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_FlipVerticalInt Lib "FreeImage.dll" Alias "_FreeImage_FlipVertical@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_JPEGTransformInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGTransform@16" ( _ - ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByVal Perfect As Long) As Long - -Private Declare Function FreeImage_JPEGTransformUInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGTransformU@16" ( _ - ByVal SourceFile As Long, _ - ByVal DestFile As Long, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - ByVal Perfect As Long) As Long - - -' Upsampling and downsampling -Public Declare Function FreeImage_Rescale Lib "FreeImage.dll" Alias "_FreeImage_Rescale@16" ( _ - ByVal Bitmap As Long, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Filter As FREE_IMAGE_FILTER) As Long - -Private Declare Function FreeImage_MakeThumbnailInt Lib "FreeImage.dll" Alias "_FreeImage_MakeThumbnail@12" ( _ - ByVal Bitmap As Long, _ - ByVal MaxPixelSize As Long, _ - Optional ByVal Convert As Long) As Long - - -' Color manipulation -Private Declare Function FreeImage_AdjustCurveInt Lib "FreeImage.dll" Alias "_FreeImage_AdjustCurve@12" ( _ - ByVal Bitmap As Long, _ - ByVal LookupTablePtr As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Long - -Private Declare Function FreeImage_AdjustGammaInt Lib "FreeImage.dll" Alias "_FreeImage_AdjustGamma@12" ( _ - ByVal Bitmap As Long, _ - ByVal Gamma As Double) As Long - -Private Declare Function FreeImage_AdjustBrightnessInt Lib "FreeImage.dll" Alias "_FreeImage_AdjustBrightness@12" ( _ - ByVal Bitmap As Long, _ - ByVal Percentage As Double) As Long - -Private Declare Function FreeImage_AdjustContrastInt Lib "FreeImage.dll" Alias "_FreeImage_AdjustContrast@12" ( _ - ByVal Bitmap As Long, _ - ByVal Percentage As Double) As Long - -Private Declare Function FreeImage_InvertInt Lib "FreeImage.dll" Alias "_FreeImage_Invert@4" ( _ - ByVal Bitmap As Long) As Long - -Private Declare Function FreeImage_GetHistogramInt Lib "FreeImage.dll" Alias "_FreeImage_GetHistogram@12" ( _ - ByVal Bitmap As Long, _ - ByRef HistogramPtr As Long, _ - Optional ByVal Channel As FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK) As Long - -Private Declare Function FreeImage_GetAdjustColorsLookupTableInt Lib "FreeImage.dll" Alias "_FreeImage_GetAdjustColorsLookupTable@32" ( _ - ByVal LookupTablePtr As Long, _ - ByVal Brightness As Double, _ - ByVal Contrast As Double, _ - ByVal Gamma As Double, _ - ByVal Invert As Long) As Long - -Private Declare Function FreeImage_AdjustColorsInt Lib "FreeImage.dll" Alias "_FreeImage_AdjustColors@32" ( _ - ByVal Bitmap As Long, _ - ByVal Brightness As Double, _ - ByVal Contrast As Double, _ - ByVal Gamma As Double, _ - ByVal Invert As Long) As Long - -Private Declare Function FreeImage_ApplyColorMappingInt Lib "FreeImage.dll" Alias "_FreeImage_ApplyColorMapping@24" ( _ - ByVal Bitmap As Long, _ - ByVal SourceColorsPtr As Long, _ - ByVal DestinationColorsPtr As Long, _ - ByVal Count As Long, _ - ByVal IgnoreAlpha As Long, _ - ByVal swap As Long) As Long - -Private Declare Function FreeImage_SwapColorsInt Lib "FreeImage.dll" Alias "_FreeImage_SwapColors@16" ( _ - ByVal Bitmap As Long, _ - ByRef ColorA As RGBQUAD, _ - ByRef ColorB As RGBQUAD, _ - ByVal IgnoreAlpha As Long) As Long - -Private Declare Function FreeImage_SwapColorsByLongInt Lib "FreeImage.dll" Alias "_FreeImage_SwapColors@16" ( _ - ByVal Bitmap As Long, _ - ByRef ColorA As Long, _ - ByRef ColorB As Long, _ - ByVal IgnoreAlpha As Long) As Long - -Private Declare Function FreeImage_ApplyIndexMappingInt Lib "FreeImage.dll" Alias "_FreeImage_ApplyIndexMapping@20" ( _ - ByVal Bitmap As Long, _ - ByVal SourceIndicesPtr As Long, _ - ByVal DestinationIndicesPtr As Long, _ - ByVal Count As Long, _ - ByVal swap As Long) As Long - -Public Declare Function FreeImage_SwapPaletteIndices Lib "FreeImage.dll" Alias "_FreeImage_SwapPaletteIndices@12" ( _ - ByVal Bitmap As Long, _ - ByRef IndexA As Byte, _ - ByRef IndexB As Byte) As Long - -' Channel processing -Public Declare Function FreeImage_GetChannel Lib "FreeImage.dll" Alias "_FreeImage_GetChannel@8" ( _ - ByVal Bitmap As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Long - -Private Declare Function FreeImage_SetChannelInt Lib "FreeImage.dll" Alias "_FreeImage_SetChannel@12" ( _ - ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Long - -Public Declare Function FreeImage_GetComplexChannel Lib "FreeImage.dll" Alias "_FreeImage_GetComplexChannel@8" ( _ - ByVal Bitmap As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Long - -Private Declare Function FreeImage_SetComplexChannelInt Lib "FreeImage.dll" Alias "_FreeImage_SetComplexChannel@12" ( _ - ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Long - - -' Copy / Paste / Composite routines -Public Declare Function FreeImage_Copy Lib "FreeImage.dll" Alias "_FreeImage_Copy@20" ( _ - ByVal Bitmap As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As Long - -Private Declare Function FreeImage_PasteInt Lib "FreeImage.dll" Alias "_FreeImage_Paste@20" ( _ - ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Alpha As Long) As Long - -Public Declare Function FreeImage_Composite Lib "FreeImage.dll" Alias "_FreeImage_Composite@16" ( _ - ByVal Bitmap As Long, _ - Optional ByVal UseFileBackColor As Long, _ - Optional ByRef AppBackColor As Any, _ - Optional ByVal BackgroundBitmap As Long) As Long - -Private Declare Function FreeImage_JPEGCropInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGCrop@24" ( _ - ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As Long - -Private Declare Function FreeImage_JPEGCropUInt Lib "FreeImage.dll" Alias "_FreeImage_JPEGCropU@24" ( _ - ByVal SourceFile As Long, _ - ByVal DestFile As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As Long - -Private Declare Function FreeImage_PreMultiplyWithAlphaInt Lib "FreeImage.dll" Alias "_FreeImage_PreMultiplyWithAlpha@4" ( _ - ByVal Bitmap As Long) As Long - -Public Declare Function FreeImage_FillBackground Lib "FreeImage.dll" Alias "_FreeImage_FillBackground@12" ( _ - ByVal Bitmap As Long, _ - ByRef Color As Any, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS = FI_COLOR_IS_RGB_COLOR) As Long - -Public Declare Function FreeImage_EnlargeCanvas Lib "FreeImage.dll" Alias "_FreeImage_EnlargeCanvas@28" ( _ - ByVal Bitmap As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long, _ - ByRef Color As Any, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS = FI_COLOR_IS_RGB_COLOR) As Long - -Public Declare Function FreeImage_AllocateEx Lib "FreeImage.dll" Alias "_FreeImage_AllocateEx@36" ( _ - ByVal Width As Long, _ - ByVal Height As Long, _ - Optional ByVal BitsPerPixel As Long = 8, _ - Optional ByRef Color As Any, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS, _ - Optional ByVal PalettePtr As Long = 0, _ - Optional ByVal RedMask As Long = 0, _ - Optional ByVal GreenMask As Long = 0, _ - Optional ByVal BlueMask As Long = 0) As Long - -Public Declare Function FreeImage_AllocateExT Lib "FreeImage.dll" Alias "_FreeImage_AllocateExT@36" ( _ - ByVal ImageType As FREE_IMAGE_TYPE, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - Optional ByVal BitsPerPixel As Long = 8, _ - Optional ByRef Color As Any, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS, _ - Optional ByVal PalettePtr As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long) As Long - -' miscellaneous algorithms -Public Declare Function FreeImage_MultigridPoissonSolver Lib "FreeImage.dll" Alias "_FreeImage_MultigridPoissonSolver@8" ( _ - ByVal LaplacianBitmap As Long, _ - Optional ByVal Cyles As Long = 3) As Long - - -'-------------------------------------------------------------------------------- -' Line converting functions -'-------------------------------------------------------------------------------- - -' convert to 4 bpp -Public Declare Sub FreeImage_ConvertLine1To4 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To4@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine8To4 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To8@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine16To4_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To4_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine16To4_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To4_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine24To4 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To24@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine32To4 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine32To4@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - - -' convert to 8 bpp -Public Declare Sub FreeImage_ConvertLine1To8 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To8@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine4To8 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine4To8@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine16To8_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To8_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine16To8_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To8_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine24To8 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine24To8@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine32To8 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine32To8@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - - -' convert to 16 bpp -Public Declare Sub FreeImage_ConvertLine1To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To16_555@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine4To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine4To16_555@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine8To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine8To16_555@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine16_565_To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16_565_To16_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine24To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine24To16_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine32To16_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine32To16_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine1To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To16_565@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine4To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine4To16_565@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine8To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine8To16_565@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine16_555_To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16_555_To16_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine24To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine24To16_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine32To16_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine32To16_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - - -' convert to 24 bpp -Public Declare Sub FreeImage_ConvertLine1To24 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To24@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine4To24 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine4To24@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine8To24 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine8To24@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine16To24_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To24_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine16To24_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To24_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine32To24 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine32To24@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - - -' convert to 32 bpp -Public Declare Sub FreeImage_ConvertLine1To32 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine1To32@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine4To32 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine4To32@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine8To32 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine8To32@16" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long, _ - ByVal PalettePtr As Long) - -Public Declare Sub FreeImage_ConvertLine16To32_555 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To32_555@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine16To32_565 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine16To32_565@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - -Public Declare Sub FreeImage_ConvertLine24To32 Lib "FreeImage.dll" Alias "_FreeImage_ConvertLine24To32@12" ( _ - ByVal TargetPtr As Long, _ - ByVal SourcePtr As Long, _ - ByVal WidthInPixels As Long) - - - -'-------------------------------------------------------------------------------- -' Initialization functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_IsAvailable(Optional ByRef Version As String) As Boolean - - On Error Resume Next - Version = FreeImage_GetVersion() - FreeImage_IsAvailable = (Err.Number = ERROR_SUCCESS) - On Error GoTo 0 - -End Function - - - -'-------------------------------------------------------------------------------- -' Error handling functions -'-------------------------------------------------------------------------------- - -Public Sub FreeImage_InitErrorHandler() - - ' Call this function once for using the FreeImage 3 error handling callback. - ' The 'FreeImage_ErrorHandler' function is called on each FreeImage 3 error. - - Call FreeImage_SetOutputMessage(AddressOf FreeImage_ErrorHandler) - -End Sub - -Private Sub FreeImage_ErrorHandler(ByVal Format As FREE_IMAGE_FORMAT, ByVal Message As Long) - -Dim strErrorMessage As String -Dim strImageFormat As String - - ' This function is called whenever the FreeImage 3 libraray throws an error. - ' Currently this function gets the error message and the format name of the - ' involved image type as VB string printing each to the VB Debug console. Feel - ' free to modify this function to call an error handling routine of your on. - - strErrorMessage = pGetStringFromPointerA(Message) - strImageFormat = FreeImage_GetFormatFromFIF(Format) - - Debug.Print "[FreeImage] Error: " & strErrorMessage - Debug.Print " Image: " & strImageFormat - Debug.Print " Code: " & Format - -End Sub - - - -'-------------------------------------------------------------------------------- -' String returning functions wrappers -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetVersion() As String - - ' This function returns the version of the FreeImage 3 library - ' as VB String. Read paragraph 2 of the "General notes on implementation - ' and design" section to learn more about that technique. - - FreeImage_GetVersion = pGetStringFromPointerA(FreeImage_GetVersionInt) - -End Function - -Public Function FreeImage_GetCopyrightMessage() As String - - ' This function returns the copyright message of the FreeImage 3 library - ' as VB String. Read paragraph 2 of the "General notes on implementation - ' and design" section to learn more about that technique. - - FreeImage_GetCopyrightMessage = pGetStringFromPointerA(FreeImage_GetCopyrightMessageInt) - -End Function - -Public Function FreeImage_GetFormatFromFIF(ByVal Format As FREE_IMAGE_FORMAT) As String - - ' This function returns the result of the 'FreeImage_GetFormatFromFIF' function - ' as VB String. Read paragraph 2 of the "General notes on implementation - ' and design" section to learn more about that technique. - - ' The parameter 'Format' works according to the FreeImage 3 API documentation. - - FreeImage_GetFormatFromFIF = pGetStringFromPointerA(FreeImage_GetFormatFromFIFInt(Format)) - -End Function - -Public Function FreeImage_GetFIFExtensionList(ByVal Format As FREE_IMAGE_FORMAT) As String - - ' This function returns the result of the 'FreeImage_GetFIFExtensionList' function - ' as VB String. Read paragraph 2 of the "General notes on implementation - ' and design" section to learn more about that technique. - - ' The parameter 'Format' works according to the FreeImage 3 API documentation. - - FreeImage_GetFIFExtensionList = pGetStringFromPointerA(FreeImage_GetFIFExtensionListInt(Format)) - -End Function - -Public Function FreeImage_GetFIFDescription(ByVal Format As FREE_IMAGE_FORMAT) As String - - ' This function returns the result of the 'FreeImage_GetFIFDescription' function - ' as VB String. Read paragraph 2 of the "General notes on implementation - ' and design" section to learn more about that technique. - - ' The parameter 'Format' works according to the FreeImage 3 API documentation. - - FreeImage_GetFIFDescription = pGetStringFromPointerA(FreeImage_GetFIFDescriptionInt(Format)) - -End Function - -Public Function FreeImage_GetFIFRegExpr(ByVal Format As FREE_IMAGE_FORMAT) As String - - ' This function returns the result of the 'FreeImage_GetFIFRegExpr' function - ' as VB String. Read paragraph 2 of the "General notes on implementation - ' and design" section to learn more about that technique. - - ' The parameter 'Format' works according to the FreeImage 3 API documentation. - - FreeImage_GetFIFRegExpr = pGetStringFromPointerA(FreeImage_GetFIFRegExprInt(Format)) - -End Function - -Public Function FreeImage_GetFIFMimeType(ByVal Format As FREE_IMAGE_FORMAT) As String - - ' This function returns the result of the 'FreeImage_GetFIFMimeType' function - ' as VB String. Read paragraph 2 of the "General notes on implementation - ' and design" section to learn more about that technique. - - ' The parameter 'Format' works according to the FreeImage 3 API documentation. - - FreeImage_GetFIFMimeType = pGetStringFromPointerA(FreeImage_GetFIFMimeTypeInt(Format)) - -End Function - -Public Function FreeImage_TagToString(ByVal Model As Long, _ - ByVal Tag As Long, _ - Optional ByVal Make As String) As String - - ' This function returns the result of the 'FreeImage_TagToString' function - ' as VB String. Read paragraph 2 of the "General notes on implementation - ' and design" section to learn more about that technique. - - ' All parameters work according to the FreeImage 3 API documentation. - - FreeImage_TagToString = pGetStringFromPointerA(FreeImage_TagToStringInt(Model, Tag, Make)) - -End Function - - - -'-------------------------------------------------------------------------------- -' UNICODE dealing functions wrappers -'-------------------------------------------------------------------------------- - -Public Function FreeImage_LoadU(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As String, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - - ' This function is just a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - FreeImage_LoadU = FreeImage_LoadUInt(Format, StrPtr(Filename), Flags) - -End Function - -Public Function FreeImage_SaveU(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Filename As String, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Boolean - - ' This function is just a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - FreeImage_SaveU = (FreeImage_SaveUInt(Format, Bitmap, StrPtr(Filename), Flags) = 1) - -End Function - -Public Function FreeImage_GetFileTypeU(ByVal Filename As String, _ - Optional ByVal Size As Long = 0) As FREE_IMAGE_FORMAT - - ' This function is just a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - FreeImage_GetFileTypeU = FreeImage_GetFileTypeUInt(StrPtr(Filename), Size) - -End Function - -Public Function FreeImage_GetFIFFromFilenameU(ByVal Filename As String) As FREE_IMAGE_FORMAT - - ' This function is just a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - FreeImage_GetFIFFromFilenameU = FreeImage_GetFIFFromFilenameUInt(StrPtr(Filename)) - -End Function - -Public Function FreeImage_JPEGTransformU(ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - Optional ByVal Perfect As Boolean) As Boolean - -Dim lPerfect As Long - - ' This function is just a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - If (Perfect) Then - lPerfect = 1 - End If - FreeImage_JPEGTransformU = (FreeImage_JPEGTransformInt(StrPtr(SourceFile), StrPtr(DestFile), _ - Operation, lPerfect) = 1) - -End Function - -Public Function FreeImage_JPEGCropU(ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As Boolean - - ' This function is just a thin wrapper to ease the call to an - ' UNICODE function. Since VB's BSTR strings are actually UNICODE - ' strings, we just need to pass the pointer to the string data - ' returned by the (undocumented) function StrPtr(). - - FreeImage_JPEGCropU = (FreeImage_JPEGCropInt(StrPtr(SourceFile), StrPtr(DestFile), Left, Top, _ - Right, Bottom) = 1) - -End Function - - - -'-------------------------------------------------------------------------------- -' BOOL/Boolean returning functions wrappers -'-------------------------------------------------------------------------------- - -Public Function FreeImage_HasPixels(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_HasPixels = (FreeImage_HasPixelsInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_Save(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Filename As String, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_Save = (FreeImage_SaveInt(Format, Bitmap, Filename, Flags) = 1) - -End Function - -Public Function FreeImage_SaveToHandle(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal IO As Long, _ - ByVal Handle As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SaveToHandle = (FreeImage_SaveToHandleInt(Format, Bitmap, IO, Handle, Flags) = 1) - -End Function - -Public Function FreeImage_IsTransparent(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_IsTransparent = (FreeImage_IsTransparentInt(Bitmap) = 1) - -End Function - -Public Sub FreeImage_SetTransparent(ByVal Bitmap As Long, ByVal Value As Boolean) - - If (Value) Then - Call FreeImage_SetTransparentInt(Bitmap, 1) - Else - Call FreeImage_SetTransparentInt(Bitmap, 0) - End If - -End Sub - -Public Function FreeImage_HasBackgroundColor(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_HasBackgroundColor = (FreeImage_HasBackgroundColorInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_GetBackgroundColor(ByVal Bitmap As Long, _ - ByRef BackColor As RGBQUAD) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetBackgroundColor = (FreeImage_GetBackgroundColorInt(Bitmap, BackColor) = 1) - -End Function - -Public Function FreeImage_GetBackgroundColorAsLong(ByVal Bitmap As Long, _ - ByRef BackColor As Long) As Boolean - - ' This function gets the background color of an image as FreeImage_GetBackgroundColor() does but - ' provides it's result as a Long value. - - FreeImage_GetBackgroundColorAsLong = (FreeImage_GetBackgroundColorAsLongInt(Bitmap, BackColor) = 1) - -End Function - -Public Function FreeImage_GetBackgroundColorEx(ByVal Bitmap As Long, _ - ByRef Alpha As Byte, _ - ByRef Red As Byte, _ - ByRef Green As Byte, _ - ByRef Blue As Byte) As Boolean - -Dim bkcolor As RGBQUAD - - ' This function gets the background color of an image as FreeImage_GetBackgroundColor() does but - ' provides it's result as four different byte values, one for each color component. - - FreeImage_GetBackgroundColorEx = (FreeImage_GetBackgroundColorInt(Bitmap, bkcolor) = 1) - With bkcolor - Alpha = .rgbReserved - Red = .rgbRed - Green = .rgbGreen - Blue = .rgbBlue - End With - -End Function - -Public Function FreeImage_SetBackgroundColor(ByVal Bitmap As Long, _ - ByRef BackColor As RGBQUAD) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetBackgroundColor = (FreeImage_SetBackgroundColorInt(Bitmap, BackColor) = 1) - -End Function - -Public Function FreeImage_SetBackgroundColorAsLong(ByVal Bitmap As Long, _ - ByVal BackColor As Long) As Boolean - - ' This function sets the background color of an image as FreeImage_SetBackgroundColor() does but - ' the color value to set must be provided as a Long value. - - FreeImage_SetBackgroundColorAsLong = (FreeImage_SetBackgroundColorAsLongInt(Bitmap, BackColor) = 1) - -End Function - -Public Function FreeImage_SetBackgroundColorEx(ByVal Bitmap As Long, _ - ByVal Alpha As Byte, _ - ByVal Red As Byte, _ - ByVal Green As Byte, _ - ByVal Blue As Byte) As Boolean - -Dim tColor As RGBQUAD - - ' This function sets the color at position (x|y) as FreeImage_SetPixelColor() does but - ' the color value to set must be provided four different byte values, one for each - ' color component. - - With tColor - .rgbReserved = Alpha - .rgbRed = Red - .rgbGreen = Green - .rgbBlue = Blue - End With - FreeImage_SetBackgroundColorEx = (FreeImage_SetBackgroundColorInt(Bitmap, tColor) = 1) - -End Function - -Public Function FreeImage_GetPixelIndex(ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As Byte) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetPixelIndex = (FreeImage_GetPixelIndexInt(Bitmap, X, Y, Value) = 1) - -End Function - -Public Function FreeImage_GetPixelColor(ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As RGBQUAD) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetPixelColor = (FreeImage_GetPixelColorInt(Bitmap, X, Y, Value) = 1) - -End Function - -Public Function FreeImage_GetPixelColorByLong(ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As Long) As Boolean - - ' This function gets the color at position (x|y) as FreeImage_GetPixelColor() does but - ' provides it's result as a Long value. - - FreeImage_GetPixelColorByLong = (FreeImage_GetPixelColorByLongInt(Bitmap, X, Y, Value) = 1) - -End Function - -Public Function FreeImage_GetPixelColorEx(ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Alpha As Byte, _ - ByRef Red As Byte, _ - ByRef Green As Byte, _ - ByRef Blue As Byte) As Boolean - -Dim Value As RGBQUAD - - ' This function gets the color at position (x|y) as FreeImage_GetPixelColor() does but - ' provides it's result as four different byte values, one for each color component. - - FreeImage_GetPixelColorEx = (FreeImage_GetPixelColorInt(Bitmap, X, Y, Value) = 1) - With Value - Alpha = .rgbReserved - Red = .rgbRed - Green = .rgbGreen - Blue = .rgbBlue - End With - -End Function - -Public Function FreeImage_SetPixelIndex(ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As Byte) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetPixelIndex = (FreeImage_SetPixelIndexInt(Bitmap, X, Y, Value) = 1) - -End Function - -Public Function FreeImage_SetPixelColor(ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As RGBQUAD) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetPixelColor = (FreeImage_SetPixelColorInt(Bitmap, X, Y, Value) = 1) - -End Function - -Public Function FreeImage_SetPixelColorByLong(ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByRef Value As Long) As Boolean - - ' This function sets the color at position (x|y) as FreeImage_SetPixelColor() does but - ' the color value to set must be provided as a Long value. - - FreeImage_SetPixelColorByLong = (FreeImage_SetPixelColorByLongInt(Bitmap, X, Y, Value) = 1) - -End Function - -Public Function FreeImage_SetPixelColorEx(ByVal Bitmap As Long, _ - ByVal X As Long, _ - ByVal Y As Long, _ - ByVal Alpha As Byte, _ - ByVal Red As Byte, _ - ByVal Green As Byte, _ - ByVal Blue As Byte) As Boolean - -Dim Value As RGBQUAD - - ' This function sets the color at position (x|y) as FreeImage_SetPixelColor() does but - ' the color value to set must be provided four different byte values, one for each - ' color component. - - With Value - .rgbReserved = Alpha - .rgbRed = Red - .rgbGreen = Green - .rgbBlue = Blue - End With - FreeImage_SetPixelColorEx = (FreeImage_SetPixelColorInt(Bitmap, X, Y, Value) = 1) - -End Function - -Public Function FreeImage_FIFSupportsReading(ByVal Format As FREE_IMAGE_FORMAT) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsReading = (FreeImage_FIFSupportsReadingInt(Format) = 1) - -End Function - -Public Function FreeImage_FIFSupportsWriting(ByVal Format As FREE_IMAGE_FORMAT) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsWriting = (FreeImage_FIFSupportsWritingInt(Format) = 1) - -End Function - -Public Function FreeImage_FIFSupportsExportType(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal ImageType As FREE_IMAGE_TYPE) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsExportType = (FreeImage_FIFSupportsExportTypeInt(Format, ImageType) = 1) - -End Function - -Public Function FreeImage_FIFSupportsExportBPP(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal BitsPerPixel As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsExportBPP = (FreeImage_FIFSupportsExportBPPInt(Format, BitsPerPixel) = 1) - -End Function - -Public Function FreeImage_FIFSupportsICCProfiles(ByVal Format As FREE_IMAGE_FORMAT) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsICCProfiles = (FreeImage_FIFSupportsICCProfilesInt(Format) = 1) - -End Function - -Public Function FreeImage_FIFSupportsNoPixels(ByVal Format As FREE_IMAGE_FORMAT) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FIFSupportsNoPixels = (FreeImage_FIFSupportsNoPixelsInt(Format) = 1) - -End Function - -Public Function FreeImage_CloseMultiBitmap(ByVal Bitmap As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_CloseMultiBitmap = (FreeImage_CloseMultiBitmapInt(Bitmap, Flags) = 1) - -End Function - -Public Function FreeImage_MovePage(ByVal Bitmap As Long, _ - ByVal TargetPage As Long, _ - ByVal SourcePage As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_MovePage = (FreeImage_MovePageInt(Bitmap, TargetPage, SourcePage) = 1) - -End Function - -Public Function FreeImage_GetLockedPageNumbers(ByVal Bitmap As Long, _ - ByRef PagesPtr As Long, _ - ByRef Count As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetLockedPageNumbers = (FreeImage_GetLockedPageNumbersInt(Bitmap, PagesPtr, Count) = 1) - -End Function - -Public Function FreeImage_SaveToMemory(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByVal Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SaveToMemory = (FreeImage_SaveToMemoryInt(Format, Bitmap, Stream, Flags) = 1) - -End Function - -Public Function FreeImage_AcquireMemory(ByVal Stream As Long, _ - ByRef DataPtr As Long, _ - ByRef SizeInBytes As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_AcquireMemory = (FreeImage_AcquireMemoryInt(Stream, DataPtr, SizeInBytes) = 1) - -End Function - -Public Function FreeImage_SeekMemory(ByVal Stream As Long, _ - ByVal Offset As Long, _ - ByVal Origin As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SeekMemory = (FreeImage_SeekMemoryInt(Stream, Offset, Origin) = 1) - -End Function - -Public Function FreeImage_IsLittleEndian() As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_IsLittleEndian = (FreeImage_IsLittleEndianInt() = 1) - -End Function - -Public Function FreeImage_LookupX11Color(ByVal Color As String, _ - ByRef Red As Long, _ - ByRef Green As Long, _ - ByRef Blue As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_LookupX11Color = (FreeImage_LookupX11ColorInt(Color, Red, Green, Blue) = 1) - -End Function - -Public Function FreeImage_LookupSVGColor(ByVal Color As String, _ - ByRef Red As Long, _ - ByRef Green As Long, _ - ByRef Blue As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_LookupSVGColor = (FreeImage_LookupSVGColorInt(Color, Red, Green, Blue) = 1) - -End Function - -Public Function FreeImage_FindNextMetadata(ByVal hFind As Long, _ - ByRef Tag As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FindNextMetadata = (FreeImage_FindNextMetadataInt(hFind, Tag) = 1) - -End Function - -Public Function FreeImage_CloneMetadata(ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_CloneMetadata = (FreeImage_CloneMetadataInt(BitmapDst, BitmapSrc) = 1) - -End Function - -Public Function FreeImage_GetMetadata(ByRef Model As Long, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByVal Tag As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetMetadata = (FreeImage_GetMetadataInt(Model, Bitmap, Key, Tag) = 1) - -End Function - -Public Function FreeImage_SetMetadata(ByRef Model As Long, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByVal Tag As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetMetadata = (FreeImage_SetMetadataInt(Model, Bitmap, Key, Tag) = 1) - -End Function - -Public Function FreeImage_FlipHorizontal(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FlipHorizontal = (FreeImage_FlipHorizontalInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_FlipVertical(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FlipVertical = (FreeImage_FlipVerticalInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_JPEGTransform(ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Operation As FREE_IMAGE_JPEG_OPERATION, _ - Optional ByVal Perfect As Boolean) As Boolean - -Dim lPerfect As Long - - ' Thin wrapper function returning a real VB Boolean value - - If (Perfect) Then - lPerfect = 1 - End If - FreeImage_JPEGTransform = (FreeImage_JPEGTransformInt(SourceFile, DestFile, Operation, lPerfect) = 1) - -End Function - -Public Function FreeImage_AdjustCurve(ByVal Bitmap As Long, _ - ByVal LookupTablePtr As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_AdjustCurve = (FreeImage_AdjustCurveInt(Bitmap, LookupTablePtr, Channel) = 1) - -End Function - -Public Function FreeImage_AdjustGamma(ByVal Bitmap As Long, _ - ByVal Gamma As Double) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_AdjustGamma = (FreeImage_AdjustGammaInt(Bitmap, Gamma) = 1) - -End Function - -Public Function FreeImage_AdjustBrightness(ByVal Bitmap As Long, _ - ByVal Percentage As Double) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_AdjustBrightness = (FreeImage_AdjustBrightnessInt(Bitmap, Percentage) = 1) - -End Function - -Public Function FreeImage_AdjustContrast(ByVal Bitmap As Long, _ - ByVal Percentage As Double) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_AdjustContrast = (FreeImage_AdjustContrastInt(Bitmap, Percentage) = 1) - -End Function - -Public Function FreeImage_Invert(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_Invert = (FreeImage_InvertInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_GetHistogram(ByVal Bitmap As Long, _ - ByRef HistogramPtr As Long, _ - Optional ByVal Channel As FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_GetHistogram = (FreeImage_GetHistogramInt(Bitmap, HistogramPtr, Channel) = 1) - -End Function - -Public Function FreeImage_AdjustColors(ByVal Bitmap As Long, _ - Optional ByVal Brightness As Double, _ - Optional ByVal Contrast As Double, _ - Optional ByVal Gamma As Double = 1, _ - Optional ByVal Invert As Boolean) As Boolean - -Dim lInvert As Long - - ' Thin wrapper function returning a real VB Boolean value - If (Invert) Then - lInvert = 1 - End If - FreeImage_AdjustColors = (FreeImage_AdjustColorsInt(Bitmap, Brightness, Contrast, Gamma, lInvert) = 1) - -End Function - -Public Function FreeImage_SetChannel(ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetChannel = (FreeImage_SetChannelInt(BitmapDst, BitmapSrc, Channel) = 1) - -End Function - -Public Function FreeImage_SetComplexChannel(ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_SetComplexChannel = (FreeImage_SetComplexChannelInt(BitmapDst, BitmapSrc, Channel) = 1) - -End Function - -Public Function FreeImage_Paste(ByVal BitmapDst As Long, _ - ByVal BitmapSrc As Long, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Alpha As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_Paste = (FreeImage_PasteInt(BitmapDst, BitmapSrc, Left, Top, Alpha) = 1) - -End Function - -Public Function FreeImage_PreMultiplyWithAlpha(ByVal Bitmap As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_PreMultiplyWithAlpha = (FreeImage_PreMultiplyWithAlphaInt(Bitmap) = 1) - -End Function - -Public Function FreeImage_JPEGCrop(ByVal SourceFile As String, _ - ByVal DestFile As String, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_JPEGCrop = (FreeImage_JPEGCropInt(SourceFile, DestFile, Left, Top, Right, Bottom) = 1) - -End Function - -Public Function FreeImage_FillBackgroundEx(ByVal Bitmap As Long, _ - ByRef Color As RGBQUAD, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FillBackgroundEx = (FreeImage_FillBackground(Bitmap, Color, Options) = 1) - -End Function - -Public Function FreeImage_FillBackgroundByLong(ByVal Bitmap As Long, _ - ByRef Color As Long, _ - Optional ByVal Options As FREE_IMAGE_COLOR_OPTIONS) As Boolean - - ' Thin wrapper function returning a real VB Boolean value - - FreeImage_FillBackgroundByLong = (FreeImage_FillBackground(Bitmap, Color, Options) = 1) - -End Function - -Public Function FreeImage_OpenMultiBitmap(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As String, _ - Optional ByVal CreateNew As Boolean, _ - Optional ByVal ReadOnly As Boolean, _ - Optional ByVal KeepCacheInMemory As Boolean, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS) As Long - - FreeImage_OpenMultiBitmap = FreeImage_OpenMultiBitmapInt(Format, Filename, IIf(CreateNew, 1, 0), _ - IIf(ReadOnly And Not CreateNew, 1, 0), IIf(KeepCacheInMemory, 1, 0), Flags) - -End Function - -Public Sub FreeImage_UnlockPage(ByVal Bitmap As Long, ByVal PageBitmap As Long, ByVal ApplyChanges As Boolean) - -Dim lApplyChanges As Long - - If (ApplyChanges) Then - lApplyChanges = 1 - End If - Call FreeImage_UnlockPageInt(Bitmap, PageBitmap, lApplyChanges) - -End Sub - -Public Function FreeImage_RotateEx(ByVal Bitmap As Long, _ - ByVal Angle As Double, _ - Optional ByVal ShiftX As Double, _ - Optional ByVal ShiftY As Double, _ - Optional ByVal OriginX As Double, _ - Optional ByVal OriginY As Double, _ - Optional ByVal UseMask As Boolean) As Long - -Dim lUseMask As Long - - If (UseMask) Then - lUseMask = 1 - End If - FreeImage_RotateEx = FreeImage_RotateExInt(Bitmap, Angle, ShiftX, ShiftY, OriginX, OriginY, lUseMask) - -End Function - -Public Function FreeImage_MakeThumbnail(ByVal Bitmap As Long, _ - ByVal MaxPixelSize As Long, _ - Optional ByVal Convert As Boolean) As Long - -Dim lConvert As Long - - If (Convert) Then - lConvert = 1 - End If - FreeImage_MakeThumbnail = FreeImage_MakeThumbnailInt(Bitmap, MaxPixelSize, lConvert) - -End Function - -Public Function FreeImage_GetAdjustColorsLookupTable(ByVal LookupTablePtr As Long, _ - Optional ByVal Brightness As Double, _ - Optional ByVal Contrast As Double, _ - Optional ByVal Gamma As Double, _ - Optional ByVal Invert As Boolean) As Long - -Dim lInvert As Long - - If (Invert) Then - lInvert = 1 - End If - FreeImage_GetAdjustColorsLookupTable = FreeImage_GetAdjustColorsLookupTableInt(LookupTablePtr, _ - Brightness, Contrast, Gamma, lInvert) - -End Function - -Public Function FreeImage_ApplyColorMapping(ByVal Bitmap As Long, _ - ByVal SourceColorsPtr As Long, _ - ByVal DestinationColorsPtr As Long, _ - ByVal Count As Long, _ - Optional ByVal IgnoreAlpha As Boolean = True, _ - Optional ByVal swap As Boolean) As Long - -Dim lIgnoreAlpha As Long -Dim lSwap As Long - - If (IgnoreAlpha) Then - lIgnoreAlpha = 1 - End If - If (swap) Then - lSwap = 1 - End If - FreeImage_ApplyColorMapping = FreeImage_ApplyColorMappingInt(Bitmap, SourceColorsPtr, _ - DestinationColorsPtr, Count, lIgnoreAlpha, lSwap) - -End Function - -Public Function FreeImage_SwapColors(ByVal Bitmap As Long, _ - ByRef ColorA As RGBQUAD, _ - ByRef ColorB As RGBQUAD, _ - Optional ByVal IgnoreAlpha As Boolean = True) As Long - -Dim lIgnoreAlpha As Long - - If (IgnoreAlpha) Then - lIgnoreAlpha = 1 - End If - FreeImage_SwapColors = FreeImage_SwapColorsInt(Bitmap, ColorA, ColorB, lIgnoreAlpha) - -End Function - -Public Function FreeImage_SwapColorsByLong(ByVal Bitmap As Long, _ - ByRef ColorA As Long, _ - ByRef ColorB As Long, _ - Optional ByVal IgnoreAlpha As Boolean = True) As Long - -Dim lIgnoreAlpha As Long - - If (IgnoreAlpha) Then - lIgnoreAlpha = 1 - End If - FreeImage_SwapColorsByLong = FreeImage_SwapColorsByLongInt(Bitmap, ColorA, ColorB, _ - lIgnoreAlpha) - -End Function - -Public Function FreeImage_ApplyIndexMapping(ByVal Bitmap As Long, _ - ByVal SourceIndicesPtr As Long, _ - ByVal DestinationIndicesPtr As Long, _ - ByVal Count As Long, _ - Optional ByVal swap As Boolean) As Long - -Dim lSwap As Long - - If (swap) Then - lSwap = 1 - End If - FreeImage_ApplyIndexMapping = FreeImage_ApplyIndexMappingInt(Bitmap, SourceIndicesPtr, _ - DestinationIndicesPtr, Count, lSwap) - -End Function - -Public Function FreeImage_ConvertFromRawBits(ByVal BitsPtr As Long, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long, _ - Optional ByVal TopDown As Boolean) As Long - -Dim lTopDown As Long - - If (TopDown) Then - lTopDown = 1 - End If - FreeImage_ConvertFromRawBits = FreeImage_ConvertFromRawBitsInt(BitsPtr, Width, Height, Pitch, _ - BitsPerPixel, RedMask, GreenMask, BlueMask, lTopDown) - -End Function - -Public Sub FreeImage_ConvertToRawBits(ByVal BitsPtr As Long, _ - ByVal Bitmap As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long, _ - Optional ByVal TopDown As Boolean) - -Dim lTopDown As Long - - If (TopDown) Then - lTopDown = 1 - End If - Call FreeImage_ConvertToRawBitsInt(BitsPtr, Bitmap, Pitch, _ - BitsPerPixel, RedMask, GreenMask, BlueMask, lTopDown) - -End Sub - -Public Function FreeImage_ConvertToStandardType(ByVal Bitmap As Long, _ - Optional ByVal ScaleLinear As Boolean = True) As Long - - If (ScaleLinear) Then - FreeImage_ConvertToStandardType = FreeImage_ConvertToStandardTypeInt(Bitmap, 1) - Else - FreeImage_ConvertToStandardType = FreeImage_ConvertToStandardTypeInt(Bitmap, 0) - End If - -End Function - -Public Function FreeImage_ConvertToType(ByVal Bitmap As Long, _ - ByVal DestinationType As FREE_IMAGE_TYPE, _ - Optional ByVal ScaleLinear As Boolean = True) As Long - - If (ScaleLinear) Then - FreeImage_ConvertToType = FreeImage_ConvertToTypeInt(Bitmap, DestinationType, 1) - Else - FreeImage_ConvertToType = FreeImage_ConvertToTypeInt(Bitmap, DestinationType, 0) - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' Color conversion helper functions -'-------------------------------------------------------------------------------- - -Public Function ConvertColor(ByVal Color As Long) As Long - - ' This helper function converts a VB-style color value (like vbRed), which - ' uses the ABGR format into a RGBQUAD compatible color value, using the ARGB - ' format, needed by FreeImage and vice versa. - - ConvertColor = ((Color And &HFF000000) Or _ - ((Color And &HFF&) * &H10000) Or _ - ((Color And &HFF00&)) Or _ - ((Color And &HFF0000) \ &H10000)) - -End Function - -Public Function ConvertOleColor(ByVal Color As OLE_COLOR) As Long - - ' This helper function converts an OLE_COLOR value (like vbButtonFace), which - ' uses the BGR format into a RGBQUAD compatible color value, using the ARGB - ' format, needed by FreeImage. - - ' This function generally ingnores the specified color's alpha value but, in - ' contrast to ConvertColor, also has support for system colors, which have the - ' format &H80bbggrr. - - ' You should not use this function to convert any color provided by FreeImage - ' in ARGB format into a VB-style ABGR color value. Use function ConvertColor - ' instead. - -Dim lColorRef As Long - - If (OleTranslateColor(Color, 0, lColorRef) = 0) Then - ConvertOleColor = ConvertColor(lColorRef) - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' Extended functions derived from FreeImage 3 functions usually dealing -' with arrays -'-------------------------------------------------------------------------------- - -Public Sub FreeImage_UnloadEx(ByRef Bitmap As Long) - - ' Extended version of FreeImage_Unload, which additionally sets the - ' passed Bitmap handle to zero after unloading. - - If (Bitmap <> 0) Then - Call FreeImage_Unload(Bitmap) - Bitmap = 0 - End If - -End Sub - -Public Function FreeImage_GetPaletteEx(ByVal Bitmap As Long) As RGBQUAD() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a VB style array of type RGBQUAD, containing - ' the palette data of the Bitmap. This array provides read and write access - ' to the actual palette data provided by FreeImage. This is done by - ' creating a VB array with an own SAFEARRAY descriptor making the - ' array point to the palette pointer returned by FreeImage_GetPalette(). - - ' This makes you use code like you would in C/C++: - - ' // this code assumes there is a bitmap loaded and - ' // present in a variable called dib - ' if(FreeImage_GetBPP(Bitmap) == 8) { - ' // Build a greyscale palette - ' RGBQUAD *pal = FreeImage_GetPalette(Bitmap); - ' for (int i = 0; i < 256; i++) { - ' pal[i].rgbRed = i; - ' pal[i].rgbGreen = i; - ' pal[i].rgbBlue = i; - ' } - - ' As in C/C++ the array is only valid while the DIB is loaded and the - ' palette data remains where the pointer returned by FreeImage_GetPalette - ' has pointed to when this function was called. So, a good thing would - ' be, not to keep the returned array in scope over the lifetime of the - ' Bitmap. Best practise is, to use this function within another routine and - ' assign the return value (the array) to a local variable only. As soon - ' as this local variable goes out of scope (when the calling function - ' returns to it's caller), the array and the descriptor is automatically - ' cleaned up by VB. - - ' This function does not make a deep copy of the palette data, but only - ' wraps a VB array around the FreeImage palette data. So, it can be called - ' frequently "on demand" or somewhat "in place" without a significant - ' performance loss. - - ' To learn more about this technique I recommend reading chapter 2 (Leveraging - ' Arrays) of Matthew Curland's book "Advanced Visual Basic 6" - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the FreeImage_DestroyLockedArrayRGBQUAD() function. - - - If (Bitmap) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes of RGBQUAD structure - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetColorsUsed(Bitmap) ' the number of elements in the array is - ' the number of used colors in the Bitmap - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetPalette(Bitmap) ' let the array point to the memory block, the - ' FreeImage palette pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(1, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named as the function is an array variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetPaletteEx), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetPaletteExClone(ByVal Bitmap As Long) As RGBQUAD() - -Dim lColors As Long -Dim atPal() As RGBQUAD - - ' This function returns a redundant clone of a Bitmap's palette as a - ' VB style array of type RGBQUAD. - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - lColors = FreeImage_GetColorsUsed(Bitmap) - If (lColors > 0) Then - ReDim atPal(lColors - 1) - Call CopyMemory(atPal(0), ByVal FreeImage_GetPalette(Bitmap), lColors * 4) - Call pSwap(ByVal VarPtrArray(atPal), ByVal VarPtrArray(FreeImage_GetPaletteExClone)) - End If - -End Function - -Public Function FreeImage_GetPaletteExLong(ByVal Bitmap As Long) As Long() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a VB style array of type Long, containing - ' the palette data of the Bitmap. This array provides read and write access - ' to the actual palette data provided by FreeImage. This is done by - ' creating a VB array with an own SAFEARRAY descriptor making the - ' array point to the palette pointer returned by FreeImage_GetPalette(). - - ' The function actually returns an array of type RGBQUAD with each - ' element packed into a Long. This is possible, since the RGBQUAD - ' structure is also four bytes in size. Palette data, stored in an - ' array of type Long may be passed ByRef to a function through an - ' optional paremeter. For an example have a look at function - ' FreeImage_ConvertColorDepth() - - ' This makes you use code like you would in C/C++: - - ' // this code assumes there is a bitmap loaded and - ' // present in a variable called dib - ' if(FreeImage_GetBPP(Bitmap) == 8) { - ' // Build a greyscale palette - ' RGBQUAD *pal = FreeImage_GetPalette(Bitmap); - ' for (int i = 0; i < 256; i++) { - ' pal[i].rgbRed = i; - ' pal[i].rgbGreen = i; - ' pal[i].rgbBlue = i; - ' } - - ' As in C/C++ the array is only valid while the DIB is loaded and the - ' palette data remains where the pointer returned by FreeImage_GetPalette() - ' has pointed to when this function was called. So, a good thing would - ' be, not to keep the returned array in scope over the lifetime of the - ' Bitmap. Best practise is, to use this function within another routine and - ' assign the return value (the array) to a local variable only. As soon - ' as this local variable goes out of scope (when the calling function - ' returns to it's caller), the array and the descriptor is automatically - ' cleaned up by VB. - - ' This function does not make a deep copy of the palette data, but only - ' wraps a VB array around the FreeImage palette data. So, it can be called - ' frequently "on demand" or somewhat "in place" without a significant - ' performance loss. - - ' To learn more about this technique I recommend reading chapter 2 (Leveraging - ' Arrays) of Matthew Curland's book "Advanced Visual Basic 6" - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - - If (Bitmap) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes of RGBQUAD structure - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetColorsUsed(Bitmap) ' the number of elements in the array is - ' the number of used colors in the Bitmap - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetPalette(Bitmap) ' let the array point to the memory block, the - ' FreeImage palette pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(1, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named as the function is an array variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetPaletteExLong), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetPaletteExLongClone(ByVal Bitmap As Long) As Long() - -Dim lColors As Long -Dim alPal() As Long - - ' This function returns a redundant clone of a Bitmap's palette as a - ' VB style array of type Long. - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - lColors = FreeImage_GetColorsUsed(Bitmap) - If (lColors > 0) Then - ReDim alPal(lColors - 1) - Call CopyMemory(alPal(0), ByVal FreeImage_GetPalette(Bitmap), lColors * 4) - Call pSwap(ByVal VarPtrArray(alPal), ByVal VarPtrArray(FreeImage_GetPaletteExLongClone)) - End If - -End Function - -Public Function FreeImage_SetPalette(ByVal Bitmap As Long, ByRef Palette() As RGBQUAD) As Long - - ' This function sets the palette of a palletised bitmap using a RGBQUAD array. Does - ' nothing on high color bitmaps. - - ' This operation makes a deep copy of the provided palette data so, after this function - ' has returned, changes to the RGBQUAD array are no longer reflected by the bitmap's - ' palette. - - FreeImage_SetPalette = FreeImage_GetColorsUsed(Bitmap) - If (FreeImage_SetPalette > 0) Then - Call CopyMemory(ByVal FreeImage_GetPalette(Bitmap), Palette(0), FreeImage_SetPalette * 4) - End If - -End Function - -Public Function FreeImage_SetPaletteLong(ByVal Bitmap As Long, ByRef Palette() As Long) As Long - - ' This function sets the palette of a palletised bitmap using a RGBQUAD array. Does - ' nothing on high color bitmaps. - - ' This operation makes a deep copy of the provided palette data so, after this function - ' has returned, changes to the Long array are no longer reflected by the bitmap's - ' palette. - - FreeImage_SetPaletteLong = FreeImage_GetColorsUsed(Bitmap) - If (FreeImage_SetPaletteLong > 0) Then - Call CopyMemory(ByVal FreeImage_GetPalette(Bitmap), Palette(0), FreeImage_SetPaletteLong * 4) - End If - -End Function - -Public Function FreeImage_GetTransparencyTableEx(ByVal Bitmap As Long) As Byte() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a VB style Byte array, containing the transparency - ' table of the Bitmap. This array provides read and write access to the actual - ' transparency table provided by FreeImage. This is done by creating a VB array - ' with an own SAFEARRAY descriptor making the array point to the transparency - ' table pointer returned by FreeImage_GetTransparencyTable(). - - ' This makes you use code like you would in C/C++: - - ' // this code assumes there is a bitmap loaded and - ' // present in a variable called dib - ' if(FreeImage_GetBPP(Bitmap) == 8) { - ' // Remove transparency information - ' byte *transt = FreeImage_GetTransparencyTable(Bitmap); - ' for (int i = 0; i < 256; i++) { - ' transt[i].rgbRed = 255; - ' } - - ' As in C/C++ the array is only valid while the DIB is loaded and the transparency - ' table remains where the pointer returned by FreeImage_GetTransparencyTable() has - ' pointed to when this function was called. So, a good thing would be, not to keep - ' the returned array in scope over the lifetime of the DIB. Best practise is, to use - ' this function within another routine and assign the return value (the array) to a - ' local variable only. As soon as this local variable goes out of scope (when the - ' calling function returns to it's caller), the array and the descriptor is - ' automatically cleaned up by VB. - - ' This function does not make a deep copy of the transparency table, but only - ' wraps a VB array around the FreeImage transparency table. So, it can be called - ' frequently "on demand" or somewhat "in place" without a significant - ' performance loss. - - ' To learn more about this technique I recommend reading chapter 2 (Leveraging - ' Arrays) of Matthew Curland's book "Advanced Visual Basic 6" - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the FreeImage_DestroyLockedArray() function. - - - If (Bitmap) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 1 ' size in bytes of a byte element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetTransparencyCount(Bitmap) ' the number of elements in the array is - ' equal to the number transparency table entries - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetTransparencyTable(Bitmap) ' let the array point to the memory block, the - ' FreeImage transparency table pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(1, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor(); lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named as the function is an array variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetTransparencyTableEx), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetTransparencyTableExClone(ByVal Bitmap As Long) As Byte() - -Dim abBuffer() As Byte -Dim lpTransparencyTable As Long -Dim lEntries As Long - - ' This function returns a copy of a DIB's transparency table as VB style - ' array of type Byte. So, the array provides read access only from the DIB's - ' point of view. - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - lpTransparencyTable = FreeImage_GetTransparencyTable(Bitmap) - If (lpTransparencyTable) Then - lEntries = FreeImage_GetTransparencyCount(Bitmap) - If (lEntries > 0) Then - ReDim abBuffer(lEntries - 1) - Call CopyMemory(abBuffer(0), ByVal lpTransparencyTable, lEntries) - Call pSwap(ByVal VarPtrArray(abBuffer), ByVal VarPtrArray( _ - FreeImage_GetTransparencyTableExClone)) - End If - End If - -End Function - -Public Sub FreeImage_SetTransparencyTableEx(ByVal Bitmap As Long, _ - ByRef Table() As Byte, _ - Optional ByRef Count As Long = -1) - - ' This function sets a DIB's transparency table to the contents of the - ' parameter table(). When the optional parameter Count is omitted, the - ' number of entries used is taken from the number of elements stored in - ' the array, but will never be never greater than 256. - - ' The parameter 'Bitmap' works according to the FreeImage 3 API documentation. - - If ((Count > UBound(Table) + 1) Or _ - (Count < 0)) Then - Count = UBound(Table) + 1 - End If - - If (Count > 256) Then - Count = 256 - End If - - Call FreeImage_SetTransparencyTable(Bitmap, VarPtr(Table(0)), Count) - -End Sub - -Public Function FreeImage_IsTransparencyTableTransparent(ByVal Bitmap As Long) As Boolean - -Dim abTransTable() As Byte -Dim i As Long - - ' This function checks whether a Bitmap's transparency table contains any transparent - ' colors or not. - - ' When an image has a transparency table and is transparent, what can be tested - ' with 'FreeImage_IsTransparent()', the image still may display opaque when there - ' are no transparent colors defined in the image's transparency table. This - ' function reads the Bitmap's transparency table directly to determine whether - ' there are transparent colors defined or not. - - ' The return value of this function does not relay on the image's transparency - ' setting but only on the image's transparency table - - If (Bitmap) Then - abTransTable = FreeImage_GetTransparencyTableEx(Bitmap) - For i = 0 To UBound(abTransTable) - FreeImage_IsTransparencyTableTransparent = (abTransTable(i) < 255) - If (FreeImage_IsTransparencyTableTransparent) Then - Exit For - End If - Next i - End If - -End Function - -Public Function FreeImage_GetAdjustColorsLookupTableEx(ByRef LookupTable() As Byte, _ - Optional ByVal Brightness As Double, _ - Optional ByVal Contrast As Double, _ - Optional ByVal Gamma As Double = 1, _ - Optional ByVal Invert As Boolean) As Long - - ' This function is an extended wrapper for FreeImage_GetAdjustColorsLookupTable(), which - ' takes a real VB style Byte array LUT() to receive the created lookup table. The LUT() - ' parameter must not be fixed sized or locked, since it is (re-)dimensioned in this - ' function to contain 256 entries. - - ' All parameters work according to the FreeImage 3 API documentation. - - ReDim LookupTable(255) - FreeImage_GetAdjustColorsLookupTableEx = _ - FreeImage_GetAdjustColorsLookupTable(VarPtr(LookupTable(0)), Brightness, Contrast, _ - Gamma, Invert) - -End Function - -Public Function FreeImage_ApplyColorMappingEx(ByVal Bitmap As Long, _ - ByRef SourceColors() As RGBQUAD, _ - ByRef DestinationColors() As RGBQUAD, _ - Optional ByRef Count As Long = -1, _ - Optional ByVal IgnoreAlpha As Boolean = True, _ - Optional ByVal swap As Boolean) As Long - -Dim nsrc As Long -Dim ndst As Long - - ' This function is an extended wrapper for FreeImage_ApplyColorMapping(), which takes - ' real VB style RGBQUAD arrays for source and destination colors along with an optional - ' ByRef Count parameter. - - ' If 'Count' is omitted upon entry, the number of entries of the smaller of both arrays - ' is used for 'Count' and also passed back to the caller, due to this parameter's ByRef - ' nature. - - ' All other parameters work according to the FreeImage 3 API documentation. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to map colors on a 'header-only' bitmap.") - End If - - nsrc = UBound(SourceColors) + 1 - ndst = UBound(DestinationColors) + 1 - If (Count = -1) Then - If (nsrc < ndst) Then - Count = nsrc - Else - Count = ndst - End If - Else - If (Count < nsrc) Then - Count = nsrc - End If - If (Count < ndst) Then - Count = ndst - End If - End If - - FreeImage_ApplyColorMappingEx = FreeImage_ApplyColorMapping(Bitmap, _ - VarPtr(SourceColors(0)), VarPtr(DestinationColors(0)), Count, IgnoreAlpha, swap) - End If - -End Function - -Public Function FreeImage_ApplyIndexMappingEx(ByVal Bitmap As Long, _ - ByRef SourceIndices() As Byte, _ - ByRef DestinationIndices() As Byte, _ - Optional ByRef Count As Long = -1, _ - Optional ByVal swap As Boolean) As Long - -Dim nsrc As Long -Dim ndst As Long - - ' This function is an extended wrapper for FreeImage_ApplyIndexMapping(), which takes - ' real VB style Byte arrays for source and destination indices along with an optional - ' ByRef count parameter. - - ' If 'Count' is omitted upon entry, the number of entries of the smaller of both arrays - ' is used for 'Count' and also passed back to the caller, due to this parameter's ByRef - ' nature. - - ' All other parameters work according to the FreeImage 3 API documentation. - - - nsrc = UBound(SourceIndices) + 1 - ndst = UBound(DestinationIndices) + 1 - If (Count = -1) Then - If (nsrc < ndst) Then - Count = nsrc - Else - Count = ndst - End If - Else - If (Count < nsrc) Then - Count = nsrc - End If - If (Count < ndst) Then - Count = ndst - End If - End If - - FreeImage_ApplyIndexMappingEx = FreeImage_ApplyIndexMapping(Bitmap, _ - VarPtr(SourceIndices(0)), VarPtr(DestinationIndices(0)), Count, swap) - -End Function - -Public Function FreeImage_ConvertFromRawBitsEx(ByRef Bits() As Byte, _ - ByVal Width As Long, _ - ByVal Height As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long, _ - Optional ByVal TopDown As Boolean) As Long - - FreeImage_ConvertFromRawBitsEx = FreeImage_ConvertFromRawBits(VarPtr(Bits(0)), Width, Height, Pitch, _ - BitsPerPixel, RedMask, GreenMask, BlueMask, TopDown) - -End Function - -Public Sub FreeImage_ConvertToRawBitsEx(ByRef Bits() As Byte, _ - ByVal Bitmap As Long, _ - ByVal Pitch As Long, _ - ByVal BitsPerPixel As Long, _ - Optional ByVal RedMask As Long, _ - Optional ByVal GreenMask As Long, _ - Optional ByVal BlueMask As Long, _ - Optional ByVal TopDown As Boolean) - -Dim lHeight As Long - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to convert a 'header-only' bitmap.") - End If - - If (Pitch > 0) Then - lHeight = FreeImage_GetHeight(Bitmap) - ReDim Bits((Pitch * lHeight) - 1) - Call FreeImage_ConvertToRawBits(VarPtr(Bits(0)), Bitmap, Pitch, _ - BitsPerPixel, RedMask, GreenMask, BlueMask, TopDown) - End If - End If - -End Sub - -Public Function FreeImage_GetHistogramEx(ByVal Bitmap As Long, _ - Optional ByVal Channel As FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK, _ - Optional ByRef Success As Boolean) As Long() - -Dim alResult() As Long - - ' This function returns a DIB's histogram data as VB style array of - ' type Long. Since histogram data is never modified directly, it seems - ' enough to return a clone of the data and no read/write accessible - ' array wrapped around the actual pointer. - - ' All parameters work according to the FreeImage 3 API documentation. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to get histogram of a 'header-only' bitmap.") - End If - - ReDim alResult(255) - Success = (FreeImage_GetHistogramInt(Bitmap, alResult(0), Channel) = 1) - If (Success) Then - Call pSwap(VarPtrArray(FreeImage_GetHistogramEx), VarPtrArray(alResult)) - End If - End If - -End Function - -Public Function FreeImage_AdjustCurveEx(ByVal Bitmap As Long, _ - ByRef LookupTable As Variant, _ - Optional ByVal Channel As FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK) As Boolean - -Dim lpData As Long -Dim lSizeInBytes As Long - - ' This function extends the FreeImage function 'FreeImage_AdjustCurve' - ' to a more VB suitable function. The parameter 'LookupTable' may - ' either be an array of type Byte or may contain the pointer to a memory - ' block, what in VB is always the address of the memory block, since VB - ' actually doesn's support native pointers. - - ' In case of providing the memory block as an array, make sure, that the - ' array contains exactly 256 items. In case of providing an address of a - ' memory block, the size of the memory block is assumed to be 256 bytes - ' and it is up to the caller to ensure that it is large enough. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to adjust a 'header-only' bitmap.") - End If - - If (IsArray(LookupTable)) Then - lpData = pGetMemoryBlockPtrFromVariant(LookupTable, lSizeInBytes) - - ElseIf (IsNumeric(LookupTable)) Then - lSizeInBytes = 256 - lpData = CLng(LookupTable) - - End If - - If ((lpData <> 0) And (lSizeInBytes = 256)) Then - FreeImage_AdjustCurveEx = (FreeImage_AdjustCurveInt(Bitmap, lpData, Channel) = 1) - End If - End If - -End Function - -Public Function FreeImage_GetLockedPageNumbersEx(ByVal Bitmap As Long, _ - Optional ByRef Count As Long) As Long() - -Dim lpPages As Long -Dim alResult() As Long - - ' This function extends the FreeImage function FreeImage_GetLockedPageNumbers() - ' to a more VB suitable function. The original FreeImage parameter 'pages', which - ' is a pointer to an array of Long, containing all locked page numbers, was turned - ' into a return value, which is a real VB-style array of type Long. The original - ' Boolean return value, indicating if there are any locked pages, was dropped from - ' this function. The caller has to check the 'Count' parameter, which works according - ' to the FreeImage API documentation. - - ' This function returns an array of Longs, dimensioned from 0 to (Count - 1), that - ' contains the page numbers of all currently locked pages of 'BITMAP', if 'Count' is - ' greater than 0 after the function returns. If 'Count' is 0, there are no pages - ' locked and the function returns an uninitialized array. - - - If (FreeImage_GetLockedPageNumbersInt(Bitmap, lpPages, Count) = 1) Then - ReDim alResult(Count - 1) - Call CopyMemory(alResult(0), ByVal lpPages, Count * 4) - End If - -End Function - -' Memory and Stream functions - -Public Function FreeImage_GetFileTypeFromMemoryEx(ByRef Data As Variant, _ - Optional ByRef SizeInBytes As Long) As FREE_IMAGE_FORMAT - -Dim hStream As Long -Dim lDataPtr As Long - - ' This function extends the FreeImage function FreeImage_GetFileTypeFromMemory() - ' to a more VB suitable function. The parameter data of type Variant my - ' me either an array of type Byte, Integer or Long or may contain the pointer - ' to a memory block, what in VB is always the address of the memory block, - ' since VB actually doesn's support native pointers. - - ' In case of providing the memory block as an array, the SizeInBytes may - ' be omitted, zero or less than zero. Then, the size of the memory block - ' is calculated correctly. When SizeInBytes is given, it is up to the caller - ' to ensure, it is correct. - - ' In case of providing an address of a memory block, SizeInBytes must not - ' be omitted. - - - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'data'. - lDataPtr = pGetMemoryBlockPtrFromVariant(Data, SizeInBytes) - - ' open the memory stream - hStream = FreeImage_OpenMemoryByPtr(lDataPtr, SizeInBytes) - If (hStream) Then - ' on success, detect image type - FreeImage_GetFileTypeFromMemoryEx = FreeImage_GetFileTypeFromMemory(hStream) - Call FreeImage_CloseMemory(hStream) - Else - FreeImage_GetFileTypeFromMemoryEx = FIF_UNKNOWN - End If - -End Function - -Public Function FreeImage_LoadFromMemoryEx(ByRef Data As Variant, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByRef SizeInBytes As Long, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As Long - -Dim hStream As Long -Dim lDataPtr As Long - - ' This function extends the FreeImage function FreeImage_LoadFromMemory() - ' to a more VB suitable function. The parameter data of type Variant my - ' me either an array of type Byte, Integer or Long or may contain the pointer - ' to a memory block, what in VB is always the address of the memory block, - ' since VB actually doesn's support native pointers. - - ' The parameter 'Flags' works according to the FreeImage API documentation. - - ' In case of providing the memory block as an array, the SizeInBytes may - ' be omitted, zero or less than zero. Then, the size of the memory block - ' is calculated correctly. When SizeInBytes is given, it is up to the caller - ' to ensure, it is correct. - - ' In case of providing an address of a memory block, SizeInBytes must not - ' be omitted. - - ' The parameter fif is an OUT parameter, that will contain the image type - ' detected. Any values set by the caller will never be used within this - ' function. - - - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'data'. - lDataPtr = pGetMemoryBlockPtrFromVariant(Data, SizeInBytes) - - ' open the memory stream - hStream = FreeImage_OpenMemoryByPtr(lDataPtr, SizeInBytes) - If (hStream) Then - ' on success, detect image type - Format = FreeImage_GetFileTypeFromMemory(hStream) - If (Format <> FIF_UNKNOWN) Then - ' load the image from memory stream only, if known image type - FreeImage_LoadFromMemoryEx = FreeImage_LoadFromMemory(Format, hStream, Flags) - End If - ' close the memory stream when open - Call FreeImage_CloseMemory(hStream) - End If - -End Function - -Public Function FreeImage_SaveToMemoryEx(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByRef Data() As Byte, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByVal UnloadSource As Boolean) As Boolean - -Dim hStream As Long -Dim lpData As Long -Dim lSizeInBytes As Long - - ' This function saves a FreeImage DIB into memory by using the VB Byte - ' array Data(). It makes a deep copy of the image data and closes the - ' memory stream opened before it returns to the caller. - - ' The Byte array 'Data()' must not be a fixed sized array and will be - ' redimensioned according to the size needed to hold all the data. - - ' The parameters 'Format', 'Bitmap' and 'Flags' work according to the FreeImage 3 - ' API documentation. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after it has been saved into memory. There is no need to clean up the DIB - ' at the caller's site. - - ' The function returns True on success and False otherwise. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to save a 'header-only' bitmap.") - End If - - hStream = FreeImage_OpenMemory() - If (hStream) Then - FreeImage_SaveToMemoryEx = FreeImage_SaveToMemory(Format, Bitmap, hStream, Flags) - If (FreeImage_SaveToMemoryEx) Then - If (FreeImage_AcquireMemoryInt(hStream, lpData, lSizeInBytes)) Then - On Error Resume Next - ReDim Data(lSizeInBytes - 1) - If (Err.Number = ERROR_SUCCESS) Then - On Error GoTo 0 - Call CopyMemory(Data(0), ByVal lpData, lSizeInBytes) - Else - On Error GoTo 0 - FreeImage_SaveToMemoryEx = False - End If - Else - FreeImage_SaveToMemoryEx = False - End If - End If - Call FreeImage_CloseMemory(hStream) - Else - FreeImage_SaveToMemoryEx = False - End If - - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_SaveToMemoryEx2(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByRef Data() As Byte, _ - ByRef Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByVal UnloadSource As Boolean) As Boolean - - ' This function saves a FreeImage DIB into memory by using the VB Byte - ' array Data(). It does not makes a deep copy of the image data, but uses - ' the function 'FreeImage_AcquireMemoryEx' to wrap the array 'Data()' - ' around the memory block pointed to by the result of the - ' 'FreeImage_AcquireMemory' function. - - ' The Byte array 'Data()' must not be a fixed sized array and will be - ' redimensioned according to the size needed to hold all the data. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - ' The parameter 'stream' is an IN/OUT parameter, tracking the memory - ' stream, the VB array 'Data()' is based on. This parameter may contain - ' an already opened FreeImage memory stream when the function is called and - ' contains a valid memory stream when the function returns in each case. - ' After all, it is up to the caller to close that memory stream correctly. - ' The array 'Data()' will no longer be valid and accessable after the stream - ' has been closed, so it should only be closed after the passed byte array - ' variable either goes out of the caller's scope or is redimensioned. - - ' The parameters 'Format', 'Bitmap' and 'Flags' work according to the FreeImage 3 - ' API documentation. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after it has been saved to memory. There is no need to clean up the DIB - ' at the caller's site. - - ' The function returns True on success and False otherwise. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to save a 'header-only' bitmap.") - End If - - If (Stream = 0) Then - Stream = FreeImage_OpenMemory() - End If - If (Stream) Then - FreeImage_SaveToMemoryEx2 = FreeImage_SaveToMemory(Format, Bitmap, Stream, Flags) - If (FreeImage_SaveToMemoryEx2) Then - FreeImage_SaveToMemoryEx2 = FreeImage_AcquireMemoryEx(Stream, Data) - End If - - ' do not close the memory stream, since the returned array data() - ' points to the stream's data - ' the caller must close the stream after he is done - ' with the array - Else - FreeImage_SaveToMemoryEx2 = False - End If - - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_AcquireMemoryEx(ByVal Stream As Long, _ - ByRef Data() As Byte, _ - Optional ByRef SizeInBytes As Long) As Boolean - -Dim lpData As Long -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function wraps the byte array Data() around acquired memory - ' of the memory stream specified by then stream parameter. The adjusted - ' array then points directly to the stream's data pointer and so - ' provides full read and write access. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - - If (Stream) Then - If (FreeImage_AcquireMemoryInt(Stream, lpData, SizeInBytes)) Then - With tSA - .cbElements = 1 ' one element is one byte - .cDims = 1 ' the array has only 1 dimension - .cElements = SizeInBytes ' the number of elements in the array is - ' the size in bytes of the memory block - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = lpData ' let the array point to the memory block - ' received by FreeImage_AcquireMemory - End With - - lpSA = deref(VarPtrArray(Data)) - If (lpSA = 0) Then - ' allocate memory for an array descriptor - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal VarPtrArray(Data), lpSA, 4) - Else - Call SafeArrayDestroyData(lpSA) - End If - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Else - FreeImage_AcquireMemoryEx = False - End If - Else - FreeImage_AcquireMemoryEx = False - End If - -End Function - -Public Function FreeImage_ReadMemoryEx(ByRef Buffer As Variant, _ - ByVal Stream As Long, _ - Optional ByRef Count As Long, _ - Optional ByRef Size As Long) As Long - -Dim lBufferPtr As Long -Dim lSizeInBytes As Long -Dim lSize As Long -Dim lCount As Long - - ' This function is a wrapper for 'FreeImage_ReadMemory()' using VB style - ' arrays instead of a void pointer. - - ' The variant parameter 'Buffer' may be a Byte, Integer or Long array or - ' may contain a pointer to a memory block (the memory block's address). - - ' In the latter case, this function behaves exactly - ' like 'FreeImage_ReadMemory()'. Then, 'Count' and 'Size' must be valid - ' upon entry. - - ' If 'Buffer' is an initialized (dimensioned) array, 'Count' and 'Size' may - ' be omitted. Then, the array's layout is used to determine 'Count' - ' and 'Size'. In that case, any provided value in 'Count' and 'Size' upon - ' entry will override these calculated values as long as they are not - ' exceeding the size of the array in 'Buffer'. - - ' If 'Buffer' is an uninitialized (not yet dimensioned) array of any valid - ' type (Byte, Integer or Long) and, at least 'Count' is specified, the - ' array in 'Buffer' is redimensioned by this function. If 'Buffer' is a - ' fixed-size or otherwise locked array, a runtime error (10) occurs. - ' If 'Size' is omitted, the array's element size is assumed to be the - ' desired value. - - ' As FreeImage's function 'FreeImage_ReadMemory()', this function returns - ' the number of items actually read. - - ' Example: (very freaky...) - ' - ' Dim alLongBuffer() As Long - ' Dim lRet as Long - ' - ' ' now reading 303 integers (2 byte) into an array of Longs - ' lRet = FreeImage_ReadMemoryEx(alLongBuffer, lMyStream, 303, 2) - ' - ' ' now, lRet contains 303 and UBound(alLongBuffer) is 151 since - ' ' we need at least 152 Longs (0..151) to store (303 * 2) = 606 bytes - ' ' so, the higest two bytes of alLongBuffer(151) contain only unset - ' ' bits. Got it? - - ' Remark: This function's parameter order differs from FreeImage's - ' original funtion 'FreeImage_ReadMemory()'! - - If (VarType(Buffer) And vbArray) Then - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'Buffer'. - lBufferPtr = pGetMemoryBlockPtrFromVariant(Buffer, lSizeInBytes, lSize) - If (lBufferPtr = 0) Then - ' array is not initialized - If (Count > 0) Then - ' only if we have a 'Count' value, redim the array - If (Size <= 0) Then - ' if 'Size' is omitted, use array's element size - Size = lSize - End If - - Select Case lSize - - Case 2 - ' Remark: -Int(-a) == ceil(a); a > 0 - ReDim Buffer(-Int(-Count * Size / 2) - 1) As Integer - - Case 4 - ' Remark: -Int(-a) == ceil(a); a > 0 - ReDim Buffer(-Int(-Count * Size / 4) - 1) As Long - - Case Else - ReDim Buffer((Count * Size) - 1) As Byte - - End Select - lBufferPtr = pGetMemoryBlockPtrFromVariant(Buffer, lSizeInBytes, lSize) - End If - End If - If (lBufferPtr) Then - lCount = lSizeInBytes / lSize - If (Size <= 0) Then - ' use array's natural value for 'Size' when - ' omitted - Size = lSize - End If - If (Count <= 0) Then - ' use array's natural value for 'Count' when - ' omitted - Count = lCount - End If - If ((Size * Count) > (lSize * lCount)) Then - If (Size = lSize) Then - Count = lCount - Else - ' Remark: -Fix(-a) == floor(a); a > 0 - Count = -Fix(-lSizeInBytes / Size) - If (Count = 0) Then - Size = lSize - Count = lCount - End If - End If - End If - FreeImage_ReadMemoryEx = FreeImage_ReadMemory(lBufferPtr, Size, Count, Stream) - End If - - ElseIf (VarType(Buffer) = vbLong) Then - ' if Buffer is a Long, it specifies the address of a memory block - ' then, we do not know anything about its size, so assume that 'Size' - ' and 'Count' are correct and forward these directly to the FreeImage - ' call. - FreeImage_ReadMemoryEx = FreeImage_ReadMemory(CLng(Buffer), Size, Count, Stream) - - End If - -End Function - -Public Function FreeImage_WriteMemoryEx(ByRef Buffer As Variant, _ - ByVal Stream As Long, _ - Optional ByRef Count As Long, _ - Optional ByRef Size As Long) As Long - -Dim lBufferPtr As Long -Dim lSizeInBytes As Long -Dim lSize As Long -Dim lCount As Long - - ' This function is a wrapper for 'FreeImage_WriteMemory()' using VB style - ' arrays instead of a void pointer. - - ' The variant parameter 'Buffer' may be a Byte, Integer or Long array or - ' may contain a pointer to a memory block (the memory block's address). - - ' In the latter case, this function behaves exactly - ' like 'FreeImage_WriteMemory()'. Then, 'Count' and 'Size' must be valid - ' upon entry. - - ' If 'Buffer' is an initialized (dimensioned) array, 'Count' and 'Size' may - ' be omitted. Then, the array's layout is used to determine 'Count' - ' and 'Size'. In that case, any provided value in 'Count' and 'Size' upon - ' entry will override these calculated values as long as they are not - ' exceeding the size of the array in 'Buffer'. - - ' If 'Buffer' is an uninitialized (not yet dimensioned) array of any - ' type, the function will do nothing an returns 0. - - ' Remark: This function's parameter order differs from FreeImage's - ' original funtion 'FreeImage_ReadMemory()'! - - If (VarType(Buffer) And vbArray) Then - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'Buffer'. - lBufferPtr = pGetMemoryBlockPtrFromVariant(Buffer, lSizeInBytes, lSize) - If (lBufferPtr) Then - lCount = lSizeInBytes / lSize - If (Size <= 0) Then - ' use array's natural value for 'Size' when - ' omitted - Size = lSize - End If - If (Count <= 0) Then - ' use array's natural value for 'Count' when - ' omitted - Count = lCount - End If - If ((Size * Count) > (lSize * lCount)) Then - If (Size = lSize) Then - Count = lCount - Else - ' Remark: -Fix(-a) == floor(a); a > 0 - Count = -Fix(-lSizeInBytes / Size) - If (Count = 0) Then - Size = lSize - Count = lCount - End If - End If - End If - FreeImage_WriteMemoryEx = FreeImage_WriteMemory(lBufferPtr, Size, Count, Stream) - End If - - ElseIf (VarType(Buffer) = vbLong) Then - ' if Buffer is a Long, it specifies the address of a memory block - ' then, we do not know anything about its size, so assume that 'Size' - ' and 'Count' are correct and forward these directly to the FreeImage - ' call. - FreeImage_WriteMemoryEx = FreeImage_WriteMemory(CLng(Buffer), Size, Count, Stream) - - End If - -End Function - -Public Function FreeImage_LoadMultiBitmapFromMemoryEx(ByRef Data As Variant, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByRef SizeInBytes As Long, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As Long - -Dim hStream As Long -Dim lDataPtr As Long - - ' This function extends the FreeImage function FreeImage_LoadMultiBitmapFromMemoryEx() - ' to a more VB suitable function. The parameter data of type Variant my - ' me either an array of type Byte, Integer or Long or may contain the pointer - ' to a memory block, what in VB is always the address of the memory block, - ' since VB actually doesn's support native pointers. - - ' The parameter 'Flags' works according to the FreeImage API documentation. - - ' In case of providing the memory block as an array, the SizeInBytes may - ' be omitted, zero or less than zero. Then, the size of the memory block - ' is calculated correctly. When SizeInBytes is given, it is up to the caller - ' to ensure, it is correct. - - ' In case of providing an address of a memory block, SizeInBytes must not - ' be omitted. - - ' The parameter fif is an OUT parameter, that will contain the image type - ' detected. Any values set by the caller will never be used within this - ' function. - - - ' get both pointer and size in bytes of the memory block provided - ' through the Variant parameter 'Data'. - lDataPtr = pGetMemoryBlockPtrFromVariant(Data, SizeInBytes) - - ' open the memory stream - hStream = FreeImage_OpenMemoryByPtr(lDataPtr, SizeInBytes) - If (hStream) Then - ' on success, detect image type - Format = FreeImage_GetFileTypeFromMemory(hStream) - If (Format <> FIF_UNKNOWN) Then - ' load the image from memory stream only, if known image type - FreeImage_LoadMultiBitmapFromMemoryEx = FreeImage_LoadMultiBitmapFromMemory(Format, hStream, Flags) - End If - ' close the memory stream when open - Call FreeImage_CloseMemory(hStream) - End If - -End Function - -Public Function FreeImage_SaveMultiBitmapToMemoryEx(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByRef Data() As Byte, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByVal UnloadSource As Boolean) As Boolean - -Dim hStream As Long -Dim lpData As Long -Dim lSizeInBytes As Long - - ' This function saves a FreeImage multi-page bitmap into memory by using - ' the VB Byte array Data(). It makes a deep copy of the image data and closes the - ' memory stream opened, before it returns to the caller. - - ' The Byte array 'Data()' must not be a fixed sized array and will be - ' redimensioned according to the size needed to hold all the data. - - ' The parameters 'Format', 'Bitmap' and 'Flags' work according to the FreeImage 3 - ' API documentation. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after it has been saved to memory. If True, there is no need to close the - ' multi-page bitmap at the caller's site. - - ' The function returns True on success and False otherwise. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to save a 'header-only' bitmap.") - End If - - hStream = FreeImage_OpenMemory() - If (hStream) Then - FreeImage_SaveMultiBitmapToMemoryEx = FreeImage_SaveMultiBitmapToMemory(Format, Bitmap, hStream, Flags) - If (FreeImage_SaveMultiBitmapToMemoryEx) Then - If (FreeImage_AcquireMemoryInt(hStream, lpData, lSizeInBytes)) Then - On Error Resume Next - ReDim Data(lSizeInBytes - 1) - If (Err.Number = ERROR_SUCCESS) Then - On Error GoTo 0 - Call CopyMemory(Data(0), ByVal lpData, lSizeInBytes) - Else - On Error GoTo 0 - FreeImage_SaveMultiBitmapToMemoryEx = False - End If - Else - FreeImage_SaveMultiBitmapToMemoryEx = False - End If - End If - Call FreeImage_CloseMemory(hStream) - Else - FreeImage_SaveMultiBitmapToMemoryEx = False - End If - - If (UnloadSource) Then - Call FreeImage_CloseMultiBitmapInt(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_SaveMultiBitmapToMemoryEx2(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Bitmap As Long, _ - ByRef Data() As Byte, _ - ByRef Stream As Long, _ - Optional ByVal Flags As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByVal UnloadSource As Boolean) As Boolean - - ' This function saves a FreeImage multi-page bitmap into memory by using - ' the VB Byte array Data(). It does not makes a deep copy of the image data, but uses - ' the function 'FreeImage_AcquireMemoryEx' to wrap the array 'Data()' - ' around the memory block pointed to by the result of the - ' 'FreeImage_AcquireMemory' function. - - ' The Byte array 'Data()' must not be a fixed sized array and will be - ' redimensioned according to the size needed to hold all the data. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - ' The parameter 'Stream' is an IN/OUT parameter, tracking the memory - ' stream, the VB array 'Data()' is based on. This parameter may contain - ' an already opened FreeImage memory stream when the function is called and - ' contains a valid memory stream when the function returns in each case. - ' After all, it is up to the caller to close that memory stream correctly. - ' The array 'Data()' will no longer be valid and accessable after the stream - ' has been closed, so it should only be closed after the passed byte array - ' variable either goes out of the caller's scope or is redimensioned. - - ' The parameters 'Format', 'Bitmap' and 'Flags' work according to the FreeImage 3 - ' API documentation. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after it has been saved to memory. If True, there is no need to close the - ' multi-page bitmap at the caller's site. - - ' The function returns True on success and False otherwise. - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to save a 'header-only' bitmap.") - End If - - If (Stream = 0) Then - Stream = FreeImage_OpenMemory() - End If - If (Stream) Then - FreeImage_SaveMultiBitmapToMemoryEx2 = _ - FreeImage_SaveMultiBitmapToMemory(Format, Bitmap, Stream, Flags) - If (FreeImage_SaveMultiBitmapToMemoryEx2) Then - FreeImage_SaveMultiBitmapToMemoryEx2 = FreeImage_AcquireMemoryEx(Stream, Data) - End If - - ' do not close the memory stream, since the returned array 'Data()' - ' points to the stream's data - ' the caller must close the stream after he is done - ' with the array - Else - FreeImage_SaveMultiBitmapToMemoryEx2 = False - End If - - If (UnloadSource) Then - Call FreeImage_CloseMultiBitmapInt(Bitmap) - End If - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' Tag accessing VB friendly helper functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_CreateTagEx(ByVal Model As FREE_IMAGE_MDMODEL, _ - Optional ByVal Key As String, _ - Optional ByVal TagType As FREE_IMAGE_MDTYPE = FIDT_NOTYPE, _ - Optional ByRef Value As Variant, _ - Optional ByRef Count As Long, _ - Optional ByVal Id As Long) As FREE_IMAGE_TAG - - ' This function is a wrapper for FreeImage_CreateTag() working with - ' the VB friendly FREE_IMAGE_TAG structure. So, the return value is - ' not a pointer to a FITAG structure but a FREE_IMAGE_TAG structure. - - ' In contrast to FreeImage's original FreeImage_CreateTag() function, the - ' parameter 'Model' must be specified, the parameters 'Key', 'TagType', - ' 'Value', 'Count' and 'Id' my be specified. - - ' The 'Model' is needed, since each FREE_IMAGE_TAG structure needs a - ' valid 'Model' member. - - ' All other parameters are optional and enable the caller to specify the tag's - ' values upon tag creation. Any parameter specified, is set to it's corresponding - ' member in the FREE_IMAGE_TAG structure. - - ' The caller should check the returned FREE_IMAGE_TAG structure's 'TagPtr' member. - ' If this function succeeded, the 'TagPtr' member is non zero. A value of zero - ' indicates an error condition sourced from FreeImage_CreateTag(). - - With FreeImage_CreateTagEx - .TagPtr = FreeImage_CreateTag() - If (.TagPtr <> 0) Then - .Model = Model - If (LenB(Key) > 0) Then - .Key = Key - End If - .Type = TagType - .Count = Count - .Id = Id - If (Not IsMissing(Value)) Then - .Value = Value - End If - Call pTagToTagPtr(FreeImage_CreateTagEx) - FreeImage_CreateTagEx = pGetTagFromTagPtr(Model, .TagPtr) - End If - End With - -End Function - -Public Function FreeImage_AppendTag(ByVal Bitmap As Long, _ - ByVal Model As FREE_IMAGE_MDMODEL, _ - Optional ByVal Key As String, _ - Optional ByVal TagType As FREE_IMAGE_MDTYPE = FIDT_NOTYPE, _ - Optional ByRef Value As Variant, _ - Optional ByRef Count As Long, _ - Optional ByVal Id As Long, _ - Optional ByVal OverwriteExisting As Boolean = True) As FREE_IMAGE_TAG - -Dim lpTag As Long - - ' This function is a shortcut wrapper for FreeImage_CreateTagEx() and - ' FreeImage_SetMetadataEx(). It creates a new tag as FreeImage_CreateTagEx() does - ' and appends it to the image's metadata model. - - ' The parameter 'Bitmap' specifies the image, the new tag should be appended to, - ' parameters 'Model', 'Key', 'TagType', 'Value', 'Count' and 'Id' are these, - ' FreeImage_CreateTagEx() has and are just forwarded unchanged. - - ' The boolean parameter 'OverwriteExisting' determines, whether to overwrite or - ' replace an already existing tag with the newly created. If the tag specified - ' by it's model and key already exists and 'OverwriteExisting' is False, an - ' empty FREE_IMAGE_TAG structure is returned. - - ' So, as with FreeImage_CreateTagEx(), the caller should check the returned - ' FREE_IMAGE_TAG structure's 'TagPtr' member. If this function succeeded, the - ' 'TagPtr' member is non zero. A value of zero indicates an error condition - ' sourced from either the FreeImage_CreateTag() function or may result from - ' an already existing tag that should not be overwritten. - - If ((FreeImage_GetMetadataInt(Model, Bitmap, Key, lpTag) = 0) Or _ - (OverwriteExisting)) Then - - FreeImage_AppendTag = FreeImage_CreateTagEx(Model, Key, TagType, Value, Count, Id) - If (FreeImage_AppendTag.TagPtr <> 0) Then - Call FreeImage_SetMetadataEx(Bitmap, FreeImage_AppendTag, Key, Model, True) - End If - End If - -End Function - -Public Function FreeImage_RemoveTag(ByVal Bitmap As Long, _ - ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Key As String) As Boolean - - ' This function is a wrapper function, that removes a tag, that is actually - ' part of an image's metadata model. The tag named 'key' of the metadata - ' model specified in parameter 'Model' of the image 'Bitmap' will be removed. - - ' Removing a tag is actually done by calling FreeImage_SetMetadata() with - ' a NULL pointer for 'FITAG *tag' as described in the API documentation. - - ' The function returns the boolean value returned from FreeImage_SetMetadata(), - ' which is always TRUE when removing a tag in this fashion. So, this function's - ' caller has no feedback telling if the tag was really present and removed - ' successfully. - - ' Up to version 3.9.1 of FreeImage, there seems to be a bug in removing an - ' tag from an image's metadata model. Although the removed tag is not accessible - ' through FreeImage_GetMetadata() any more, iterations with - ' Freeimage_FindFirst/NextMetadata() will still return this tag an a NULL - ' pointer. - - ' This bug was reported on the Developers Forum. You can revisit the posting at: - ' http://sourceforge.net/forum/forum.php?thread_id=1536883&forum_id=36111 - - FreeImage_RemoveTag = (FreeImage_SetMetadataInt(Model, Bitmap, Key, 0) <> 0) - -End Function - -Public Function FreeImage_RemoveTagEx(ByVal Bitmap As Long, _ - ByRef Tag As FREE_IMAGE_TAG) As Boolean - - ' This function is a FREE_IMAGE_TAG based wrapper for FreeImage_RemoveTag() - - With Tag - FreeImage_RemoveTagEx = FreeImage_RemoveTag(Bitmap, .Model, .Key) - End With - -End Function - -Public Function FreeImage_TagExists(ByVal Bitmap As Long, _ - ByVal Model As FREE_IMAGE_MDMODEL, _ - Optional ByVal Key As String) As Boolean - -Dim lpTag As Long - - ' This function is a small helper function, returning a boolean value - ' that determines, whether a certain tag specified by metadata model - ' and key exists for an image specified by 'Bitmap'. - - FreeImage_TagExists = (FreeImage_GetMetadataInt(Model, Bitmap, Key, lpTag) <> 0) - -End Function - -Public Function FreeImage_TagExistsEx(ByVal Bitmap As Long, _ - ByRef Tag As FREE_IMAGE_TAG) As Boolean - - ' This function is a FREE_IMAGE_TAG based wrapper for FreeImage_TagExists() - - With Tag - FreeImage_TagExistsEx = FreeImage_TagExists(Bitmap, .Model, .Key) - End With - -End Function - -Public Sub FreeImage_DeleteTagEx(ByRef Tag As FREE_IMAGE_TAG) - - ' This function is a wrapper for FreeImage_DeleteTag() working with - ' the VB friendly FREE_IMAGE_TAG structure. So, the parameter 'Tag' - ' is not a pointer to a FITAG structure but a FREE_IMAGE_TAG structure. - - ' This function deletes the underlaying FreeImage FITAG structure, - ' specified the the member 'TagPtr' of the FREE_IMAGE_TAG structure - ' and also sets all other members of Tag to a null value. - - ' Do not get confused with the wrapper functions FreeImage_RemoveTag() - ' and FreeImage_RemoveTagEx(). These functions remove a tag from an - ' image's metadata model. This function only deletes of frees (a better - ' name would be 'FreeImage_FreeTag') a tag created with - ' FreeImage_CreateTagEx(). Do not delete any tags obtained from any other - ' function. - - With Tag - If (.TagPtr <> 0) Then - Call FreeImage_DeleteTag(.TagPtr) - End If - .TagPtr = 0 - .Count = 0 - .Description = vbNullString - .Id = 0 - .Key = vbNullString - .Length = 0 - .Model = FIMD_NODATA - Erase .Palette - Erase .RationalValue - .StringValue = vbNullString - .Type = FIDT_NOTYPE - .Value = Empty - End With - -End Sub - -Public Function FreeImage_CloneTagEx(ByRef Tag As FREE_IMAGE_TAG, _ - Optional ByVal Model As FREE_IMAGE_MDMODEL = FIMD_NODATA) As FREE_IMAGE_TAG - - ' This function is a thin wrapper for FreeImage_CloneTag() working with - ' the VB friendly FREE_IMAGE_TAG structure. The parameter 'Tag' works - ' according to the FreeImage API documentation expect that Tag is not a - ' pointer to a FITAG structure but a FREE_IMAGE_TAG structure. - - ' The additional optional paremeter 'Model' is needed, since the - ' transformation from a FreeImage FITAG structure to the VB friendly - ' FREE_IMAGE_TAG structure always need the model to be specified. - ' When 'Model' is missing (equal to FREE_IMAGE_TAG), the model to be - ' used is taken from the Tag's member 'Model' itself. - - ' See function FreeImage_FindNextMetadataEx() to learn more about the - ' optional parameter 'Model' - - ' Tags obtained from FreeImage_CloneTagEx() must be deleted with - ' FreeImage_DeleteTagEx() as long as they are not used with - ' FreeImage_SetMetadataEx() with the parameter 'RefreshTag' set to True. - - If (Tag.TagPtr <> 0) Then - If (Model = FIMD_NODATA) Then - Model = Tag.Model - End If - FreeImage_CloneTagEx = pGetTagFromTagPtr(Model, FreeImage_CloneTag(Tag.TagPtr)) - End If - -End Function - -Public Function FreeImage_RemoveMetadataModel(ByVal Bitmap As Long, _ - ByVal Model As FREE_IMAGE_MDMODEL) As Boolean - - ' This function removes a complete metadata model 'Model' from an image specified - ' by 'Bitmap'. - - If (Model <> FIMD_NODATA) Then - FreeImage_RemoveMetadataModel = (FreeImage_SetMetadataInt(Model, Bitmap, vbNullString, 0) <> 0) - End If - -End Function - -Public Function FreeImage_FindFirstMetadataEx(ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Bitmap As Long, _ - ByRef Tag As FREE_IMAGE_TAG) As Long - - ' This function is a wrapper for FreeImage_FindFirstMetadata() working with - ' the VB friendly FREE_IMAGE_TAG structure. All parameters 'Bitmap', 'Tag', - ' and 'Model' as the function's return value work according to the - ' FreeImage API documentation expect that Tag is not a pointer to a FITAG - ' structure but a FREE_IMAGE_TAG structure. - - ' Tags obtained from FreeImage_GetMetadataEx() must not be deleted with - ' FreeImage_DeleteTagEx(). - - With Tag - FreeImage_FindFirstMetadataEx = FreeImage_FindFirstMetadata(Model, Bitmap, .TagPtr) - If (FreeImage_FindFirstMetadataEx <> 0) Then - Tag = pGetTagFromTagPtr(Model, .TagPtr) - End If - End With - -End Function - -Public Function FreeImage_FindNextMetadataEx(ByVal hFind As Long, _ - ByRef Tag As FREE_IMAGE_TAG, _ - Optional ByVal Model As FREE_IMAGE_MDMODEL = FIMD_NODATA) As Boolean - - ' This function is a wrapper for FreeImage_FindNextMetadataEx() working with - ' the VB friendly FREE_IMAGE_TAG structure. All parameters 'hFind' and 'Tag' - ' as the function's return value work according to the FreeImage API - ' documentation expect that Tag is not a pointer to a FITAG structure but a - ' FREE_IMAGE_TAG structure. - - ' The additional optional paremeter 'Model' is needed, since the VB friendly - ' FREE_IMAGE_TAG structure also contains the member 'StringValue'. This member - ' is filled with the result of FreeImage_TagToString() which always needs - ' the model to be specified. Since there should be no static oder global - ' variables id the FreeImage VB wrapper, the model must be known each time - ' a FreeImage FITAG structure is converted to a FREE_IMAGE_TAG structure. - ' (A global VB collection could be used to map the hFind to the model, - ' but we don't want any globals here) - - ' So, when 'Model' is missing (equal to FREE_IMAGE_TAG), the model to be used - ' is taken from the Tag's member 'Model' itself. This is useful when using this - ' function in a loop iterating all tags per model (what else would you do - ' with that function?). The Tag's member 'Model' is populated by - ' FreeImage_FindFirstMetadataEx() and remains valid during the whole loop, ready - ' to be used in this function. - - ' Tags obtained from FreeImage_GetMetadataEx() must not be deleted with - ' FreeImage_DeleteTagEx(). - - With Tag - FreeImage_FindNextMetadataEx = (FreeImage_FindNextMetadataInt(hFind, .TagPtr) <> 0) - If (FreeImage_FindNextMetadataEx) Then - If (Model = FIMD_NODATA) Then - Model = .Model - End If - Tag = pGetTagFromTagPtr(Model, .TagPtr) - End If - End With - -End Function - -Public Function FreeImage_GetAllMetadataTags(ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Bitmap As Long, _ - ByRef Tag() As FREE_IMAGE_TAG) As Long - -Dim hMD As Long -Dim lpTag As Long -Dim i As Long - - ' This function is a helper function returning (through a ByRef parameter) - ' an array of FREE_IMAGE_TAG structures containing all the image's tags of - ' the metadata model specified by the 'Model' parameter. - - ' The parameter 'Tag()' must be an redimensionable array of FREE_IMAGE_TAG - ' and is redimensioned accordingly. The function returns the number of - ' tags stored in 'Tag()'. - - ' All tags obtained from FreeImage_GetAllMetadataTags() must not be deleted - ' with FreeImage_DeleteTagEx(). - - i = FreeImage_GetMetadataCount(Model, Bitmap) - If (i > 0) Then - ReDim Tag(i - 1) - FreeImage_GetAllMetadataTags = i - i = 0 - hMD = FreeImage_FindFirstMetadata(Model, Bitmap, lpTag) - If (hMD <> 0) Then - Do - Tag(i) = pGetTagFromTagPtr(Model, lpTag) - i = i + 1 - Loop While (FreeImage_FindNextMetadataInt(hMD, lpTag) <> 0) - Call FreeImage_FindCloseMetadata(hMD) - End If - End If - -End Function - -Public Function FreeImage_GetMetadataEx(ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Bitmap As Long, _ - ByVal Key As String, _ - ByRef Tag As FREE_IMAGE_TAG) As Boolean - - ' This function is a wrapper for FreeImage_GetMetadata() working with - ' the VB friendly FREE_IMAGE_TAG structure. All parameters 'Bitmap', 'Tag', - ' 'Key' and 'Model' as well as the function's return value work according - ' to the FreeImage API documentation expect that Tag is not a pointer to - ' a FITAG structure but to a FREE_IMAGE_TAG structure. - - ' Tags obtained from FreeImage_GetMetadataEx() must not be deleted with - ' FreeImage_DeleteTagEx(). - - With Tag - If (FreeImage_GetMetadataInt(Model, Bitmap, Key, .TagPtr) <> 0) Then - Tag = pGetTagFromTagPtr(Model, .TagPtr) - FreeImage_GetMetadataEx = True - End If - End With - -End Function - -Public Function FreeImage_SetMetadataEx(ByVal Bitmap As Long, _ - ByRef Tag As FREE_IMAGE_TAG, _ - Optional ByVal Key As String, _ - Optional ByVal Model As FREE_IMAGE_MDMODEL = FIMD_NODATA, _ - Optional ByVal RefreshTag As Boolean) As Boolean - - ' This function is a wrapper for FreeImage_SetMetadata() using the wrapper's - ' VB friendly FREE_IMAGE_TAG structure as an replacement for the original - ' function's pointer to a FITAG structure. - - ' All parameters 'Bitmap', 'Tag', 'Key' and 'Model' as the function's return value - ' work according to the FreeImage API documentation expect that Tag is not a - ' pointer to a FITAG structure but a FREE_IMAGE_TAG structure. - - ' As with FreeImage_SetMetadata(), this function sould only be called with - ' new tags, created with FreeImage_CreateTagEx(), a wrapper function for - ' FreeImage_CreateTag() working with the VB friendly FREE_IMAGE_TAG structure. - - ' Normally, after a newly created tag must be deleted/freed with a call to - ' FreeImage_DeleteTagEx(), a wrapper function for FreeImage_DeleteTag() working - ' with the VB friendly FREE_IMAGE_TAG structure (bored already?), after - ' the tag was appended to an image's metadata model with - ' FreeImage_SetMetadataEx(). But... - - ' There is a wrapper specific additional boolean parameter 'RefreshTag', that - ' is similar to the parameter 'UnloadSource' found in many wrapper functions. - ' When 'RefreshTag' is True upon entry, the tag specified in the 'Tag' - ' parameter is deleted (the underlaying FITAG structure is deleted with - ' FreeImage_DeteleTag() and all other members of the FREE_IMAGE_TAG structure - ' are set to null values) and is reassigned with the tag, that is now part - ' of the image's metadata model. The tag now referenced in the 'Tag' - ' parameter must NOT be deleted any more by the caller of this function, since - ' this tag refers to the actual tag data stored with the image. This is like - ' a FREE_IMAGE_TAG structure obtained from FreeImage_GetMetadata() or - ' FreeImage_FindFirst/NextMetadata(). Any changes made to this FREE_IMAGE_TAG - ' structure may be applied to the image with a later call to - ' FreeImage_UpdateMetadata(). - - - With Tag - If (Model = FIMD_NODATA) Then - Model = .Model - End If - If (LenB(Key) = 0) Then - Key = .Key - End If - If (FreeImage_SetMetadataInt(Model, Bitmap, Key, .TagPtr) <> 0) Then - FreeImage_SetMetadataEx = True - End If - If (RefreshTag) Then - Call FreeImage_DeleteTagEx(Tag) - Call FreeImage_GetMetadataEx(Model, Bitmap, Key, Tag) - End If - End With - -End Function - -Public Function FreeImage_GetImageComment(ByVal Bitmap As Long) As String - -Dim tTag As FREE_IMAGE_TAG - - ' This function is a small wrapper around FreeImage_GetMetadata() that - ' returns the comment of a JPEG, PNG of GIF image. - - If (FreeImage_GetMetadataEx(FIMD_COMMENTS, Bitmap, "Comment", tTag)) Then - FreeImage_GetImageComment = tTag.Value - End If - -End Function - -Public Function FreeImage_SetImageComment(ByVal Bitmap As Long, _ - Optional ByVal Comment As String) As Boolean - -Dim tTag As FREE_IMAGE_TAG - - ' This function is a small wrapper around FreeImage_SetMetadata() that - ' sets the comment of a JPEG, PNG of GIF image. - - If (LenB(Comment) > 0) Then - tTag = FreeImage_AppendTag(Bitmap, FIMD_COMMENTS, "Comment", FIDT_ASCII, Comment) - FreeImage_SetImageComment = (tTag.TagPtr <> 0) - Else - Call FreeImage_RemoveMetadataModel(Bitmap, FIMD_COMMENTS) - FreeImage_SetImageComment = True - End If - -End Function - -Public Function FreeImage_CopyMetadata(ByVal BitmapSrc As Long, _ - ByVal BitmapDst As Long, _ - Optional ByVal ReplaceExisting As Boolean = True, _ - Optional ByVal Model As FREE_IMAGE_MDMODEL = FIMD_NODATA) As Long - -Dim hMDFind As Long -Dim lpTag As Long -Dim strKey As String -Dim bSetTag As Boolean - - ' This derived helper function copies several metadata tags from one - ' image to another. This is useful when cloning images explicitly with - ' FreeImage_Clone() or implicitly with FreeImage_ConvertColorDepth() or - ' with any of the FreeImage_RescaleXXX() functions. Whenever the "same" - ' image is represented by a new 'Bitmap' pointer, the image was internally - ' recreated. All of the data, associated with the image, like metadata, - ' DPI settings or ICC profiles are no more available in the new version of - ' the image. - - ' Setting the DPI for X and Y direction is quite easy with the wrapper - ' functions FreeImage_Get/SetResolutionX/Y(). This function makes it even - ' easier to keep track of all associated metadata tags for a cloned image! - - ' Both parameters 'BitmapSrc' and 'BitmapDst' specify the source and destination - ' image. Metadata is copied from 'BitmapSrc' to 'BitmapDst'. - - ' The optional parameter 'ReplaceExisting' determines whether existing tags - ' should be replaced or not. If there are no tags in 'BitmapDst' it is recommended, - ' to set 'ReplaceExisting' to True (or to omit it, since True is it's default - ' value) for better performance; when set to True, no tests for tag existence - ' in the destination image will be run. - - ' The optional parameter 'Model' may specify a certain metadata model to be - ' copied. If this parameter is omitted or set to any value not defined in the - ' FREE_IMAGE_MDMODEL enumeration, all metadata models will be copied - ' sequentially. - - ' This function returns the number of tags copied or zero when there are no tags - ' in the source image or an error occured. - - ' For the standard use case described above (keeping track of all metadata after - ' an image was cloned) the calling this function boils down to a very short form: - - ' lTagsCopied = FreeImage_CopyMetadata(hDibSrc, hDibDst) - - If ((BitmapSrc <> 0) And (BitmapDst <> 0)) Then - If ((Model >= FIMD_COMMENTS) And (Model <= FIMD_CUSTOM)) Then - hMDFind = FreeImage_FindFirstMetadata(Model, BitmapSrc, lpTag) - If (hMDFind) Then - Do - strKey = pGetStringFromPointerA(deref(deref(lpTag))) - bSetTag = ReplaceExisting - If (Not bSetTag) Then - bSetTag = (Not FreeImage_TagExists(BitmapDst, Model, strKey)) - End If - If (bSetTag) Then - If (FreeImage_SetMetadataInt(Model, BitmapDst, strKey, lpTag) <> 0) Then - FreeImage_CopyMetadata = FreeImage_CopyMetadata + 1 - End If - End If - Loop While (FreeImage_FindNextMetadata(hMDFind, lpTag)) - Call FreeImage_FindCloseMetadata(hMDFind) - End If - Else - For Model = FIMD_COMMENTS To FIMD_CUSTOM - FreeImage_CopyMetadata = FreeImage_CopyMetadata _ - + FreeImage_CopyMetadata(BitmapSrc, BitmapDst, _ - ReplaceExisting, Model) - Next Model - End If - End If - -End Function - -Public Function FreeImage_CloneMetadataEx(ByVal BitmapSrc As Long, _ - ByVal BitmapDst As Long, _ - Optional ByVal Model As FREE_IMAGE_MDMODEL = FIMD_NODATA) As Long - - ' This derived helper function copies several metadata tags from one - ' image to another. It is very similar to FreeImage_CopyMetadata(). - - ' The main difference is, that this function aims to create exactly the same - ' metadata layout in the destination image. In contrast to - ' FreeImage_CopyMetadata(), this function removes all metadata tags in the - ' desination image that are not part of the metadata set in the source image. - ' So, this function is particularly useful for destination images that may - ' have already some tags associated and you want to make shure, that it will - ' get exactly the same metadata set as the source image. - - ' This function will most likely be used in a end user application and should - ' be invoked through a menu command called: "Set/Apply Metadata From Source Image..." - - ' This function returns the number of tags copied or zero if there are no tags - ' in the source image or an error occured. - - If ((BitmapSrc <> 0) And (BitmapDst <> 0)) Then - If ((Model >= FIMD_COMMENTS) And (Model <= FIMD_CUSTOM)) Then - If (FreeImage_RemoveMetadataModel(BitmapDst, Model)) Then - FreeImage_CloneMetadataEx = FreeImage_CopyMetadata(BitmapSrc, BitmapDst, _ - True, Model) - End If - Else - For Model = FIMD_COMMENTS To FIMD_CUSTOM - FreeImage_CloneMetadataEx = FreeImage_CloneMetadataEx _ - + FreeImage_CloneMetadataEx(BitmapSrc, BitmapDst, _ - Model) - Next Model - End If - End If - -End Function - -Public Function FreeImage_TagFromPointer(ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal Tag As Long) As FREE_IMAGE_TAG - - ' This is a generic function that returns a VB wrapper Tag - ' structure (FREE_IMAGE_TAG) from a FreeImage FITAG *tag pointer. - - ' This function is still public due to legacy reasons. Since there are - ' functions like 'FreeImage_GetMetadataEx()', 'FreeImage_GetAllMetadataTags()' - ' or 'FreeImage_FindFirst/NextMetadataEx()', this function won't be needed - ' any more in most cases. - - FreeImage_TagFromPointer = pGetTagFromTagPtr(Model, Tag) - -End Function - -Public Function FreeImage_UpdateMetadata(ByRef Tag As FREE_IMAGE_TAG) As Boolean - - ' This function updates any changes made in a FREE_IMAGE_TAG - ' structure. - - FreeImage_UpdateMetadata = pTagToTagPtr(Tag) - -End Function - -Public Function FreeImage_UnsignedLong(ByVal Value As Long) As Variant - - ' This function converts a signed long (VB's Long data type) into - ' an unsigned long (not really supported by VB). - - ' Basically, this function checks, whether the positive range of - ' a signed long is sufficient to hold the value (indeed, it checks - ' the value since the range is obviously constant). If yes, - ' it returns a Variant with subtype Long ('Variant/Long' in VB's - ' watch window). In this case, the function did not make any real - ' changes at all. If not, the value is stored in a Currency variable, - ' which is able to store the whole range of an unsigned long. Then, - ' the function returns a Variant with subtype Currency - ' ('Variant/Currency' in VB's watch window). - - If (Value < 0) Then - Dim curTemp As Currency - Call CopyMemory(curTemp, Value, 4) - FreeImage_UnsignedLong = curTemp * 10000 - Else - FreeImage_UnsignedLong = Value - End If - -End Function - -Public Function FreeImage_UnsignedShort(ByVal Value As Integer) As Variant - - ' This function converts a signed short (VB's Integer data type) into - ' an unsigned short (not really supported by VB). - - ' Basically, this function checks, whether the positive range of - ' a signed short is sufficient to hold the value (indeed, it checks - ' the value since the range is obviously constant). If yes, - ' it returns a Variant with subtype Integer ('Variant/Integer' in VB's - ' watch window). In this case, the function did not make any real - ' changes at all. If not, the value is stored in a Long variable, - ' which is able to store the whole range of an unsigned short. Then, - ' the function returns a Variant with subtype Long - ' ('Variant/Long' in VB's watch window). - - If (Value < 0) Then - Dim lTemp As Long - Call CopyMemory(lTemp, Value, 2) - FreeImage_UnsignedShort = lTemp - Else - FreeImage_UnsignedShort = Value - End If - -End Function - -Public Function FreeImage_CreateRational(ByRef Numerator As Variant, _ - ByRef Denominator As Variant, _ - Optional ByVal NormalizeValue As Boolean = True) As FIRATIONAL - - ' This function creates an unsigned rational (FIDT_RATIONAL) value to be used with - ' FreeImage's metadata models. In the VB wrapper, any rational value is stored in a - ' structure (FIRATIONAL), containing both 'Numerator' and 'Denominator' members. The - ' rational's value is then defined as the fraction Numerator/Denominator. - - ' Both values 'Numerator' and 'Denominator' are actually ULONGs (unsigned longs), a - ' data type not supported by VB (a VB Long variable is always signed). Therefore, - ' 'Numerator' and 'Denominator' are typed as Variant. Whenever the range of a signed - ' long is sufficient to store the value (all values between 0 and 0x7FFFFFFF - ' (2147483647 decimal)), the Variant gets a Long subtype. If not, a Currency subtype is - ' used just to give you the mathematical correct value of the unsigned long. - - ' The optional parameter 'NormalizeValue' controls, whether the resulting fraction - ' should be normalized (cancelled down) or not. - - ' When calling this function, you can use hexadecimal constants for passing unsinged - ' longs via the parameters 'Numerator' and 'Denominator'. - - ' 2147483647 - ' Example: tRational = FreeImage_CreateRational(&HFFFFFFFF, 12345) -> ---------- - ' 12345 - - With FreeImage_CreateRational - .Numerator = FreeImage_UnsignedLong(Numerator) - .Denominator = FreeImage_UnsignedLong(Denominator) - End With - - If (NormalizeValue) Then - Call pNormalizeRational(FreeImage_CreateRational) - End If - -End Function - -Public Function FreeImage_CreateSignedRational(ByRef Numerator As Variant, _ - ByRef Denominator As Variant, _ - Optional ByVal NormalizeValue As Boolean = True) As FIRATIONAL - - ' This function creates a signed rational (FIDT_RATIONAL) value to be used with - ' FreeImage's metadata models. In the VB wrapper, any rational value is stored in a - ' structure (FIRATIONAL), containing both 'Numerator' and 'Denominator' members. The - ' rational's value is then defined as the fraction Numerator/Denominator. - - ' Both values 'Numerator' and 'Denominator' are actually LONGs (signed longs), the - ' same data type as a VB Long. Since, 'Numerator' and 'Denominator' are typed as - ' Variant, all possible values between -2,147,483,648 and + 2,147,483,647 are stored - ' in a Variant with subtype Long (cp. 'FreeImage_CreateRational()'). - - ' The optional parameter 'NormalizeValue' controls, whether the resulting fraction - ' should be normalized (cancelled down) or not. - - ' When calling this function, you can use hexadecimal constants for passing unsinged - ' longs via the parameters 'Numerator' and 'Denominator'. - - ' -1 1 - ' Example: tRational = FreeImage_CreateSignedRational(&HFFFFFFFF, 12345) -> ----- = - ----- - ' 12345 12345 - - With FreeImage_CreateSignedRational - .Numerator = CLng(Numerator) - .Denominator = CLng(Denominator) - End With - - If (NormalizeValue) Then - Call pNormalizeSRational(FreeImage_CreateSignedRational) - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' Derived and hopefully useful functions -'-------------------------------------------------------------------------------- - -' Plugin and filename functions - -Public Function FreeImage_IsExtensionValidForFIF(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Extension As String, _ - Optional ByVal Compare As VbCompareMethod = vbBinaryCompare) As Boolean - - ' This function tests, whether a given filename extension is valid - ' for a certain image format (fif). - - FreeImage_IsExtensionValidForFIF = (InStr(1, _ - FreeImage_GetFIFExtensionList(Format) & ",", _ - Extension & ",", _ - Compare) > 0) - -End Function - -Public Function FreeImage_IsFilenameValidForFIF(ByVal Format As FREE_IMAGE_FORMAT, _ - ByVal Filename As String, _ - Optional ByVal Compare As VbCompareMethod = vbBinaryCompare) As Boolean - -Dim strExtension As String -Dim i As Long - - ' This function tests, whether a given complete filename is valid - ' for a certain image format (fif). - - i = InStrRev(Filename, ".") - If (i > 0) Then - strExtension = Mid$(Filename, i + 1) - FreeImage_IsFilenameValidForFIF = (InStr(1, _ - FreeImage_GetFIFExtensionList(Format) & ",", _ - strExtension & ",", _ - Compare) > 0) - End If - -End Function - -Public Function FreeImage_GetPrimaryExtensionFromFIF(ByVal Format As FREE_IMAGE_FORMAT) As String - -Dim strExtensionList As String -Dim i As Long - - ' This function returns the primary (main or most commonly used?) extension - ' of a certain image format (fif). This is done by returning the first of - ' all possible extensions returned by FreeImage_GetFIFExtensionList(). That - ' assumes, that the plugin returns the extensions in ordered form. If not, - ' in most cases it is even enough, to receive any extension. - - ' This function is primarily used by the function 'SavePictureEx'. - - strExtensionList = FreeImage_GetFIFExtensionList(Format) - i = InStr(strExtensionList, ",") - If (i > 0) Then - FreeImage_GetPrimaryExtensionFromFIF = Left$(strExtensionList, i - 1) - Else - FreeImage_GetPrimaryExtensionFromFIF = strExtensionList - End If - -End Function - -Public Function FreeImage_IsGreyscaleImage(ByVal Bitmap As Long) As Boolean - -Dim atRGB() As RGBQUAD -Dim i As Long - - ' This function returns a boolean value that is true, if the DIB is actually - ' a greyscale image. Here, the only test condition is, that each palette - ' entry must be a grey value, what means that each color component has the - ' same value (red = green = blue). - - ' The FreeImage libraray doesn't offer a function to determine if a DIB is - ' greyscale. The only thing you can do is to use the 'FreeImage_GetColorType' - ' function, that returns either FIC_MINISWHITE or FIC_MINISBLACK for - ' greyscale images. However, a DIB needs to have a ordered greyscale palette - ' (linear ramp or inverse linear ramp) to be judged as FIC_MINISWHITE or - ' FIC_MINISBLACK. DIB's with an unordered palette that are actually (visually) - ' greyscale, are said to be (color-)palletized. That's also true for any 4 bpp - ' image, since it will never have a palette that satifies the tests done - ' in the 'FreeImage_GetColorType' function. - - ' So, there is a chance to omit some color depth conversions, when displaying - ' an image in greyscale fashion. Maybe the problem will be solved in the - ' FreeImage library one day. - - Select Case FreeImage_GetBPP(Bitmap) - - Case 1, 4, 8 - atRGB = FreeImage_GetPaletteEx(Bitmap) - FreeImage_IsGreyscaleImage = True - For i = 0 To UBound(atRGB) - With atRGB(i) - If ((.rgbRed <> .rgbGreen) Or (.rgbRed <> .rgbBlue)) Then - FreeImage_IsGreyscaleImage = False - Exit For - End If - End With - Next i - - End Select - -End Function - -' Bitmap resolution functions - -Public Function FreeImage_GetResolutionX(ByVal Bitmap As Long) As Long - - ' This function gets a DIB's resolution in X-direction measured - ' in 'dots per inch' (DPI) and not in 'dots per meter'. - - FreeImage_GetResolutionX = Int(0.5 + 0.0254 * FreeImage_GetDotsPerMeterX(Bitmap)) - -End Function - -Public Sub FreeImage_SetResolutionX(ByVal Bitmap As Long, ByVal Resolution As Long) - - ' This function sets a DIB's resolution in X-direction measured - ' in 'dots per inch' (DPI) and not in 'dots per meter'. - - Call FreeImage_SetDotsPerMeterX(Bitmap, Int(Resolution / 0.0254 + 0.5)) - -End Sub - -Public Function FreeImage_GetResolutionY(ByVal Bitmap As Long) As Long - - ' This function gets a DIB's resolution in Y-direction measured - ' in 'dots per inch' (DPI) and not in 'dots per meter'. - - FreeImage_GetResolutionY = Int(0.5 + 0.0254 * FreeImage_GetDotsPerMeterY(Bitmap)) - -End Function - -Public Sub FreeImage_SetResolutionY(ByVal Bitmap As Long, ByVal Resolution As Long) - - ' This function sets a DIB's resolution in Y-direction measured - ' in 'dots per inch' (DPI) and not in 'dots per meter'. - - Call FreeImage_SetDotsPerMeterY(Bitmap, Int(Resolution / 0.0254 + 0.5)) - -End Sub - -' ICC Color Profile functions - -Public Function FreeImage_GetICCProfile(ByVal Bitmap As Long) As FIICCPROFILE - - ' This function is a wrapper for the FreeImage_GetICCProfile() function, returning - ' a real FIICCPROFILE structure. - - ' Since the original FreeImage function returns a pointer to the FIICCPROFILE - ' structure (FIICCPROFILE *), as with string returning functions, this wrapper is - ' needed as VB can't declare a function returning a pointer to anything. So, - ' analogous to string returning functions, FreeImage_GetICCProfile() is declared - ' private as FreeImage_GetICCProfileInt() and made publicly available with this - ' wrapper function. - - Call CopyMemory(FreeImage_GetICCProfile, _ - ByVal FreeImage_GetICCProfileInt(Bitmap), _ - LenB(FreeImage_GetICCProfile)) - -End Function - -Public Function FreeImage_GetICCProfileColorModel(ByVal Bitmap As Long) As FREE_IMAGE_ICC_COLOR_MODEL - - ' This function is a thin wrapper around FreeImage_GetICCProfile() returning - ' the color model in which the ICC color profile data is in, if there is actually - ' a ICC color profile available for the Bitmap specified. - - ' If there is NO color profile along with that bitmap, this function returns the color - ' model that should (or must) be used for any color profile data to be assigned to the - ' Bitmap. That depends on the bitmap's color type. - - If (FreeImage_HasICCProfile(Bitmap)) Then - FreeImage_GetICCProfileColorModel = (deref(FreeImage_GetICCProfileInt(Bitmap)) _ - And FREE_IMAGE_ICC_COLOR_MODEL_MASK) - Else - ' use FreeImage_GetColorType() to determine, whether this is a CMYK bitmap or not - If (FreeImage_GetColorType(Bitmap) = FIC_CMYK) Then - FreeImage_GetICCProfileColorModel = FIICC_COLOR_MODEL_CMYK - Else - FreeImage_GetICCProfileColorModel = FIICC_COLOR_MODEL_RGB - End If - End If - -End Function - -Public Function FreeImage_GetICCProfileSize(ByVal Bitmap As Long) As Long - - ' This function is a thin wrapper around FreeImage_GetICCProfile() returning - ' only the size in bytes of the ICC profile data for the Bitmap specified or zero, - ' if there is no ICC profile data for the Bitmap. - - FreeImage_GetICCProfileSize = deref(FreeImage_GetICCProfileInt(Bitmap) + 4) - -End Function - -Public Function FreeImage_GetICCProfileDataPointer(ByVal Bitmap As Long) As Long - - ' This function is a thin wrapper around FreeImage_GetICCProfile() returning - ' only the pointer (the address) of the ICC profile data for the Bitmap specified, - ' or zero if there is no ICC profile data for the Bitmap. - - FreeImage_GetICCProfileDataPointer = deref(FreeImage_GetICCProfileInt(Bitmap) + 8) - -End Function - -Public Function FreeImage_HasICCProfile(ByVal Bitmap As Long) As Boolean - - ' This function is a thin wrapper around FreeImage_GetICCProfile() returning - ' True, if there is an ICC color profile available for the Bitmap specified or - ' returns False otherwise. - - FreeImage_HasICCProfile = (FreeImage_GetICCProfileSize(Bitmap) <> 0) - -End Function - -' Bitmap Info functions - -Public Function FreeImage_GetInfoHeaderEx(ByVal Bitmap As Long) As BITMAPINFOHEADER - -Dim lpInfoHeader As Long - - ' This function is a wrapper around FreeImage_GetInfoHeader() and returns a fully - ' populated BITMAPINFOHEADER structure for a given bitmap. - - lpInfoHeader = FreeImage_GetInfoHeader(Bitmap) - If (lpInfoHeader) Then - Call CopyMemory(FreeImage_GetInfoHeaderEx, ByVal lpInfoHeader, LenB(FreeImage_GetInfoHeaderEx)) - End If - -End Function - -' Image color depth conversion wrapper - -Public Function FreeImage_ConvertColorDepth(ByVal Bitmap As Long, _ - ByVal Conversion As FREE_IMAGE_CONVERSION_FLAGS, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal Threshold As Byte = 128, _ - Optional ByVal DitherMethod As FREE_IMAGE_DITHER = FID_FS, _ - Optional ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE = FIQ_WUQUANT) As Long - -Dim hDIBNew As Long -Dim hDIBTemp As Long -Dim lBPP As Long -Dim bForceLinearRamp As Boolean -Dim lpReservePalette As Long -Dim bAdjustReservePaletteSize As Boolean - - ' This function is an easy-to-use wrapper for color depth conversion, intended - ' to work around some tweaks in the FreeImage library. - - ' The parameters 'Threshold' and 'eDitherMode' control how thresholding or - ' dithering are performed. The 'QuantizeMethod' parameter determines, what - ' quantization algorithm will be used when converting to 8 bit color images. - - ' The 'Conversion' parameter, which can contain a single value or an OR'ed - ' combination of some of the FREE_IMAGE_CONVERSION_FLAGS enumeration values, - ' determines the desired output image format. - - ' The optional 'UnloadSource' parameter is for unloading the original image, so - ' you can "change" an image with this function rather than getting a new DIB - ' pointer. There is no more need for a second DIB variable at the caller's site. - - bForceLinearRamp = ((Conversion And FICF_REORDER_GREYSCALE_PALETTE) = 0) - lBPP = FreeImage_GetBPP(Bitmap) - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to convert a 'header-only' bitmap.") - End If - - Select Case (Conversion And (Not FICF_REORDER_GREYSCALE_PALETTE)) - - Case FICF_MONOCHROME_THRESHOLD - If (lBPP > 1) Then - hDIBNew = FreeImage_Threshold(Bitmap, Threshold) - End If - - Case FICF_MONOCHROME_DITHER - If (lBPP > 1) Then - hDIBNew = FreeImage_Dither(Bitmap, DitherMethod) - End If - - Case FICF_GREYSCALE_4BPP - If (lBPP <> 4) Then - ' If the color depth is 1 bpp and the we don't have a linear ramp palette - ' the bitmap is first converted to an 8 bpp greyscale bitmap with a linear - ' ramp palette and then to 4 bpp. - If ((lBPP = 1) And (FreeImage_GetColorType(Bitmap) = FIC_PALETTE)) Then - hDIBTemp = Bitmap - Bitmap = FreeImage_ConvertToGreyscale(Bitmap) - Call FreeImage_Unload(hDIBTemp) - End If - hDIBNew = FreeImage_ConvertTo4Bits(Bitmap) - Else - ' The bitmap is already 4 bpp but may not have a linear ramp. - ' If we force a linear ramp the bitmap is converted to 8 bpp with a linear ramp - ' and then back to 4 bpp. - If (((Not bForceLinearRamp) And (Not FreeImage_IsGreyscaleImage(Bitmap))) Or _ - (bForceLinearRamp And (FreeImage_GetColorType(Bitmap) = FIC_PALETTE))) Then - hDIBTemp = FreeImage_ConvertToGreyscale(Bitmap) - hDIBNew = FreeImage_ConvertTo4Bits(hDIBTemp) - Call FreeImage_Unload(hDIBTemp) - End If - End If - - Case FICF_GREYSCALE_8BPP - ' Convert, if the bitmap is not at 8 bpp or does not have a linear ramp palette. - If ((lBPP <> 8) Or (((Not bForceLinearRamp) And (Not FreeImage_IsGreyscaleImage(Bitmap))) Or _ - (bForceLinearRamp And (FreeImage_GetColorType(Bitmap) = FIC_PALETTE)))) Then - hDIBNew = FreeImage_ConvertToGreyscale(Bitmap) - End If - - Case FICF_PALLETISED_8BPP - ' note, that the FreeImage library only quantizes 24 bit images - ' do not convert any 8 bit images - If (lBPP <> 8) Then - ' images with a color depth of 24 bits can directly be - ' converted with the FreeImage_ColorQuantize function; - ' other images need to be converted to 24 bits first - If (lBPP = 24) Then - hDIBNew = FreeImage_ColorQuantize(Bitmap, QuantizeMethod) - Else - hDIBTemp = FreeImage_ConvertTo24Bits(Bitmap) - hDIBNew = FreeImage_ColorQuantize(hDIBTemp, QuantizeMethod) - Call FreeImage_Unload(hDIBTemp) - End If - End If - - Case FICF_RGB_15BPP - If (lBPP <> 15) Then - hDIBNew = FreeImage_ConvertTo16Bits555(Bitmap) - End If - - Case FICF_RGB_16BPP - If (lBPP <> 16) Then - hDIBNew = FreeImage_ConvertTo16Bits565(Bitmap) - End If - - Case FICF_RGB_24BPP - If (lBPP <> 24) Then - hDIBNew = FreeImage_ConvertTo24Bits(Bitmap) - End If - - Case FICF_RGB_32BPP - If (lBPP <> 32) Then - hDIBNew = FreeImage_ConvertTo32Bits(Bitmap) - End If - - End Select - - If (hDIBNew) Then - FreeImage_ConvertColorDepth = hDIBNew - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - Else - FreeImage_ConvertColorDepth = Bitmap - End If - - End If - -End Function - -Public Function FreeImage_ColorQuantizeEx(ByVal Bitmap As Long, _ - Optional ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE = FIQ_WUQUANT, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal PaletteSize As Long = 256, _ - Optional ByVal ReserveSize As Long, _ - Optional ByRef ReservePalette As Variant = Null) As Long - -Dim hTmp As Long -Dim lpPalette As Long -Dim lBlockSize As Long -Dim lElementSize As Long - - ' This function is a more VB-friendly wrapper around FreeImage_ColorQuantizeEx, - ' which lets you specify the ReservePalette to be used not only as a pointer, but - ' also as a real VB-style array of type Long, where each Long item takes a color - ' in ARGB format (&HAARRGGBB). The native FreeImage function FreeImage_ColorQuantizeEx - ' is declared private and named FreeImage_ColorQuantizeExInt and so hidden from the - ' world outside the wrapper. - - ' In contrast to the FreeImage API documentation, ReservePalette is of type Variant - ' and may either be a pointer to palette data (pointer to an array of type RGBQUAD - ' == VarPtr(atMyPalette(0)) in VB) or an array of type Long, which then must contain - ' the palette data in ARGB format. You can receive palette data as an array Longs - ' from function FreeImage_GetPaletteExLong. - ' Although ReservePalette is of type Variant, arrays of type RGBQUAD can not be - ' passed, as long as RGBQUAD is not declared as a public type in a public object - ' module. So, when dealing with RGBQUAD arrays, you are stuck on VarPtr or may - ' use function FreeImage_GetPalettePtr, which is a more meaningfully named - ' convenience wrapper around VarPtr. - - ' The optional 'UnloadSource' parameter is for unloading the original image, so - ' you can "change" an image with this function rather than getting a new DIB - ' pointer. There is no more need for a second DIB variable at the caller's site. - - ' All other parameters work according to the FreeImage API documentation. - - ' Note: Currently, any provided ReservePalette is only used, if quantize is - ' FIQ_NNQUANT. This seems to be either a bug or an undocumented - ' limitation of the FreeImage library (up to version 3.11.0). - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to quantize a 'header-only' bitmap.") - End If - - If (FreeImage_GetBPP(Bitmap) <> 24) Then - hTmp = Bitmap - Bitmap = FreeImage_ConvertTo24Bits(Bitmap) - If (UnloadSource) Then - Call FreeImage_Unload(hTmp) - End If - UnloadSource = True - End If - - ' adjust PaletteSize - If (PaletteSize < 2) Then - PaletteSize = 2 - ElseIf (PaletteSize > 256) Then - PaletteSize = 256 - End If - - lpPalette = pGetMemoryBlockPtrFromVariant(ReservePalette, lBlockSize, lElementSize) - FreeImage_ColorQuantizeEx = FreeImage_ColorQuantizeExInt(Bitmap, QuantizeMethod, _ - PaletteSize, ReserveSize, lpPalette) - - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_GetPalettePtr(ByRef Palette() As RGBQUAD) As Long - - ' Returns a pointer to an array of RGBQUAD. This is sometimes referred to as - ' a palette. - - FreeImage_GetPalettePtr = VarPtr(Palette(0)) - -End Function - - -' Image Rescale wrapper functions - -Public Function FreeImage_RescaleEx(ByVal Bitmap As Long, _ - Optional ByVal Width As Variant, _ - Optional ByVal Height As Variant, _ - Optional ByVal IsPercentValue As Boolean, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As Long - -Dim lNewWidth As Long -Dim lNewHeight As Long -Dim hDIBNew As Long - - ' This function is a easy-to-use wrapper for rescaling an image with the - ' FreeImage library. It returns a pointer to a new rescaled DIB provided - ' by FreeImage. - - ' The parameters 'Width', 'Height' and 'IsPercentValue' control - ' the size of the new image. Here, the function tries to fake something like - ' overloading known from Java. It depends on the parameter's data type passed - ' through the Variant, how the provided values for width and height are - ' actually interpreted. The following rules apply: - - ' In general, non integer values are either interpreted as percent values or - ' factors, the original image size will be multiplied with. The 'IsPercentValue' - ' parameter controls whether the values are percent values or factors. Integer - ' values are always considered to be the direct new image size, not depending on - ' the original image size. In that case, the 'IsPercentValue' parameter has no - ' effect. If one of the parameters is omitted, the image will not be resized in - ' that direction (either in width or height) and keeps it's original size. It is - ' possible to omit both, but that makes actually no sense. - - ' The following table shows some of possible data type and value combinations - ' that might by used with that function: (assume an original image sized 100x100 px) - - ' Parameter | Values | Values | Values | Values | Values | - ' ---------------------------------------------------------------------- - ' Width | 75.0 | 0.85 | 200 | 120 | 400.0 | - ' Height | 120.0 | 1.3 | 230 | - | 400.0 | - ' IsPercentValue | True | False | d.c. | d.c. | False | <- wrong option? - ' ---------------------------------------------------------------------- - ' Result Size | 75x120 | 85x130 | 200x230 | 120x100 |40000x40000 | - ' Remarks | percent | factor | direct | |maybe not | - ' |what you | - ' |wanted, | - ' |right? | - - ' The optional 'UnloadSource' parameter is for unloading the original image, so - ' you can "change" an image with this function rather than getting a new DIB - ' pointer. There is no more need for a second DIB variable at the caller's site. - - ' As of version 2.0 of the FreeImage VB wrapper, this function and all it's derived - ' functions like FreeImage_RescaleByPixel() or FreeImage_RescaleByPercent(), do NOT - ' return a clone of the image, if the new size desired is the same as the source - ' image's size. That behaviour can be forced by setting the new parameter - ' 'ForceCloneCreation' to True. Then, an image is also rescaled (and so - ' effectively cloned), if the new width and height is exactly the same as the source - ' image's width and height. - - ' Since this diversity may be confusing to VB developers, this function is also - ' callable through three different functions called 'FreeImage_RescaleByPixel', - ' 'FreeImage_RescaleByPercent' and 'FreeImage_RescaleByFactor'. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to rescale a 'header-only' bitmap.") - End If - - If (Not IsMissing(Width)) Then - Select Case VarType(Width) - - Case vbDouble, vbSingle, vbDecimal, vbCurrency - lNewWidth = FreeImage_GetWidth(Bitmap) * Width - If (IsPercentValue) Then - lNewWidth = lNewWidth / 100 - End If - - Case Else - lNewWidth = Width - - End Select - End If - - If (Not IsMissing(Height)) Then - Select Case VarType(Height) - - Case vbDouble, vbSingle, vbDecimal - lNewHeight = FreeImage_GetHeight(Bitmap) * Height - If (IsPercentValue) Then - lNewHeight = lNewHeight / 100 - End If - - Case Else - lNewHeight = Height - - End Select - End If - - If ((lNewWidth > 0) And (lNewHeight > 0)) Then - If (ForceCloneCreation) Then - hDIBNew = FreeImage_Rescale(Bitmap, lNewWidth, lNewHeight, Filter) - - ElseIf ((lNewWidth <> FreeImage_GetWidth(Bitmap)) Or _ - (lNewHeight <> FreeImage_GetHeight(Bitmap))) Then - hDIBNew = FreeImage_Rescale(Bitmap, lNewWidth, lNewHeight, Filter) - - End If - - ElseIf (lNewWidth > 0) Then - If ((lNewWidth <> FreeImage_GetWidth(Bitmap)) Or _ - (ForceCloneCreation)) Then - lNewHeight = lNewWidth / (FreeImage_GetWidth(Bitmap) / FreeImage_GetHeight(Bitmap)) - hDIBNew = FreeImage_Rescale(Bitmap, lNewWidth, lNewHeight, Filter) - End If - - ElseIf (lNewHeight > 0) Then - If ((lNewHeight <> FreeImage_GetHeight(Bitmap)) Or _ - (ForceCloneCreation)) Then - lNewWidth = lNewHeight * (FreeImage_GetWidth(Bitmap) / FreeImage_GetHeight(Bitmap)) - hDIBNew = FreeImage_Rescale(Bitmap, lNewWidth, lNewHeight, Filter) - End If - - End If - - If (hDIBNew) Then - FreeImage_RescaleEx = hDIBNew - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - Else - FreeImage_RescaleEx = Bitmap - End If - End If - -End Function - -Public Function FreeImage_RescaleByPixel(ByVal Bitmap As Long, _ - Optional ByVal WidthInPixels As Long, _ - Optional ByVal HeightInPixels As Long, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As Long - - ' Thin wrapper for function 'FreeImage_RescaleEx' for removing method - ' overload fake. This function rescales the image directly to the size - ' specified by the 'WidthInPixels' and 'HeightInPixels' parameters. - - FreeImage_RescaleByPixel = FreeImage_RescaleEx(Bitmap, WidthInPixels, HeightInPixels, False, _ - UnloadSource, Filter, ForceCloneCreation) - -End Function - -Public Function FreeImage_RescaleByPercent(ByVal Bitmap As Long, _ - Optional ByVal WidthPercentage As Double, _ - Optional ByVal HeightPercentage As Double, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As Long - - ' Thin wrapper for function 'FreeImage_RescaleEx' for removing method - ' overload fake. This function rescales the image by a percent value - ' based on the image's original size. - - FreeImage_RescaleByPercent = FreeImage_RescaleEx(Bitmap, WidthPercentage, HeightPercentage, True, _ - UnloadSource, Filter, ForceCloneCreation) - -End Function - -Public Function FreeImage_RescaleByFactor(ByVal Bitmap As Long, _ - Optional ByVal WidthFactor As Double, _ - Optional ByVal HeightFactor As Double, _ - Optional ByVal UnloadSource As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As Long - - ' Thin wrapper for function 'FreeImage_RescaleEx' for removing method - ' overload fake. This function rescales the image by a factor - ' based on the image's original size. - - FreeImage_RescaleByFactor = FreeImage_RescaleEx(Bitmap, WidthFactor, HeightFactor, False, _ - UnloadSource, Filter, ForceCloneCreation) - -End Function - -' Painting functions - -Public Function FreeImage_PaintDC(ByVal hDC As Long, _ - ByVal Bitmap As Long, _ - Optional ByVal XDst As Long, _ - Optional ByVal YDst As Long, _ - Optional ByVal XSrc As Long, _ - Optional ByVal YSrc As Long, _ - Optional ByVal Width As Long, _ - Optional ByVal Height As Long) As Long - - ' This function draws a FreeImage DIB directly onto a device context (DC). There - ' are many (selfexplaining?) parameters that control the visual result. - - ' Parameters 'XDst' and 'YDst' specify the point where the output should - ' be painted and 'XSrc', 'YSrc', 'Width' and 'Height' span a rectangle - ' in the source image 'Bitmap' that defines the area to be painted. - - ' If any of parameters 'Width' and 'Height' is zero, it is transparently substituted - ' by the width or height of teh bitmap to be drawn, resprectively. - - If ((hDC <> 0) And (Bitmap <> 0)) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to paint a 'header-only' bitmap.") - End If - - If (Width = 0) Then - Width = FreeImage_GetWidth(Bitmap) - End If - - If (Height = 0) Then - Height = FreeImage_GetHeight(Bitmap) - End If - - FreeImage_PaintDC = SetDIBitsToDevice(hDC, XDst, YDst - YSrc, Width, Height, XSrc, YSrc, 0, _ - Height, FreeImage_GetBits(Bitmap), FreeImage_GetInfo(Bitmap), DIB_RGB_COLORS) - End If - -End Function - -Public Function FreeImage_PaintDCEx(ByVal hDC As Long, _ - ByVal Bitmap As Long, _ - Optional ByVal XDst As Long, _ - Optional ByVal YDst As Long, _ - Optional ByVal WidthDst As Long, _ - Optional ByVal HeightDst As Long, _ - Optional ByVal XSrc As Long, _ - Optional ByVal YSrc As Long, _ - Optional ByVal WidthSrc As Long, _ - Optional ByVal HeightSrc As Long, _ - Optional ByVal DrawMode As DRAW_MODE = DM_DRAW_DEFAULT, _ - Optional ByVal RasterOperator As RASTER_OPERATOR = ROP_SRCCOPY, _ - Optional ByVal StretchMode As STRETCH_MODE = SM_COLORONCOLOR) As Long - -Dim eLastStretchMode As STRETCH_MODE - - ' This function draws a FreeImage DIB directly onto a device context (DC). There - ' are many (selfexplaining?) parameters that control the visual result. - - ' The main difference of this function compared to the 'FreeImage_PaintDC' is, - ' that this function supports both mirroring and stretching of the image to be - ' painted and so, is somewhat slower than 'FreeImage_PaintDC'. - - If ((hDC <> 0) And (Bitmap <> 0)) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to paint a 'header-only' bitmap.") - End If - - eLastStretchMode = GetStretchBltMode(hDC) - Call SetStretchBltMode(hDC, StretchMode) - - If (WidthSrc = 0) Then - WidthSrc = FreeImage_GetWidth(Bitmap) - End If - If (WidthDst = 0) Then - WidthDst = WidthSrc - End If - - If (HeightSrc = 0) Then - HeightSrc = FreeImage_GetHeight(Bitmap) - End If - If (HeightDst = 0) Then - HeightDst = HeightSrc - End If - - If (DrawMode And DM_MIRROR_VERTICAL) Then - YDst = HeightDst - HeightDst = -HeightDst - End If - - If (DrawMode And DM_MIRROR_HORIZONTAL) Then - XDst = WidthDst - WidthDst = -WidthDst - End If - - Call StretchDIBits(hDC, XDst, YDst, WidthDst, HeightDst, XSrc, YSrc, WidthSrc, HeightSrc, _ - FreeImage_GetBits(Bitmap), FreeImage_GetInfo(Bitmap), DIB_RGB_COLORS, RasterOperator) - - ' restore last mode - Call SetStretchBltMode(hDC, eLastStretchMode) - End If - -End Function - -Public Function FreeImage_PaintTransparent(ByVal hDC As Long, _ - ByVal Bitmap As Long, _ - Optional ByVal XDst As Long = 0, _ - Optional ByVal YDst As Long = 0, _ - Optional ByVal WidthDst As Long, _ - Optional ByVal HeightDst As Long, _ - Optional ByVal XSrc As Long = 0, _ - Optional ByVal YSrc As Long = 0, _ - Optional ByVal WidthSrc As Long, _ - Optional ByVal HeightSrc As Long, _ - Optional ByVal Alpha As Byte = 255) As Long - -Dim lpPalette As Long -Dim bIsTransparent As Boolean - - ' This function paints a device independent bitmap to any device context and - ' thereby honors any transparency information associated with the bitmap. - ' Furthermore, through the 'Alpha' parameter, an overall transparency level - ' may be specified. - - ' For palletised images, any color set to be transparent in the transparency - ' table, will be transparent. For high color images, only 32-bit images may - ' have any transparency information associated in their alpha channel. Only - ' these may be painted with transparency by this function. - - ' Since this is a wrapper for the Windows GDI function AlphaBlend(), 31-bit - ' images, containing alpha (or per-pixel) transparency, must be 'premultiplied' - ' for alpha transparent regions to actually show transparent. See MSDN help - ' on the AlphaBlend() function. - - ' FreeImage also offers a function to premultiply 32-bit bitmaps with their alpha - ' channel, according to the needs of AlphaBlend(). Have a look at function - ' FreeImage_PreMultiplyWithAlpha(). - - ' Overall transparency level may be specified for all bitmaps in all color - ' depths supported by FreeImage. If needed, bitmaps are transparently converted - ' to 32-bit and unloaded after the paint operation. This is also true for palletised - ' bitmaps. - - ' Parameters 'hDC' and 'Bitmap' seem to be very self-explanatory. All other parameters - ' are optional. The group of '*Dest*' parameters span a rectangle on the destination - ' device context, used as drawing area for the bitmap. If these are omitted, the - ' bitmap will be drawn starting at position 0,0 in the bitmap's actual size. - ' The group of '*Src*' parameters span a rectangle on the source bitmap, used as - ' cropping area for the paint operation. If both rectangles differ in size in any - ' direction, the part of the image actually painted is stretched for to fit into - ' the drawing area. If any of the parameters '*Width' or '*Height' are omitted, - ' the bitmap's actual size (width or height) will be used. - - ' The 'Alpha' parameter specifies the overall transparency. It takes values in the - ' range from 0 to 255. Using 0 will paint the bitmap fully transparent, 255 will - ' paint the image fully opaque. The 'Alpha' value controls, how the non per-pixel - ' portions of the image will be drawn. - - If ((hDC <> 0) And (Bitmap <> 0)) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to paint a 'header-only' bitmap.") - End If - - ' get image width if not specified - If (WidthSrc = 0) Then - WidthSrc = FreeImage_GetWidth(Bitmap) - End If - If (WidthDst = 0) Then - WidthDst = WidthSrc - End If - - ' get image height if not specified - If (HeightSrc = 0) Then - HeightSrc = FreeImage_GetHeight(Bitmap) - End If - If (HeightDst = 0) Then - HeightDst = HeightSrc - End If - - lpPalette = FreeImage_GetPalette(Bitmap) - If (lpPalette) Then - - Dim lPaletteSize As Long - Dim alPalOrg(255) As Long - Dim alPalMod(255) As Long - Dim alPalMask(255) As Long - Dim abTT() As Byte - Dim i As Long - - lPaletteSize = FreeImage_GetColorsUsed(Bitmap) * 4 - Call CopyMemory(alPalOrg(0), ByVal lpPalette, lPaletteSize) - Call CopyMemory(alPalMod(0), ByVal lpPalette, lPaletteSize) - abTT = FreeImage_GetTransparencyTableEx(Bitmap) - - If ((Alpha = 255) And _ - (HeightDst >= HeightSrc) And (WidthDst >= WidthSrc)) Then - - ' create a mask palette and a modified version of the - ' original palette - For i = 0 To UBound(abTT) - If (abTT(i) = 0) Then - alPalMask(i) = &HFFFFFFFF - alPalMod(i) = &H0 - bIsTransparent = True - End If - Next i - - If (Not bIsTransparent) Then - - ' if there is no transparency in the image, paint it with - ' a single SRCCOPY - Call StretchDIBits(hDC, _ - XDst, YDst, WidthDst, HeightDst, _ - XSrc, YSrc, WidthSrc, HeightSrc, _ - FreeImage_GetBits(Bitmap), _ - FreeImage_GetInfo(Bitmap), _ - DIB_RGB_COLORS, SRCCOPY) - Else - - ' set mask palette and paint with SRCAND - Call CopyMemory(ByVal lpPalette, alPalMask(0), lPaletteSize) - Call StretchDIBits(hDC, _ - XDst, YDst, WidthDst, HeightDst, _ - XSrc, YSrc, WidthSrc, HeightSrc, _ - FreeImage_GetBits(Bitmap), _ - FreeImage_GetInfo(Bitmap), _ - DIB_RGB_COLORS, SRCAND) - - ' set mask modified and paint with SRCPAINT - Call CopyMemory(ByVal lpPalette, alPalMod(0), lPaletteSize) - Call StretchDIBits(hDC, _ - XDst, YDst, WidthDst, HeightDst, _ - XSrc, YSrc, WidthSrc, HeightSrc, _ - FreeImage_GetBits(Bitmap), _ - FreeImage_GetInfo(Bitmap), _ - DIB_RGB_COLORS, SRCPAINT) - - ' restore original palette - Call CopyMemory(ByVal lpPalette, alPalOrg(0), lPaletteSize) - End If - - ' we are done, do not paint with AlphaBlend() any more - Bitmap = 0 - Else - - ' create a premultiplied palette - ' since we have no real per pixel transparency in a palletized - ' image, we only need to set all transparent colors to null. - For i = 0 To UBound(abTT) - If (abTT(i) = 0) Then - alPalMod(i) = 0 - End If - Next i - - ' set premultiplied palette and convert to 32 bits - Call CopyMemory(ByVal lpPalette, alPalMod(0), lPaletteSize) - Bitmap = FreeImage_ConvertTo32Bits(Bitmap) - - ' restore original palette - Call CopyMemory(ByVal lpPalette, alPalOrg(0), lPaletteSize) - End If - End If - - If (Bitmap) Then - Dim hMemDC As Long - Dim hBitmap As Long - Dim hBitmapOld As Long - Dim tBF As BLENDFUNCTION - Dim lBF As Long - - hMemDC = CreateCompatibleDC(0) - If (hMemDC) Then - hBitmap = FreeImage_GetBitmap(Bitmap, hMemDC) - hBitmapOld = SelectObject(hMemDC, hBitmap) - - With tBF - .BlendOp = AC_SRC_OVER - .SourceConstantAlpha = Alpha - If (FreeImage_GetBPP(Bitmap) = 32) Then - .AlphaFormat = AC_SRC_ALPHA - End If - End With - Call CopyMemory(lBF, tBF, 4) - - Call AlphaBlend(hDC, XDst, YDst, WidthDst, HeightDst, _ - hMemDC, XSrc, YSrc, WidthSrc, HeightSrc, _ - lBF) - - Call SelectObject(hMemDC, hBitmapOld) - Call DeleteObject(hBitmap) - Call DeleteDC(hMemDC) - If (lpPalette) Then - Call FreeImage_Unload(Bitmap) - End If - End If - End If - End If - -End Function - - -'-------------------------------------------------------------------------------- -' Pixel access functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetBitsEx(ByVal Bitmap As Long) As Byte() - -Dim tSA As SAVEARRAY2D -Dim lpSA As Long - - ' This function returns a two dimensional Byte array containing a DIB's - ' data-bits. This is done by wrapping a true VB array around the memory - ' block the returned pointer of FreeImage_GetBits() is pointing to. So, the - ' array returned provides full read and write acces to the image's data. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the FreeImage_DestroyLockedArray() function. - - If (Bitmap) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 1 ' size in bytes per array element - .cDims = 2 ' the array has 2 dimensions - .cElements1 = FreeImage_GetHeight(Bitmap) ' the number of elements in y direction (height of Bitmap) - .cElements2 = FreeImage_GetPitch(Bitmap) ' the number of elements in x direction (byte width of Bitmap) - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetBits(Bitmap) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(2, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named like the function is an array - ' variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetBitsEx), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetBitsExRGBTRIPLE(ByVal Bitmap As Long) As RGBTRIPLE() - -Dim tSA As SAVEARRAY2D -Dim lpSA As Long - - ' This function returns a two dimensional RGBTRIPLE array containing a DIB's - ' data-bits. This is done by wrapping a true VB array around the memory - ' block the returned pointer of 'FreeImage_GetBits' is pointing to. So, the - ' array returned provides full read and write acces to the image's data. - - ' This function only works with 24 bpp images and, since each FreeImage scanline - ' is aligned to a 32-bit boundary, only if the image's width in pixels multiplied - ' by three modulo four is zero. That means, that the image layout in memory must - ' "naturally" be aligned to a 32-bit boundary, since arrays do not support padding. - - ' So, the function only returns an initialized array, if this equotion is true: - ' (((ImageWidthPixels * 3) Mod 4) = 0) - - ' In other words, this is true for all images with no padding. - - ' For instance, only images with these widths will be suitable for this function: - ' 100, 104, 108, 112, 116, 120, 124, ... - - ' Have a look at the wrapper function 'FreeImage_GetScanlinesRGBTRIPLE()' to have - ' a way to work around that limitation. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - If (Bitmap) Then - - If (FreeImage_GetBPP(Bitmap) = 24) Then - If (((FreeImage_GetWidth(Bitmap) * 3) Mod 4) = 0) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 3 ' size in bytes per array element - .cDims = 2 ' the array has 2 dimensions - .cElements1 = FreeImage_GetHeight(Bitmap) ' the number of elements in y direction (height of Bitmap) - .cElements2 = FreeImage_GetWidth(Bitmap) ' the number of elements in x direction (byte width of Bitmap) - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetBits(Bitmap) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(2, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named like the function is an array - ' variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetBitsExRGBTRIPLE), lpSA, 4) - Else - - ' we could throw an error here - End If - Else - - ' we could throw an error here - End If - End If - -End Function - -Public Function FreeImage_GetBitsExRGBQUAD(ByVal Bitmap As Long) As RGBQUAD() - -Dim tSA As SAVEARRAY2D -Dim lpSA As Long - - ' This function returns a two dimensional RGBQUAD array containing a DIB's - ' data-bits. This is done by wrapping a true VB array around the memory - ' block the returned pointer of 'FreeImage_GetBits' is pointing to. So, the - ' array returned provides full read and write acces to the image's data. - - ' This function only works with 32 bpp images. Since each scanline must - ' "naturally" start at a 32-bit boundary if each pixel uses 32 bits, there - ' are no padding problems like these known with 'FreeImage_GetBitsExRGBTRIPLE', - ' so, this function is suitable for all 32 bpp images of any size. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - If (Bitmap) Then - - If (FreeImage_GetBPP(Bitmap) = 32) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes per array element - .cDims = 2 ' the array has 2 dimensions - .cElements1 = FreeImage_GetHeight(Bitmap) ' the number of elements in y direction (height of Bitmap) - .cElements2 = FreeImage_GetWidth(Bitmap) ' the number of elements in x direction (byte width of Bitmap) - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetBits(Bitmap) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(2, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named like the function is an array - ' variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetBitsExRGBQUAD), lpSA, 4) - Else - - ' we could throw an error here - End If - End If - -End Function - -Public Function FreeImage_GetScanLinesRGBTRIPLE(ByVal Bitmap As Long, _ - ByRef Scanlines As ScanLinesRGBTRIBLE, _ - Optional ByVal Reverse As Boolean) As Long -Dim lHeight As Long -Dim i As Long - - ' still undocumented - ' for now, have a look at function FreeImage_GetBitsExRGBTRIPLE() - - If (Bitmap) Then - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - If (FreeImage_GetBPP(Bitmap) = 24) Then - - lHeight = FreeImage_GetHeight(Bitmap) - ReDim Scanlines.Scanline(lHeight - 1) - For i = 0 To lHeight - 1 - If (Not Reverse) Then - Scanlines.Scanline(i).Data = FreeImage_GetScanLineBITMAP24(Bitmap, i) - Else - Scanlines.Scanline(i).Data = FreeImage_GetScanLineBITMAP24(Bitmap, lHeight - i - 1) - End If - Next i - End If - End If - End If - - FreeImage_GetScanLinesRGBTRIPLE = lHeight - -End Function - -Public Function FreeImage_GetScanLineEx(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Byte() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a one dimensional Byte array containing a whole - ' scanline's data-bits. This is done by wrapping a true VB array around - ' the memory block the returned pointer of 'FreeImage_GetScanline' is - ' pointing to. So, the array returned provides full read and write acces - ' to the image's data. - - ' This is the most generic function of a complete function set dealing with - ' scanline data, since this function returns an array of type Byte. It is - ' up to the caller of the function to interpret these bytes correctly, - ' according to the results of FreeImage_GetBPP and FreeImage_GetImageType. - - ' You may consider using any of the non-generic functions named - ' 'FreeImage_GetScanLineXXX', that return an array of proper type, according - ' to the images bit depth and type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - If (Bitmap) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 1 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetLine(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' allocate memory for an array descriptor - ' we cannot use the memory block used by tSA, since it is - ' released when tSA goes out of scope, leaving us with an - ' array with zeroed descriptor - ' we use nearly the same method that VB uses, so VB is able - ' to cleanup the array variable and it's descriptor; the - ' array data is not touched when cleaning up, since both AUTO - ' and FIXEDSIZE flags are set - Call SafeArrayAllocDescriptor(1, lpSA) - - ' copy our own array descriptor over the descriptor allocated - ' by SafeArrayAllocDescriptor; lpSA is a pointer to that memory - ' location - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - - ' the implicit variable named like the function is an array - ' variable in VB - ' make it point to the allocated array descriptor - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineEx), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineBITMAP8(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Byte() - - ' This function returns a one dimensional Byte array containing a whole - ' scanline's data-bits of a 8 bit bitmap image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' This function is just a thin wrapper for 'FreeImage_GetScanLineEx' but - ' includes checking of the image's bit depth and type, as all of the - ' non-generic scanline functions do. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - Select Case FreeImage_GetBPP(Bitmap) - - Case 1, 4, 8 - FreeImage_GetScanLineBITMAP8 = FreeImage_GetScanLineEx(Bitmap, Scanline) - - End Select - End If - -End Function - -Public Function FreeImage_GetScanLineBITMAP16(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Integer() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a one dimensional Integer array containing a whole - ' scanline's data-bits of a 16 bit bitmap image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - If (FreeImage_GetBPP(Bitmap) = 16) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 2 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineBITMAP16), lpSA, 4) - End If - End If - -End Function - -Public Function FreeImage_GetScanLineBITMAP24(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As RGBTRIPLE() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a one dimensional RGBTRIPLE array containing a whole - ' scanline's data-bits of a 24 bit bitmap image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayRGBTRIPLE' function. - - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - If (FreeImage_GetBPP(Bitmap) = 24) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 3 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineBITMAP24), lpSA, 4) - End If - End If - -End Function - -Public Function FreeImage_GetScanLineBITMAP32(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As RGBQUAD() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long - - ' This function returns a one dimensional RGBQUAD array containing a whole - ' scanline's data-bits of a 32 bit bitmap image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayRGBQUAD' function. - - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - If (FreeImage_GetBPP(Bitmap) = 32) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineBITMAP32), lpSA, 4) - End If - End If - -End Function - -Public Function FreeImage_GetScanLineINT16(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Integer() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional Integer array containing a whole - ' scanline's data-bits of a FIT_INT16 or FIT_UINT16 image. This is done - ' by wrapping a true VB array around the memory block the returned pointer - ' of 'FreeImage_GetScanline' is pointing to. So, the array returned - ' provides full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' Since VB does not distinguish between signed and unsigned data types, both - ' image types FIT_INT16 and FIT_UINT16 are handled with this function. If 'Bitmap' - ' specifies an image of type FIT_UINT16, it is up to the caller to treat the - ' array's Integers as unsigned, although VB knows signed Integers only. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If ((eImageType = FIT_INT16) Or _ - (eImageType = FIT_UINT16)) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 2 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineINT16), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineINT32(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Long() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional Long array containing a whole - ' scanline's data-bits of a FIT_INT32 or FIT_UINT32 image. This is done - ' by wrapping a true VB array around the memory block the returned pointer - ' of 'FreeImage_GetScanline' is pointing to. So, the array returned - ' provides full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' Since VB does not distinguish between signed and unsigned data types, both - ' image types FIT_INT32 and FIT_UINT32 are handled with this function. If 'Bitmap' - ' specifies an image of type FIT_UINT32, it is up to the caller to treat the - ' array's Longs as unsigned, although VB knows signed Longs only. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If ((eImageType = FIT_INT32) Or _ - (eImageType = FIT_UINT32)) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineINT32), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineFLOAT(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Single() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional Single array containing a whole - ' scanline's data-bits of a FIT_FLOAT image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_FLOAT) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 4 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineFLOAT), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineDOUBLE(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As Double() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional Double array containing a whole - ' scanline's data-bits of a FIT_DOUBLE image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArray' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_DOUBLE) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 8 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineDOUBLE), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineCOMPLEX(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As FICOMPLEX() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional FICOMPLEX array containing a whole - ' scanline's data-bits of a FIT_COMPLEX image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayFICOMPLEX' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_COMPLEX) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 16 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineCOMPLEX), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineRGB16(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As FIRGB16() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional FIRGB16 array containing a whole - ' scanline's data-bits of a FIT_RGB16 image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayFIRGB16' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_RGB16) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 6 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineRGB16), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineRGBA16(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As FIRGBA16() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional FIRGBA16 array containing a whole - ' scanline's data-bits of a FIT_RGBA16 image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayFIRGBA16' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_RGBA16) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 8 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineRGBA16), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineRGBF(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As FIRGBF() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional FIRGBF array containing a whole - ' scanline's data-bits of a FIT_RGBF image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayFIRGBF' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_RGBF) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 12 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineRGBF), lpSA, 4) - End If - -End Function - -Public Function FreeImage_GetScanLineRGBAF(ByVal Bitmap As Long, _ - ByVal Scanline As Long) As FIRGBAF() - -Dim tSA As SAVEARRAY1D -Dim lpSA As Long -Dim eImageType As FREE_IMAGE_TYPE - - ' This function returns a one dimensional FIRGBAF array containing a whole - ' scanline's data-bits of a FIT_RGBAF image. This is done by wrapping - ' a true VB array around the memory block the returned pointer of - ' 'FreeImage_GetScanline' is pointing to. So, the array returned provides - ' full read and write acces to the image's data. - - ' The function includes checking of the image's bit depth and type and - ' returns a non-initialized array if 'Bitmap' is an image of improper type. - - ' To reuse the caller's array variable, this function's result was assigned to, - ' before it goes out of scope, the caller's array variable must be destroyed with - ' the 'FreeImage_DestroyLockedArrayFIRGBAF' function. - - eImageType = FreeImage_GetImageType(Bitmap) - If (eImageType = FIT_RGBAF) Then - - ' create a proper SAVEARRAY descriptor - With tSA - .cbElements = 12 ' size in bytes per array element - .cDims = 1 ' the array has only 1 dimension - .cElements = FreeImage_GetWidth(Bitmap) ' the number of elements in the array - .fFeatures = FADF_AUTO Or FADF_FIXEDSIZE ' need AUTO and FIXEDSIZE for safety issues, - ' so the array can not be modified in size - ' or erased; according to Matthew Curland never - ' use FIXEDSIZE alone - .pvData = FreeImage_GetScanline(Bitmap, _ - Scanline) ' let the array point to the memory block, the - ' FreeImage scanline data pointer points to - End With - - ' For a complete source code documentation have a - ' look at the function 'FreeImage_GetScanLineEx' - Call SafeArrayAllocDescriptor(1, lpSA) - Call CopyMemory(ByVal lpSA, tSA, Len(tSA)) - Call CopyMemory(ByVal VarPtrArray(FreeImage_GetScanLineRGBAF), lpSA, 4) - End If - -End Function - -'-------------------------------------------------------------------------------- -' HBITMAP conversion functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetBitmap(ByVal Bitmap As Long, _ - Optional ByVal hDC As Long, _ - Optional ByVal UnloadSource As Boolean) As Long - -Dim bReleaseDC As Boolean -Dim ppvBits As Long - - ' This function returns an HBITMAP created by the CreateDIBSection() function which - ' in turn has the same color depth as the original DIB. A reference DC may be provided - ' through the 'hDC' parameter. The desktop DC will be used, if no reference DC is - ' specified. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a bitmap from a 'header-only' bitmap.") - End If - - If (hDC = 0) Then - hDC = GetDC(0) - bReleaseDC = True - End If - If (hDC) Then - FreeImage_GetBitmap = CreateDIBSection(hDC, FreeImage_GetInfo(Bitmap), _ - DIB_RGB_COLORS, ppvBits, 0, 0) - If ((FreeImage_GetBitmap <> 0) And (ppvBits <> 0)) Then - Call CopyMemory(ByVal ppvBits, ByVal FreeImage_GetBits(Bitmap), _ - FreeImage_GetHeight(Bitmap) * FreeImage_GetPitch(Bitmap)) - End If - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - If (bReleaseDC) Then - Call ReleaseDC(0, hDC) - End If - End If - End If - -End Function - -Public Function FreeImage_GetBitmapForDevice(ByVal Bitmap As Long, _ - Optional ByVal hDC As Long, _ - Optional ByVal UnloadSource As Boolean) As Long - -Dim bReleaseDC As Boolean - - ' This function returns an HBITMAP created by the CreateDIBitmap() function which - ' in turn has always the same color depth as the reference DC, which may be provided - ' through the 'hDC' parameter. The desktop DC will be used, if no reference DC is - ' specified. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a bitmap from a 'header-only' bitmap.") - End If - - If (hDC = 0) Then - hDC = GetDC(0) - bReleaseDC = True - End If - If (hDC) Then - FreeImage_GetBitmapForDevice = _ - CreateDIBitmap(hDC, FreeImage_GetInfoHeader(Bitmap), CBM_INIT, _ - FreeImage_GetBits(Bitmap), FreeImage_GetInfo(Bitmap), DIB_RGB_COLORS) - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - If (bReleaseDC) Then - Call ReleaseDC(0, hDC) - End If - End If - End If - -End Function - -'-------------------------------------------------------------------------------- -' OlePicture conversion functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetOlePicture(ByVal Bitmap As Long, _ - Optional ByVal hDC As Long, _ - Optional ByVal UnloadSource As Boolean) As IPicture - -Dim hBitmap As Long -Dim tPicDesc As PictDesc -Dim tGuid As Guid -Dim cPictureDisp As IPictureDisp - - ' This function creates a VB Picture object (OlePicture) from a FreeImage DIB. - ' The original image must not remain valid nor loaded after the VB Picture - ' object has been created. - - ' The optional parameter 'hDC' determines the device context (DC) used for - ' transforming the device independent bitmap (DIB) to a device dependent - ' bitmap (DDB). This device context's color depth is responsible for this - ' transformation. This parameter may be null or omitted. In that case, the - ' windows desktop's device context will be used, what will be the desired - ' way in almost any cases. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after the OlePicture has been created, so you can easiely "switch" from a - ' FreeImage DIB to a VB Picture object. There is no need to clean up the DIB - ' at the caller's site. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a picture from a 'header-only' bitmap.") - End If - - hBitmap = FreeImage_GetBitmap(Bitmap, hDC, UnloadSource) - If (hBitmap) Then - ' fill tPictDesc structure with necessary parts - With tPicDesc - .cbSizeofStruct = Len(tPicDesc) - ' the vbPicTypeBitmap constant is not available in VBA environemnts - .picType = 1 'vbPicTypeBitmap - .hImage = hBitmap - End With - - ' fill in IDispatch Interface ID - With tGuid - .Data1 = &H20400 - .Data4(0) = &HC0 - .Data4(7) = &H46 - End With - - ' create a picture object - Call OleCreatePictureIndirect(tPicDesc, tGuid, True, cPictureDisp) - Set FreeImage_GetOlePicture = cPictureDisp - End If - End If - -End Function - -Public Function FreeImage_GetOlePictureIcon(ByVal hIcon As Long) As IPicture - -Dim tPicDesc As PictDesc -Dim tGuid As Guid -Dim cPictureDisp As IPictureDisp - - ' This function creates a VB Picture object (OlePicture) of type picTypeIcon - ' from FreeImage hIcon handle. The hIcon handle must not remain valid nor loaded - ' after the VB Picture object has been created. - - ' The optional 'UnloadSource' parameter is for destroying the hIcon image - ' after the OlePicture has been created, so you can easiely "switch" from a - ' hIcon handle to a VB Picture object. There is no need to clean up the hIcon - ' at the caller's site. - - If (hIcon) Then - ' fill tPictDesc structure with necessary parts - With tPicDesc - .cbSizeofStruct = 12 - ' the vbPicTypeIcon constant is not available in VBA environemnts - .picType = 3 'vbPicTypeIcon - .hImage = hIcon - End With - - ' fill in IDispatch Interface ID - With tGuid - .Data1 = &H20400 - .Data4(0) = &HC0 - .Data4(7) = &H46 - End With - - ' create a picture object - Call OleCreatePictureIndirect(tPicDesc, tGuid, True, cPictureDisp) - Set FreeImage_GetOlePictureIcon = cPictureDisp - End If - -End Function - -Public Function FreeImage_GetOlePictureThumbnail(ByVal Bitmap As Long, _ - ByVal MaxPixelSize As Long, _ - Optional ByVal hDC As Long, _ - Optional ByVal UnloadSource As Boolean) As IPicture - -Dim hDIBThumbnail As Long - - ' This function is a IOlePicture aware wrapper for FreeImage_MakeThumbnail(). It - ' returns a VB Picture object instead of a FreeImage DIB. - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after the OlePicture has been created, so you can easiely "switch" from a - ' FreeImage DIB to a VB Picture object. There is no need to clean up the DIB - ' at the caller's site. - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a thumbnail picture from a 'header-only' bitmap.") - End If - - hDIBThumbnail = FreeImage_MakeThumbnail(Bitmap, MaxPixelSize) - Set FreeImage_GetOlePictureThumbnail = FreeImage_GetOlePicture(hDIBThumbnail, hDC, True) - - If (UnloadSource) Then - Call FreeImage_Unload(Bitmap) - End If - End If - -End Function - -Public Function FreeImage_CreateFromOlePicture(ByRef Picture As IPicture) As Long - -Dim hBitmap As Long -Dim tBM As BITMAP_API -Dim hDIB As Long -Dim hDC As Long -Dim lResult As Long -Dim nColors As Long -Dim lpInfo As Long - - ' Creates a FreeImage DIB from a VB Picture object (OlePicture). This function - ' returns a pointer to the DIB as, for instance, the FreeImage function - ' 'FreeImage_Load' does. So, this could be a real replacement for 'FreeImage_Load' - ' when working with VB Picture objects. - - If (Not Picture Is Nothing) Then - hBitmap = Picture.Handle - If (hBitmap) Then - lResult = GetObjectAPI(hBitmap, Len(tBM), tBM) - If (lResult) Then - hDIB = FreeImage_Allocate(tBM.bmWidth, _ - tBM.bmHeight, _ - tBM.bmBitsPixel) - If (hDIB) Then - ' The GetDIBits function clears the biClrUsed and biClrImportant BITMAPINFO - ' members (dont't know why). So we save these infos below. - ' This is needed for palletized images only. - nColors = FreeImage_GetColorsUsed(hDIB) - - hDC = GetDC(0) - lResult = GetDIBits(hDC, hBitmap, 0, _ - FreeImage_GetHeight(hDIB), _ - FreeImage_GetBits(hDIB), _ - FreeImage_GetInfo(hDIB), _ - DIB_RGB_COLORS) - If (lResult) Then - FreeImage_CreateFromOlePicture = hDIB - If (nColors) Then - ' restore BITMAPINFO members - ' FreeImage_GetInfo(Bitmap)->biClrUsed = nColors; - ' FreeImage_GetInfo(Bitmap)->biClrImportant = nColors; - lpInfo = FreeImage_GetInfo(hDIB) - Call CopyMemory(ByVal lpInfo + 32, nColors, 4) - Call CopyMemory(ByVal lpInfo + 36, nColors, 4) - End If - Else - Call FreeImage_Unload(hDIB) - End If - Call ReleaseDC(0, hDC) - End If - End If - End If - End If - -End Function - -Public Function FreeImage_CreateFromDC(ByVal hDC As Long, _ - Optional ByRef hBitmap As Long) As Long - -Dim tBM As BITMAP_API -Dim hDIB As Long -Dim lResult As Long -Dim nColors As Long -Dim lpInfo As Long - - ' Creates a FreeImage DIB from a Device Context/Compatible Bitmap. This - ' function returns a pointer to the DIB as, for instance, 'FreeImage_Load()' - ' does. So, this could be a real replacement for FreeImage_Load() or - ' 'FreeImage_CreateFromOlePicture()' when working with DCs and BITMAPs directly - - ' The 'hDC' parameter specifies a window device context (DC), the optional - ' parameter 'hBitmap' may specify a handle to a memory bitmap. When 'hBitmap' is - ' omitted, the bitmap currently selected into the given DC is used to create - ' the DIB. - - ' When 'hBitmap' is not missing but NULL (0), the function uses the DC's currently - ' selected bitmap. This bitmap's handle is stored in the ('ByRef'!) 'hBitmap' parameter - ' and so, is avaliable at the caller's site when the function returns. - - ' The DIB returned by this function is a copy of the image specified by 'hBitmap' or - ' the DC's current bitmap when 'hBitmap' is missing. The 'hDC' and also the 'hBitmap' - ' remain untouched in this function, there will be no objects destroyed or freed. - ' The caller is responsible to destroy or free the DC and BITMAP if necessary. - - ' first, check whether we got a hBitmap or not - If (hBitmap = 0) Then - ' if not, the parameter may be missing or is NULL so get the - ' DC's current bitmap - hBitmap = GetCurrentObject(hDC, OBJ_BITMAP) - End If - - lResult = GetObjectAPI(hBitmap, Len(tBM), tBM) - If (lResult) Then - hDIB = FreeImage_Allocate(tBM.bmWidth, _ - tBM.bmHeight, _ - tBM.bmBitsPixel) - If (hDIB) Then - ' The GetDIBits function clears the biClrUsed and biClrImportant BITMAPINFO - ' members (dont't know why). So we save these infos below. - ' This is needed for palletized images only. - nColors = FreeImage_GetColorsUsed(hDIB) - - lResult = GetDIBits(hDC, hBitmap, 0, _ - FreeImage_GetHeight(hDIB), _ - FreeImage_GetBits(hDIB), _ - FreeImage_GetInfo(hDIB), _ - DIB_RGB_COLORS) - - If (lResult) Then - FreeImage_CreateFromDC = hDIB - If (nColors) Then - ' restore BITMAPINFO members - ' FreeImage_GetInfo(Bitmap)->biClrUsed = nColors; - ' FreeImage_GetInfo(Bitmap)->biClrImportant = nColors; - lpInfo = FreeImage_GetInfo(hDIB) - Call CopyMemory(ByVal lpInfo + 32, nColors, 4) - Call CopyMemory(ByVal lpInfo + 36, nColors, 4) - End If - Else - Call FreeImage_Unload(hDIB) - End If - End If - End If - -End Function - -Public Function FreeImage_CreateFromImageContainer(ByRef Container As Object, _ - Optional ByVal IncludeDrawings As Boolean) As Long - - ' Creates a FreeImage DIB from a VB container control that has at least a - ' 'Picture' property. This function returns a pointer to the DIB as, for - ' instance, 'FreeImage_Load()' does. So, this could be a real replacement for - ' FreeImage_Load() or 'FreeImage_CreateFromOlePicture()' when working with - ' image hosting controls like Forms or PictureBoxes. - - ' The 'IncludeDrawings' parameter controls whether drawings, drawn with VB - ' methods like 'Container.Print()', 'Container.Line(x1, y1)-(x2, y2)' or - ' 'Container.Circle(x, y), radius' as the controls 'BackColor' should be included - ' into the newly created DIB. However, this only works, with control's that - ' have their 'AutoRedraw' property set to 'True'. - - ' To get the control's picture as well as it's BackColor and custom drawings, - ' this function uses the control's 'Image' property instead of the 'Picture' - ' property. - - ' This function treats Forms and PictureBox controls explicitly, since the - ' property sets and behaviours of these controls are publicly known. For any - ' other control, the function checks for the existence of an 'Image' and - ' 'AutoRedraw' property. If these are present and 'IncludeDrawings' is 'True', - ' the function uses the control's 'Image' property instead of the 'Picture' - ' property. This my be the case for UserControls. In any other case, the function - ' uses the control's 'Picture' property if present. If none of these properties - ' is present, a runtime error (5) is generated. - - ' Most of this function is actually implemented in the wrapper's private helper - ' function 'pGetIOlePictureFromContainer'. - - If (Not Container Is Nothing) Then - FreeImage_CreateFromImageContainer = FreeImage_CreateFromOlePicture( _ - pGetIOlePictureFromContainer(Container, _ - IncludeDrawings)) - End If - -End Function - -Public Function FreeImage_CreateFromScreen(Optional ByVal hWnd As Long, _ - Optional ByVal ClientAreaOnly As Boolean) As Long - -Dim hDC As Long -Dim lWidth As Long -Dim lHeight As Long -Dim hMemDC As Long -Dim hMemBMP As Long -Dim hMemOldBMP As Long -Dim tR As RECT - - ' Creates a FreeImage DIB from the screen which may either be the whole - ' desktop/screen or a certain window. A certain window may be specified - ' by it's window handle through the 'hWnd' parameter. By omitting this - ' parameter, the whole screen/desktop window will be captured. - - If (hWnd = 0) Then - hWnd = GetDesktopWindow() - hDC = GetDCEx(hWnd, 0, 0) - ' get desktop's width and height - lWidth = GetDeviceCaps(hDC, HORZRES) - lHeight = GetDeviceCaps(hDC, VERTRES) - - ElseIf (ClientAreaOnly) Then - ' get window's client area DC - hDC = GetDCEx(hWnd, 0, 0) - Call GetClientRect(hWnd, tR) - lWidth = tR.Right - lHeight = tR.Bottom - - Else - ' get window DC - hDC = GetDCEx(hWnd, 0, DCX_WINDOW) - Call GetWindowRect(hWnd, tR) - lWidth = tR.Right - tR.Left - lHeight = tR.Bottom - tR.Top - - End If - - ' create compatible memory DC and bitmap - hMemDC = CreateCompatibleDC(hDC) - hMemBMP = CreateCompatibleBitmap(hDC, lWidth, lHeight) - ' select compatible bitmap - hMemOldBMP = SelectObject(hMemDC, hMemBMP) - ' blit bits - Call BitBlt(hMemDC, 0, 0, lWidth, lHeight, hDC, 0, 0, SRCCOPY Or CAPTUREBLT) - - ' create FreeImage Bitmap from memory DC - FreeImage_CreateFromScreen = FreeImage_CreateFromDC(hMemDC, hMemBMP) - - ' clean up - Call SelectObject(hMemDC, hMemOldBMP) - Call DeleteObject(hMemBMP) - Call DeleteDC(hMemDC) - Call ReleaseDC(hWnd, hDC) - -End Function - -Public Function FreeImage_CreateMask(ByVal hDIB As Long, _ - Optional ByVal eMaskCreationOptions As FREE_IMAGE_MASK_CREATION_OPTION_FLAGS = MCOF_CREATE_MASK_IMAGE, _ - Optional ByVal lBitDepth As Long = 1, _ - Optional ByVal eMaskOptions As FREE_IMAGE_MASK_FLAGS = FIMF_MASK_FULL_TRANSPARENCY, _ - Optional ByVal vntMaskColors As Variant, _ - Optional ByVal eMaskColorsFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lColorTolerance As Long, _ - Optional ByVal lciMaskColorDst As Long = vbWhite, _ - Optional ByVal eMaskColorDstFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lciUnmaskColorDst As Long = vbBlack, _ - Optional ByVal eUnmaskColorDstFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal vlciMaskColorSrc As Variant, _ - Optional ByVal eMaskColorSrcFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal vlciUnmaskColorSrc As Variant, _ - Optional ByVal eUnmaskColorSrcFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB) As Long - -Dim hDIBResult As Long -Dim lBitDepthSrc As Long -Dim lWidth As Long -Dim lHeight As Long - -Dim bMaskColors As Boolean -Dim bMaskTransparency As Boolean -Dim bMaskFullTransparency As Boolean -Dim bMaskAlphaTransparency As Boolean -Dim bInvertMask As Boolean -Dim bHaveMaskColorSrc As Boolean -Dim bHaveUnmaskColorSrc As Boolean -Dim bCreateMaskImage As Boolean -Dim bModifySourceImage As Boolean -Dim alcMaskColors() As Long -Dim lMaskColorsMaxIndex As Long - -Dim lciMaskColorSrc As Long -Dim lciUnmaskColorSrc As Long - -Dim alPaletteSrc() As Long -Dim abTransparencyTableSrc() As Byte -Dim abBitsBSrc() As Byte -Dim atBitsTSrc As ScanLinesRGBTRIBLE -Dim atBitsQSrc() As RGBQUAD -Dim abBitValues(7) As Byte -Dim abBitMasks(7) As Byte -Dim abBitShifts(7) As Byte - -Dim atPaletteDst() As RGBQUAD -Dim abBitsBDst() As Byte -Dim atBitsTDst As ScanLinesRGBTRIBLE -Dim atBitsQDst() As RGBQUAD - -Dim bMaskPixel As Boolean -Dim X As Long -Dim x2 As Long -Dim lPixelIndex As Long -Dim Y As Long -Dim i As Long - - 'TODO: comment this function - - ' check for a proper bit depth of the destination (mask) image - If ((hDIB) And ((lBitDepth = 1) Or _ - (lBitDepth = 4) Or _ - (lBitDepth = 8) Or _ - (lBitDepth = 24) Or _ - (lBitDepth = 32))) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create a mask image from a 'header-only' bitmap.") - End If - - ' check for a proper bit depth of the source image - lBitDepthSrc = FreeImage_GetBPP(hDIB) - If ((lBitDepthSrc = 4) Or _ - (lBitDepthSrc = 8) Or _ - (lBitDepthSrc = 24) Or _ - (lBitDepthSrc = 32)) Then - - - ' get some information from eMaskCreationOptions - bCreateMaskImage = (eMaskCreationOptions And MCOF_CREATE_MASK_IMAGE) - bModifySourceImage = (eMaskCreationOptions And MCOF_MODIFY_SOURCE_IMAGE) - - - If (bCreateMaskImage) Then - - ' check mask color format - If (eMaskColorDstFormat And FICFF_COLOR_BGR) Then - ' if mask color is in BGR format, convert to RGB format - lciMaskColorDst = FreeImage_SwapColorLong(lciMaskColorDst) - - ElseIf (eMaskColorDstFormat And FICFF_COLOR_PALETTE_INDEX) Then - ' if mask color is specified as palette index, check, whether the - ' source image is a palletized image - Select Case lBitDepthSrc - - Case 1 - lciMaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciMaskColorDst And &H1) - - Case 4 - lciMaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciMaskColorDst And &HF) - - Case 8 - lciMaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciMaskColorDst And &HFF) - - End Select - End If - - ' check unmask color format - If (eUnmaskColorDstFormat And FICFF_COLOR_BGR) Then - ' if unmask color is in BGR format, convert to RGB format - lciUnmaskColorDst = FreeImage_SwapColorLong(lciUnmaskColorDst) - - ElseIf (eUnmaskColorDstFormat And FICFF_COLOR_PALETTE_INDEX) Then - ' if unmask color is specified as palette index, check, whether the - ' source image is a palletized image - Select Case lBitDepthSrc - - Case 1 - lciUnmaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciUnmaskColorDst And &H1) - - Case 4 - lciUnmaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciUnmaskColorDst And &HF) - - Case 8 - lciUnmaskColorDst = FreeImage_GetPaletteExLong(hDIB)(lciUnmaskColorDst And &HFF) - - End Select - End If - End If - - - If (bModifySourceImage) Then - - ' check, whether source image can be modified - bHaveMaskColorSrc = (Not IsMissing(vlciMaskColorSrc)) - bHaveUnmaskColorSrc = (Not IsMissing(vlciUnmaskColorSrc)) - - Select Case lBitDepthSrc - - Case 4, 8 - If (bHaveMaskColorSrc) Then - - ' get mask color as Long - lciMaskColorSrc = vlciMaskColorSrc - - If (eMaskColorSrcFormat And FICFF_COLOR_PALETTE_INDEX) Then - If (lBitDepthSrc = 4) Then - lciMaskColorSrc = (lciMaskColorSrc And &HF) - Else - lciMaskColorSrc = (lciMaskColorSrc And &HFF) - End If - Else - If (eMaskColorSrcFormat And FICFF_COLOR_BGR) Then - lciMaskColorSrc = FreeImage_SwapColorLong(lciMaskColorSrc, True) - End If - lciMaskColorSrc = FreeImage_SearchPalette(hDIB, lciMaskColorSrc) - bHaveMaskColorSrc = (lciMaskColorSrc <> -1) - End If - End If - - If (bHaveUnmaskColorSrc) Then - - ' get unmask color as Long - lciUnmaskColorSrc = vlciUnmaskColorSrc - - If (eUnmaskColorSrcFormat And FICFF_COLOR_PALETTE_INDEX) Then - If (lBitDepthSrc = 4) Then - lciUnmaskColorSrc = (lciUnmaskColorSrc And &HF) - Else - lciUnmaskColorSrc = (lciUnmaskColorSrc And &HFF) - End If - Else - If (eUnmaskColorSrcFormat And FICFF_COLOR_BGR) Then - lciUnmaskColorSrc = FreeImage_SwapColorLong(lciUnmaskColorSrc, True) - End If - lciUnmaskColorSrc = FreeImage_SearchPalette(hDIB, lciUnmaskColorSrc) - bHaveUnmaskColorSrc = (lciUnmaskColorSrc <> -1) - End If - End If - - ' check, if source image still can be modified in any way - bModifySourceImage = (bHaveMaskColorSrc Or bHaveUnmaskColorSrc) - - Case 24, 32 - If (bHaveMaskColorSrc) Then - - ' get mask color as Long - lciMaskColorSrc = vlciMaskColorSrc - - If (eMaskColorSrcFormat And FICFF_COLOR_BGR) Then - lciMaskColorSrc = FreeImage_SwapColorLong(lciMaskColorSrc, (lBitDepthSrc = 24)) - End If - End If - - If (bHaveUnmaskColorSrc) Then - - ' get unmask color as Long - lciUnmaskColorSrc = vlciUnmaskColorSrc - - If (eUnmaskColorSrcFormat And FICFF_COLOR_BGR) Then - lciUnmaskColorSrc = FreeImage_SwapColorLong(lciUnmaskColorSrc, (lBitDepthSrc = 24)) - End If - End If - - End Select - - End If - - - If ((bModifySourceImage) Or (bCreateMaskImage)) Then - - ' get some information from eMaskOptions - - ' check for inverse mask - bInvertMask = (eMaskOptions And FIMF_MASK_INVERSE_MASK) - - ' check for mask colors - bMaskColors = (eMaskOptions And FIMF_MASK_COLOR_TRANSPARENCY) - bMaskColors = bMaskColors And (Not IsMissing(vntMaskColors)) - If (bMaskColors) Then - ' validate specified mask colors; all mask colors are transferred to - ' an internal array of type Long - If (Not IsArray(vntMaskColors)) Then - ' color masking is only done when the single mask color is - ' a numeric (color) value - bMaskColors = IsNumeric(vntMaskColors) - If (bMaskColors) Then - ' this is not an array of mask colors but only a single - ' color; this is also transferred into an internal array - lMaskColorsMaxIndex = 0 - ReDim alcMaskColors(lMaskColorsMaxIndex) - alcMaskColors(lMaskColorsMaxIndex) = vntMaskColors - End If - Else - ' transfer all valid color values (numeric) into an internal - ' array - ReDim alcMaskColors(UBound(vntMaskColors)) - For i = LBound(vntMaskColors) To UBound(vntMaskColors) - bMaskColors = (IsNumeric(vntMaskColors(i))) - If (Not bMaskColors) Then - Exit For - Else - alcMaskColors(lMaskColorsMaxIndex) = vntMaskColors(i) - lMaskColorsMaxIndex = lMaskColorsMaxIndex + 1 - End If - Next i - If (bMaskColors) Then - lMaskColorsMaxIndex = lMaskColorsMaxIndex - 1 - End If - End If - End If - - ' check for transparency options - If ((FreeImage_IsTransparent(hDIB)) Or _ - ((eMaskOptions And FIMF_MASK_FORCE_TRANSPARENCY) > 0)) Then - bMaskFullTransparency = (eMaskOptions And FIMF_MASK_FULL_TRANSPARENCY) - bMaskAlphaTransparency = (eMaskOptions And FIMF_MASK_ALPHA_TRANSPARENCY) - bMaskTransparency = (bMaskFullTransparency Or bMaskAlphaTransparency) - End If - - ' get image dimension - lWidth = FreeImage_GetWidth(hDIB) - lHeight = FreeImage_GetHeight(hDIB) - - ' create proper accessors for the source image - Select Case lBitDepthSrc - - Case 4, 8 - ' images with a bit depth of 4 or 8 bits will both be - ' read through a byte array - abBitsBSrc = FreeImage_GetBitsEx(hDIB) - ' depending on where to get the transparency information from, - ' a palette or a transpareny table will be needed - If (bMaskColors) Then - alPaletteSrc = FreeImage_GetPaletteExLong(hDIB) - End If - If (bMaskTransparency) Then - abTransparencyTableSrc = FreeImage_GetTransparencyTableExClone(hDIB) - End If - - ' for 4 bit source images - If (lBitDepthSrc = 4) Then - ' two additional arrays need to be filled with values - ' to mask and shift nibbles to bytes - ' index 0 stands for the high nibble of the byte - abBitMasks(0) = &HF0 - abBitShifts(0) = &H10 ' a shift to right is implemented - ' as division in VB - ' index 1 stands for the low nibble of the byte - abBitMasks(1) = &HF - abBitShifts(1) = &H1 ' no shift needed for low nibble - End If - - Case 24 - ' images with a depth of 24 bits could not be used - ' through a two dimensional array in most cases, so get - ' an array of individual scanlines (see remarks concerning - ' pitch at function 'FreeImage_GetBitsExRGBTriple()') - Call FreeImage_GetScanLinesRGBTRIPLE(hDIB, atBitsTSrc) - - Case 32 - atBitsQSrc = FreeImage_GetBitsExRGBQUAD(hDIB) - - End Select - - - ' create mask image if needed - If (bCreateMaskImage) Then - - ' create mask image - hDIBResult = FreeImage_Allocate(lWidth, lHeight, lBitDepth) - ' if destination bit depth is 8 or below, a proper palette will - ' be needed, so create a palette where the unmask color is at - ' index 0 and the mask color is at index 1 - If (lBitDepth <= 8) Then - atPaletteDst = FreeImage_GetPaletteEx(hDIBResult) - Call CopyMemory(atPaletteDst(0), lciUnmaskColorDst, 4) - Call CopyMemory(atPaletteDst(1), lciMaskColorDst, 4) - End If - - ' create proper accessors for the new mask image - Select Case lBitDepth - - Case 1 - abBitsBDst = FreeImage_GetBitsEx(hDIBResult) - X = 1 - For i = 7 To 0 Step -1 - abBitValues(i) = X - X = X * 2 - Next i - - Case 4 - abBitsBDst = FreeImage_GetBitsEx(hDIBResult) - abBitValues(0) = &H10 - abBitValues(1) = &H1 - - Case 8 - abBitsBDst = FreeImage_GetBitsEx(hDIBResult) - - Case 24 - ' images with a depth of 24 bits could not be used - ' through a two dimensional array in most cases, so get - ' an array of individual scanlines (see remarks concerning - ' pitch at function 'FreeImage_GetBitsExRGBTriple()') - Call FreeImage_GetScanLinesRGBTRIPLE(hDIBResult, atBitsTDst) - - Case 32 - atBitsQDst = FreeImage_GetBitsExRGBQUAD(hDIBResult) - - End Select - End If - - ' walk the hole image - For Y = 0 To lHeight - 1 - For X = 0 To lWidth - 1 - - ' should transparency information be considered to create - ' the mask? - If (bMaskTransparency) Then - - Select Case lBitDepthSrc - - Case 4 - x2 = X \ 2 - lPixelIndex = (abBitsBSrc(x2, Y) And abBitMasks(X Mod 2)) \ abBitShifts(X Mod 2) - bMaskPixel = (abTransparencyTableSrc(lPixelIndex) = 0) - If (Not bMaskPixel) Then - bMaskPixel = ((abTransparencyTableSrc(lPixelIndex) < 255) And _ - (bMaskAlphaTransparency)) - End If - - Case 8 - bMaskPixel = (abTransparencyTableSrc(abBitsBSrc(X, Y)) = 0) - If (Not bMaskPixel) Then - bMaskPixel = ((abTransparencyTableSrc(abBitsBSrc(X, Y)) < 255) And _ - (bMaskAlphaTransparency)) - End If - - Case 24 - ' no transparency information in 24 bit images - ' reset bMaskPixel - bMaskPixel = False - - Case 32 - bMaskPixel = (atBitsQSrc(X, Y).rgbReserved = 0) - If (Not bMaskPixel) Then - bMaskPixel = ((atBitsQSrc(X, Y).rgbReserved < 255) And _ - (bMaskAlphaTransparency)) - End If - - End Select - Else - ' clear 'bMaskPixel' if no transparency information was checked - ' since the flag might be still True from the last loop - bMaskPixel = False - End If - - ' should color information be considered to create the mask? - ' do this only if the current pixel is not yet part of the mask - If ((bMaskColors) And (Not bMaskPixel)) Then - - Select Case lBitDepthSrc - - Case 4 - x2 = X \ 2 - lPixelIndex = (abBitsBSrc(x2, Y) And abBitMasks(X Mod 2)) \ abBitShifts(X Mod 2) - If (eMaskColorsFormat And FICFF_COLOR_PALETTE_INDEX) Then - For i = 0 To lMaskColorsMaxIndex - If (lColorTolerance = 0) Then - bMaskPixel = (lPixelIndex = alcMaskColors(i)) - Else - bMaskPixel = (FreeImage_CompareColorsLongLong( _ - alPaletteSrc(lPixelIndex), _ - alPaletteSrc(alcMaskColors(i)), _ - lColorTolerance, _ - FICFF_COLOR_RGB, FICFF_COLOR_RGB) = 0) - End If - If (bMaskPixel) Then - Exit For - End If - Next i - Else - For i = 0 To lMaskColorsMaxIndex - bMaskPixel = (FreeImage_CompareColorsLongLong( _ - alPaletteSrc(lPixelIndex), _ - alcMaskColors(i), lColorTolerance, _ - FICFF_COLOR_RGB, _ - (eMaskColorsFormat And FICFF_COLOR_FORMAT_ORDER_MASK)) = 0) - If (bMaskPixel) Then - Exit For - End If - Next i - End If - - Case 8 - If (eMaskColorsFormat And FICFF_COLOR_PALETTE_INDEX) Then - For i = 0 To lMaskColorsMaxIndex - If (lColorTolerance = 0) Then - bMaskPixel = (abBitsBSrc(X, Y) = alcMaskColors(i)) - Else - bMaskPixel = (FreeImage_CompareColorsLongLong( _ - alPaletteSrc(abBitsBSrc(X, Y)), _ - alPaletteSrc(alcMaskColors(i)), _ - lColorTolerance, _ - FICFF_COLOR_RGB, FICFF_COLOR_RGB) = 0) - End If - If (bMaskPixel) Then - Exit For - End If - Next i - Else - For i = 0 To lMaskColorsMaxIndex - bMaskPixel = (FreeImage_CompareColorsLongLong( _ - alPaletteSrc(abBitsBSrc(X, Y)), _ - alcMaskColors(i), lColorTolerance, _ - FICFF_COLOR_RGB, _ - (eMaskColorsFormat And FICFF_COLOR_FORMAT_ORDER_MASK)) = 0) - If (bMaskPixel) Then - Exit For - End If - Next i - End If - - Case 24 - For i = 0 To lMaskColorsMaxIndex - bMaskPixel = (FreeImage_CompareColorsRGBTRIPLELong( _ - atBitsTSrc.Scanline(Y).Data(X), _ - alcMaskColors(i), lColorTolerance, _ - (eMaskColorsFormat And FICFF_COLOR_FORMAT_ORDER_MASK)) = 0) - If (bMaskPixel) Then - Exit For - End If - Next i - - Case 32 - For i = 0 To lMaskColorsMaxIndex - bMaskPixel = (FreeImage_CompareColorsRGBQUADLong( _ - atBitsQSrc(X, Y), _ - alcMaskColors(i), lColorTolerance, _ - (eMaskColorsFormat And FICFF_COLOR_FORMAT_ORDER_MASK)) = 0) - If (bMaskPixel) Then - Exit For - End If - Next i - - End Select - - End If - - ' check whether a mask image needs to be created - If (bCreateMaskImage) Then - - ' write current pixel to destination (mask) image - Select Case lBitDepth - - Case 1 - x2 = X \ 8 - If ((bMaskPixel) Xor (bInvertMask)) Then - abBitsBDst(x2, Y) = abBitsBDst(x2, Y) Or abBitValues(X Mod 8) - End If - - Case 4 - x2 = X \ 2 - If ((bMaskPixel) Xor (bInvertMask)) Then - abBitsBDst(x2, Y) = abBitsBDst(x2, Y) Or abBitValues(X Mod 2) - End If - - Case 8 - If ((bMaskPixel) Xor (bInvertMask)) Then - abBitsBDst(X, Y) = 1 - End If - - Case 24 - If ((bMaskPixel) Xor (bInvertMask)) Then - Call CopyMemory(atBitsTDst.Scanline(Y).Data(X), lciMaskColorDst, 3) - Else - Call CopyMemory(atBitsTDst.Scanline(Y).Data(X), lciUnmaskColorDst, 3) - End If - - Case 32 - If ((bMaskPixel) Xor (bInvertMask)) Then - Call CopyMemory(atBitsQDst(X, Y), lciMaskColorDst, 4) - Else - Call CopyMemory(atBitsQDst(X, Y), lciUnmaskColorDst, 4) - End If - - End Select - End If - - ' check whether a source image needs to be modified - If (bModifySourceImage) Then - - Select Case lBitDepthSrc - - Case 4 - x2 = X \ 2 - If ((bMaskPixel) Xor (bInvertMask)) Then - If (bHaveMaskColorSrc) Then - abBitsBSrc(x2, Y) = _ - (abBitsBSrc(x2, Y) And (Not abBitMasks(X Mod 2))) Or _ - (lciMaskColorSrc * abBitShifts(X Mod 2)) - End If - ElseIf (bHaveUnmaskColorSrc) Then - abBitsBSrc(x2, Y) = _ - (abBitsBSrc(x2, Y) And (Not abBitMasks(X Mod 2))) Or _ - (lciUnmaskColorSrc * abBitShifts(X Mod 2)) - End If - - Case 8 - If ((bMaskPixel) Xor (bInvertMask)) Then - If (bHaveMaskColorSrc) Then - abBitsBSrc(X, Y) = lciMaskColorSrc - End If - ElseIf (bHaveUnmaskColorSrc) Then - abBitsBSrc(X, Y) = lciUnmaskColorSrc - End If - - Case 24 - If ((bMaskPixel) Xor (bInvertMask)) Then - If (bHaveMaskColorSrc) Then - Call CopyMemory(atBitsTSrc.Scanline(Y).Data(X), lciMaskColorSrc, 3) - End If - ElseIf (bHaveUnmaskColorSrc) Then - Call CopyMemory(atBitsTSrc.Scanline(Y).Data(X), lciUnmaskColorSrc, 3) - End If - - Case 32 - If ((bMaskPixel) Xor (bInvertMask)) Then - If (bHaveMaskColorSrc) Then - Call CopyMemory(atBitsQSrc(X, Y), lciMaskColorSrc, 4) - End If - ElseIf (bHaveUnmaskColorSrc) Then - Call CopyMemory(atBitsQSrc(X, Y), lciUnmaskColorSrc, 4) - End If - - End Select - End If - - Next X - Next Y - End If - End If - End If - - FreeImage_CreateMask = hDIBResult - -End Function - -Public Function FreeImage_CreateMaskImage(ByVal hDIB As Long, _ - Optional ByVal lBitDepth As Long = 1, _ - Optional ByVal eMaskOptions As FREE_IMAGE_MASK_FLAGS = FIMF_MASK_FULL_TRANSPARENCY, _ - Optional ByVal vntMaskColors As Variant, _ - Optional ByVal eMaskColorsFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lColorTolerance As Long, _ - Optional ByVal lciMaskColor As Long = vbWhite, _ - Optional ByVal eMaskColorFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lciUnmaskColor As Long = vbBlack, _ - Optional ByVal eUnmaskColorFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB) As Long - - 'TODO: comment this function - - FreeImage_CreateMaskImage = FreeImage_CreateMask(hDIB, MCOF_CREATE_MASK_IMAGE, _ - lBitDepth, eMaskOptions, _ - vntMaskColors, eMaskColorsFormat, _ - lColorTolerance, _ - lciMaskColor, eMaskColorFormat, _ - lciUnmaskColor, eUnmaskColorFormat) - -End Function - -Public Function FreeImage_CreateSimpleBWMaskImage(ByVal hDIB As Long, _ - Optional ByVal lBitDepth As Long = 1, _ - Optional ByVal eMaskOptions As FREE_IMAGE_MASK_FLAGS = FIMF_MASK_FULL_TRANSPARENCY, _ - Optional ByVal vntMaskColors As Variant, _ - Optional ByVal eMaskColorsFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lColorTolerance As Long) As Long - - 'TODO: comment this function - - FreeImage_CreateSimpleBWMaskImage = FreeImage_CreateMask(hDIB, MCOF_CREATE_MASK_IMAGE, _ - lBitDepth, eMaskOptions, _ - vntMaskColors, eMaskColorsFormat, _ - lColorTolerance, _ - vbWhite, FICFF_COLOR_RGB, _ - vbBlack, FICFF_COLOR_RGB) - -End Function - -Public Function FreeImage_CreateMaskInPlace(ByVal hDIB As Long, _ - Optional ByVal lBitDepth As Long = 1, _ - Optional ByVal eMaskOptions As FREE_IMAGE_MASK_FLAGS = FIMF_MASK_FULL_TRANSPARENCY, _ - Optional ByVal vntMaskColors As Variant, _ - Optional ByVal eMaskColorsFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lColorTolerance As Long, _ - Optional ByVal vlciMaskColor As Variant, _ - Optional ByVal eMaskColorFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal vlciUnmaskColor As Variant, _ - Optional ByVal eUnmaskColorFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB) As Long - - 'TODO: comment this function - - FreeImage_CreateMaskInPlace = FreeImage_CreateMask(hDIB, MCOF_MODIFY_SOURCE_IMAGE, _ - lBitDepth, eMaskOptions, _ - vntMaskColors, eMaskColorsFormat, _ - lColorTolerance, _ - , , , , _ - vlciMaskColor, eMaskColorFormat, _ - vlciUnmaskColor, eUnmaskColorFormat) - -End Function - -Public Function FreeImage_CreateSimpleBWMaskInPlace(ByVal hDIB As Long, _ - Optional ByVal lBitDepth As Long = 1, _ - Optional ByVal eMaskOptions As FREE_IMAGE_MASK_FLAGS = FIMF_MASK_FULL_TRANSPARENCY, _ - Optional ByVal vntMaskColors As Variant, _ - Optional ByVal eMaskColorsFormat As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal lColorTolerance As Long) As Long - - 'TODO: comment this function - - FreeImage_CreateSimpleBWMaskInPlace = FreeImage_CreateMask(hDIB, MCOF_MODIFY_SOURCE_IMAGE, _ - lBitDepth, eMaskOptions, _ - vntMaskColors, eMaskColorsFormat, _ - lColorTolerance, _ - , , , , _ - vbWhite, FICFF_COLOR_RGB, _ - vbBlack, FICFF_COLOR_RGB) - -End Function - -Public Function FreeImage_CreateMaskColors(ParamArray MaskColors() As Variant) As Variant - - ' this is just a FreeImage signed function that emulates VB's - ' builtin Array() function, that makes a variant array from - ' a ParamArray; so, a caller of the FreeImage_CreateMask() function - ' can specify all mask colors inline in the call statement - - ' hDibMask = FreeImage_CreateMask(hDib, 1, FIMF_MASK_COLOR_TRANSPARENCY, _ - ' FreeImage_CreateMaskColors(vbRed, vbGreen, vbBlack), _ - ' FICFF_COLOR_BGR, .... ) - - ' keep in mind, that VB colors (vbRed, vbBlue, etc.) are OLE colors that have - ' BRG format - - FreeImage_CreateMaskColors = MaskColors - -End Function - -Public Function FreeImage_SwapColorLong(ByVal Color As Long, _ - Optional ByVal IgnoreAlpha As Boolean) As Long - - ' This function swaps both color components Red (R) and Blue (B) in either - ' and RGB or BGR format color value stored in a Long value. This function is - ' used to convert from a RGB to a BGR color value and vice versa. - - If (Not IgnoreAlpha) Then - FreeImage_SwapColorLong = ((Color And &HFF000000) Or _ - ((Color And &HFF&) * &H10000) Or _ - (Color And &HFF00&) Or _ - ((Color And &HFF0000) \ &H10000)) - Else - FreeImage_SwapColorLong = (((Color And &HFF&) * &H10000) Or _ - (Color And &HFF00&) Or _ - ((Color And &HFF0000) \ &H10000)) - End If - -End Function - -Public Function FreeImage_CompareColorsLongLong(ByVal ColorA As Long, _ - ByVal ColorB As Long, _ - Optional ByVal Tolerance As Long, _ - Optional ByVal ColorTypeA As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_ARGB, _ - Optional ByVal ColorTypeB As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_ARGB) As Long - -Dim bFormatEqual As Boolean -Dim bAlphaEqual As Boolean - - ' This function compares two colors that both are specified as a 32 bit Long - ' value. - - ' Use both parameters 'ColorTypeA' and 'ColorTypeB' to specify each color's - ' format and 'Tolerance' to specify the matching tolerance. - - ' The function returns the result of the mathematical substraction - ' ColorA - ColorB, so if both colors are equal, the function returns NULL (0) - ' and any other value if both colors are different. Alpha transparency is taken into - ' account only if both colors are said to have an alpha transparency component by - ' both parameters 'ColorTypeA' and 'ColorTypeB'. If at least one of both colors - ' has no alpha transparency component, the comparison only includes the bits for - ' the red, green and blue component. - - ' The matching tolerance is applied to each color component (red, green, blue and - ' alpha) separately. So, when 'Tolerance' contains a value greater than zero, the - ' function returns NULL (0) when either both colors are exactly the same or the - ' differences of each corresponding color components are smaller or equal than - ' the given tolerance value. - - - If (((ColorTypeA And FICFF_COLOR_PALETTE_INDEX) Or _ - (ColorTypeB And FICFF_COLOR_PALETTE_INDEX)) = 0) Then - - bFormatEqual = ((ColorTypeA And FICFF_COLOR_FORMAT_ORDER_MASK) = _ - (ColorTypeB And FICFF_COLOR_FORMAT_ORDER_MASK)) - - bAlphaEqual = ((ColorTypeA And FICFF_COLOR_HAS_ALPHA) And _ - (ColorTypeB And FICFF_COLOR_HAS_ALPHA)) - - If (bFormatEqual) Then - If (bAlphaEqual) Then - FreeImage_CompareColorsLongLong = ColorA - ColorB - Else - FreeImage_CompareColorsLongLong = (ColorA And &HFFFFFF) - (ColorB And &HFFFFFF) - End If - Else - If (bAlphaEqual) Then - FreeImage_CompareColorsLongLong = ColorA - ((ColorB And &HFF000000) Or _ - ((ColorB And &HFF&) * &H10000) Or _ - (ColorB And &HFF00&) Or _ - ((ColorB And &HFF0000) \ &H10000)) - Else - FreeImage_CompareColorsLongLong = (ColorA And &HFFFFFF) - _ - (((ColorB And &HFF&) * &H10000) Or _ - (ColorB And &HFF00&) Or _ - ((ColorB And &HFF0000) \ &H10000)) - End If - End If - - If ((Tolerance > 0) And (FreeImage_CompareColorsLongLong <> 0)) Then - If (bFormatEqual) Then - If (Abs(((ColorA \ &H10000) And &HFF) - ((ColorB \ &H10000) And &HFF)) <= Tolerance) Then - If (Abs(((ColorA \ &H100) And &HFF) - ((ColorB \ &H100) And &HFF)) <= Tolerance) Then - If (Abs((ColorA And &HFF) - (ColorB And &HFF)) <= Tolerance) Then - If (bAlphaEqual) Then - If (Abs(((ColorA \ &H1000000) And &HFF) - _ - ((ColorB \ &H1000000) And &HFF)) <= Tolerance) Then - FreeImage_CompareColorsLongLong = 0 - End If - Else - FreeImage_CompareColorsLongLong = 0 - End If - End If - End If - End If - Else - If (Abs(((ColorA \ &H10000) And &HFF) - (ColorB And &HFF)) <= Tolerance) Then - If (Abs(((ColorA \ &H100) And &HFF) - ((ColorB \ &H100) And &HFF)) <= Tolerance) Then - If (Abs((ColorA And &HFF) - ((ColorB \ &H10000) And &HFF)) <= Tolerance) Then - If (bAlphaEqual) Then - If (Abs(((ColorA \ &H1000000) And &HFF) - _ - ((ColorB \ &H1000000) And &HFF)) <= Tolerance) Then - FreeImage_CompareColorsLongLong = 0 - End If - Else - FreeImage_CompareColorsLongLong = 0 - End If - End If - End If - End If - End If - End If - End If - -End Function - -Public Function FreeImage_CompareColorsRGBTRIPLELong(ByRef ColorA As RGBTRIPLE, _ - ByVal ColorB As Long, _ - Optional ByVal Tolerance As Long, _ - Optional ByVal ColorTypeB As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB) As Long - -Dim lcColorA As Long - - ' This is a function derived from 'FreeImage_CompareColorsLongLong()' to make color - ' comparisons between two colors whereby one color is provided as RGBTRIPLE and the - ' other color is provided as Long value. - - ' Have a look at the documentation of 'FreeImage_CompareColorsLongLong()' to learn - ' more about color comparisons. - - Call CopyMemory(lcColorA, ColorA, 3) - FreeImage_CompareColorsRGBTRIPLELong = FreeImage_CompareColorsLongLong(lcColorA, ColorB, _ - Tolerance, FICFF_COLOR_RGB, ColorTypeB) - -End Function - -Public Function FreeImage_CompareColorsRGBQUADLong(ByRef ColorA As RGBQUAD, _ - ByVal ColorB As Long, _ - Optional ByVal Tolerance As Long, _ - Optional ByVal ColorTypeB As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_ARGB) As Long - -Dim lcColorA As Long - - ' This is a function derived from 'FreeImage_CompareColorsLongLong()' to make color - ' comparisons between two colors whereby one color is provided as RGBQUAD and the - ' other color is provided as Long value. - - ' Have a look at the documentation of 'FreeImage_CompareColorsLongLong()' to learn - ' more about color comparisons. - - Call CopyMemory(lcColorA, ColorA, 4) - FreeImage_CompareColorsRGBQUADLong = FreeImage_CompareColorsLongLong(lcColorA, ColorB, _ - Tolerance, FICFF_COLOR_ARGB, ColorTypeB) - -End Function - -Public Function FreeImage_SearchPalette(ByVal Bitmap As Long, _ - ByVal Color As Long, _ - Optional ByVal Tolerance As Long, _ - Optional ByVal ColorType As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal TransparencyState As FREE_IMAGE_TRANSPARENCY_STATE_FLAGS = FITSF_IGNORE_TRANSPARENCY) As Long - -Dim abTransparencyTable() As Byte -Dim alPalette() As Long -Dim i As Long - - ' This function searches an image's color palette for a certain color specified as a - ' 32 bit Long value in either RGB or BGR format. - - ' A search tolerance may be specified in the 'Tolerance' parameter. - - ' If no transparency tabe was found for the specified image, transparency information will - ' be ignored during the search. Then, the function behaves as if FITSF_IGNORE_TRANSPARENCY - ' was specified for parameter TransparencyState. - - ' Use the 'TransparencyState' parameter to control, how the transparency state of - ' the found palette entry affects the result. These values may be used: - - ' FITSF_IGNORE_TRANSPARENCY: Returns the index of the first palette entry which - ' matches the red, green and blue components. - ' - ' FITSF_NONTRANSPARENT: Returns the index of the first palette entry which - ' matches the red, green and blue components and is - ' nontransparent (fully opaque). - ' - ' FITSF_TRANSPARENT: Returns the index of the first palette entry which - ' matches the red, green and blue components and is - ' fully transparent. - ' - ' FITSF_INCLUDE_ALPHA_TRANSPARENCY: Returns the index of the first palette entry which - ' matches the red, green and blue components as well - ' as the alpha transparency. - - ' When alpha transparency should be included in the palette search ('FITSF_INCLUDE_ALPHA_TRANSPARENCY'), - ' the alpha transparency of the color searched is taken from the left most byte of 'Color' - ' (Color is either in format ARGB or ABGR). The the alpha transparency of the palette entry - ' actually comes from the image's transparency table rather than from the palette, since palettes - ' do not contain transparency information. - - If (FreeImage_GetImageType(Bitmap) = FIT_BITMAP) Then - Select Case FreeImage_GetColorType(Bitmap) - - Case FIC_PALETTE, FIC_MINISBLACK, FIC_MINISWHITE - FreeImage_SearchPalette = -1 - alPalette = FreeImage_GetPaletteExLong(Bitmap) - If (FreeImage_GetTransparencyCount(Bitmap) > UBound(alPalette)) Then - abTransparencyTable = FreeImage_GetTransparencyTableExClone(Bitmap) - Else - TransparencyState = FITSF_IGNORE_TRANSPARENCY - End If - For i = 0 To UBound(alPalette) - If (FreeImage_CompareColorsLongLong(Color, alPalette(i), _ - Tolerance, _ - ColorType, FICFF_COLOR_RGB) = 0) Then - Select Case TransparencyState - - Case FITSF_IGNORE_TRANSPARENCY - FreeImage_SearchPalette = i - Exit For - - Case FITSF_NONTRANSPARENT - If (abTransparencyTable(i) = 255) Then - FreeImage_SearchPalette = i - Exit For - End If - - Case FITSF_TRANSPARENT - If (abTransparencyTable(i) = 0) Then - FreeImage_SearchPalette = i - Exit For - End If - - Case FITSF_INCLUDE_ALPHA_TRANSPARENCY - If (abTransparencyTable(i) = ((Color And &HFF000000) \ 1000000)) Then - FreeImage_SearchPalette = i - Exit For - End If - - End Select - End If - Next i - - Case Else - FreeImage_SearchPalette = -1 - - End Select - Else - FreeImage_SearchPalette = -1 - End If - -End Function - -Public Function FreeImage_GetIcon(ByVal hDIB As Long, _ - Optional ByVal eTransparencyOptions As FREE_IMAGE_ICON_TRANSPARENCY_OPTION_FLAGS = ITOF_USE_DEFAULT_TRANSPARENCY, _ - Optional ByVal lciTransparentColor As Long, _ - Optional ByVal eTransparentColorType As FREE_IMAGE_COLOR_FORMAT_FLAGS = FICFF_COLOR_RGB, _ - Optional ByVal hDC As Long, _ - Optional ByVal UnloadSource As Boolean) As Long - -Dim tIconInfo As ICONINFO -Dim bReleaseDC As Boolean -Dim bModifySourceImage As Boolean -Dim eMaskFlags As FREE_IMAGE_MASK_FLAGS -Dim lBitDepth As Long -Dim bPixelIndex As Byte -Dim hDIBSrc As Long -Dim hDIBMask As Long -Dim hBMPMask As Long -Dim hBmp As Long - - ' The optional 'UnloadSource' parameter is for unloading the original image - ' after the OlePicture has been created, so you can easiely "switch" from a - ' FreeImage DIB to a VB Picture object. There is no need to clean up the DIB - ' at the caller's site. - - If (hDIB) Then - - If (Not FreeImage_HasPixels(hDIB)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to create an icon from a 'header-only' bitmap.") - End If - - lBitDepth = FreeImage_GetBPP(hDIB) - - ' check whether the image supports transparency - Select Case lBitDepth - - Case 4, 8 - If (eTransparencyOptions And ITOF_USE_TRANSPARENCY_INFO) Then - If (FreeImage_IsTransparent(hDIB)) Then - eMaskFlags = FIMF_MASK_FULL_TRANSPARENCY - ElseIf (eTransparencyOptions And ITOF_FORCE_TRANSPARENCY_INFO) Then - If (FreeImage_IsTransparencyTableTransparent(hDIB)) Then - eMaskFlags = (FIMF_MASK_FULL_TRANSPARENCY And _ - FIMF_MASK_FORCE_TRANSPARENCY) - End If - End If - End If - If ((eMaskFlags = FIMF_MASK_NONE) And _ - (eTransparencyOptions And ITOF_USE_COLOR_TRANSPARENCY)) Then - - eMaskFlags = FIMF_MASK_COLOR_TRANSPARENCY - - Select Case (eTransparencyOptions And ITOF_USE_COLOR_BITMASK) - - Case ITOF_USE_COLOR_TOP_LEFT_PIXEL - Call FreeImage_GetPixelIndex(hDIB, _ - 0, FreeImage_GetHeight(hDIB) - 1, _ - bPixelIndex) - lciTransparentColor = bPixelIndex - eTransparentColorType = FICFF_COLOR_PALETTE_INDEX - - Case ITOF_USE_COLOR_TOP_RIGHT_PIXEL - Call FreeImage_GetPixelIndex(hDIB, _ - FreeImage_GetWidth(hDIB) - 1, FreeImage_GetHeight(hDIB) - 1, _ - bPixelIndex) - lciTransparentColor = bPixelIndex - eTransparentColorType = FICFF_COLOR_PALETTE_INDEX - - Case ITOF_USE_COLOR_BOTTOM_LEFT_PIXEL - Call FreeImage_GetPixelIndex(hDIB, _ - 0, 0, _ - bPixelIndex) - lciTransparentColor = bPixelIndex - eTransparentColorType = FICFF_COLOR_PALETTE_INDEX - - Case ITOF_USE_COLOR_BOTTOM_RIGHT_PIXEL - Call FreeImage_GetPixelIndex(hDIB, _ - FreeImage_GetWidth(hDIB) - 1, 0, _ - bPixelIndex) - lciTransparentColor = bPixelIndex - eTransparentColorType = FICFF_COLOR_PALETTE_INDEX - - End Select - End If - - bModifySourceImage = True - - Case 24, 32 - If ((lBitDepth = 32) And _ - (eTransparencyOptions And ITOF_USE_TRANSPARENCY_INFO)) Then - If (FreeImage_IsTransparent(hDIB)) Then - eMaskFlags = FIMF_MASK_FULL_TRANSPARENCY - End If - End If - If ((eMaskFlags = FIMF_MASK_NONE) And _ - (eTransparencyOptions And ITOF_USE_COLOR_TRANSPARENCY)) Then - - eMaskFlags = FIMF_MASK_COLOR_TRANSPARENCY - - Select Case (eTransparencyOptions And ITOF_USE_COLOR_BITMASK) - - Case ITOF_USE_COLOR_TOP_LEFT_PIXEL - Call FreeImage_GetPixelColorByLong(hDIB, _ - FreeImage_GetHeight(hDIB) - 1, 0, _ - lciTransparentColor) - eTransparentColorType = FICFF_COLOR_RGB - - Case ITOF_USE_COLOR_TOP_RIGHT_PIXEL - Call FreeImage_GetPixelColorByLong(hDIB, _ - FreeImage_GetHeight(hDIB) - 1, FreeImage_GetWidth(hDIB) - 1, _ - lciTransparentColor) - eTransparentColorType = FICFF_COLOR_RGB - - Case ITOF_USE_COLOR_BOTTOM_LEFT_PIXEL - Call FreeImage_GetPixelColorByLong(hDIB, _ - 0, 0, _ - lciTransparentColor) - eTransparentColorType = FICFF_COLOR_RGB - - Case ITOF_USE_COLOR_BOTTOM_RIGHT_PIXEL - Call FreeImage_GetPixelColorByLong(hDIB, _ - 0, FreeImage_GetWidth(hDIB) - 1, _ - lciTransparentColor) - eTransparentColorType = FICFF_COLOR_RGB - - End Select - End If - - bModifySourceImage = (lBitDepth = 24) - - End Select - - - If (bModifySourceImage) Then - hDIBSrc = FreeImage_Clone(hDIB) - hDIBMask = FreeImage_CreateMask(hDIBSrc, MCOF_CREATE_AND_MODIFY, _ - 1, eMaskFlags, _ - lciTransparentColor, eTransparentColorType, _ - , , , , , _ - FreeImage_SearchPalette(hDIBSrc, 0, , , _ - FITSF_NONTRANSPARENT), _ - FICFF_COLOR_PALETTE_INDEX) - Else - hDIBSrc = hDIB - hDIBMask = FreeImage_CreateMaskImage(hDIB, 1, FIMF_MASK_FULL_TRANSPARENCY) - End If - - If (hDC = 0) Then - hDC = GetDC(0) - bReleaseDC = True - End If - - hBmp = CreateDIBitmap(hDC, _ - FreeImage_GetInfoHeader(hDIBSrc), _ - CBM_INIT, _ - FreeImage_GetBits(hDIBSrc), _ - FreeImage_GetInfo(hDIBSrc), _ - DIB_RGB_COLORS) - - - hBMPMask = CreateDIBitmap(hDC, _ - FreeImage_GetInfoHeader(hDIBMask), _ - CBM_INIT, _ - FreeImage_GetBits(hDIBMask), _ - FreeImage_GetInfo(hDIBMask), _ - DIB_RGB_COLORS) - - If (bModifySourceImage) Then - Call FreeImage_Unload(hDIBSrc) - End If - - If (UnloadSource) Then - Call FreeImage_Unload(hDIB) - End If - - - If ((hBmp <> 0) And (hBMPMask <> 0)) Then - - With tIconInfo - .fIcon = True - .hBmMask = hBMPMask - .hbmColor = hBmp - End With - - FreeImage_GetIcon = CreateIconIndirect(tIconInfo) - End If - - If (bReleaseDC) Then - Call ReleaseDC(0, hDC) - End If - End If - -End Function - -Public Function FreeImage_AdjustPictureBox(ByRef Control As Object, _ - Optional ByVal Mode As FREE_IMAGE_ADJUST_MODE = AM_DEFAULT, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC) As IPicture - -Dim tR As RECT -Dim hDIB As Long -Dim hDIBTemp As Long -Dim lNewWidth As Long -Dim lNewHeight As Long - -Const vbObjectOrWithBlockVariableNotSet As Long = 91 - - ' This function adjusts an already loaded picture in a VB PictureBox - ' control in size. This is done by converting the picture to a Bitmap - ' by FreeImage_CreateFromOlePicture. After resizing the Bitmap it is - ' converted back to a Ole Picture object and re-assigned to the - ' PictureBox control. - - ' The Control paramater is actually of type Object so any object or control - ' providing Picture, hWnd, Width and Height properties can be used instead - ' of a PictureBox control - - ' This may be useful when using compile time provided images in VB like - ' logos or backgrounds that need to be resized during runtime. Using - ' FreeImage's sophisticated rescaling methods is a much better aproach - ' than using VB's stretchable Image control. - - ' One reason for resizing a usually fixed size logo or background image - ' may be the following scenario: - - ' When running on a Windows machine using smaller or bigger fonts (what can - ' be configured in the control panel by using different dpi fonts), the - ' operation system automatically adjusts the sizes of Forms, Labels, - ' TextBoxes, Frames and even PictureBoxes. So, the hole VB application is - ' perfectly adapted to these font metrics with the exception of compile time - ' provided images. Although the PictureBox control is resized, the containing - ' image remains untouched. This problem could be solved with this function. - - ' This function is also wrapped by the function 'AdjustPicture', giving you - ' a more VB common function name. - - - If (Not Control Is Nothing) Then - Call GetClientRect(Control.hWnd, tR) - If ((tR.Right <> Control.Picture.Width) Or _ - (tR.Bottom <> Control.Picture.Height)) Then - hDIB = FreeImage_CreateFromOlePicture(Control.Picture) - If (hDIB) Then - If (Mode = AM_ADJUST_OPTIMAL_SIZE) Then - If (Control.Picture.Width >= Control.Picture.Height) Then - Mode = AM_ADJUST_WIDTH - Else - Mode = AM_ADJUST_HEIGHT - End If - End If - - Select Case Mode - - Case AM_STRECH - lNewWidth = tR.Right - lNewHeight = tR.Bottom - - Case AM_ADJUST_WIDTH - lNewWidth = tR.Right - lNewHeight = lNewWidth / (Control.Picture.Width / Control.Picture.Height) - - Case AM_ADJUST_HEIGHT - lNewHeight = tR.Bottom - lNewWidth = lNewHeight * (Control.Picture.Width / Control.Picture.Height) - - End Select - - hDIBTemp = hDIB - hDIB = FreeImage_Rescale(hDIB, lNewWidth, lNewHeight, Filter) - Call FreeImage_Unload(hDIBTemp) - Set Control.Picture = FreeImage_GetOlePicture(hDIB, , True) - Set FreeImage_AdjustPictureBox = Control.Picture - End If - End If - Else - Call Err.Raise(vbObjectOrWithBlockVariableNotSet) - End If - -End Function - -Public Function AdjustPicture(ByRef Control As Object, _ - Optional ByRef Mode As FREE_IMAGE_ADJUST_MODE = AM_DEFAULT, _ - Optional ByRef Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC) As IPicture - - ' This function is a more VB friendly signed wrapper for - ' the FreeImage_AdjustPictureBox function. - - Set AdjustPicture = FreeImage_AdjustPictureBox(Control, Mode, Filter) - -End Function - -Public Function FreeImage_LoadEx(ByVal Filename As String, _ - Optional ByVal Options As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByVal Width As Variant, _ - Optional ByVal Height As Variant, _ - Optional ByVal InPercent As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As Long - -Const vbInvalidPictureError As Long = 481 - - ' The function provides all image formats, the FreeImage library can read. The - ' image format is determined from the image file to load, the optional parameter - ' 'Format' is an OUT parameter that will contain the image format that has - ' been loaded. - - ' The parameters 'Width', 'Height', 'InPercent' and 'Filter' make it possible - ' to "load" the image in a resized version. 'Width', 'Height' specify the desired - ' width and height, 'Filter' determines, what image filter should be used - ' on the resizing process. - - ' The parameters 'Width', 'Height', 'InPercent' and 'Filter' map directly to the - ' according parameters of the 'FreeImage_RescaleEx' function. So, read the - ' documentation of the 'FreeImage_RescaleEx' for a complete understanding of the - ' usage of these parameters. - - - Format = FreeImage_GetFileType(Filename) - If (Format <> FIF_UNKNOWN) Then - If (FreeImage_FIFSupportsReading(Format)) Then - FreeImage_LoadEx = FreeImage_Load(Format, Filename, Options) - If (FreeImage_LoadEx) Then - - If ((Not IsMissing(Width)) Or _ - (Not IsMissing(Height))) Then - FreeImage_LoadEx = FreeImage_RescaleEx(FreeImage_LoadEx, Width, Height, _ - InPercent, True, Filter) - End If - Else - Call Err.Raise(vbInvalidPictureError) - End If - Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "FreeImage Library plugin '" & FreeImage_GetFormatFromFIF(Format) & "' " & _ - "does not support reading.") - End If - Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "The file specified has an unknown image format.") - End If - -End Function - -Public Function LoadPictureEx(Optional ByRef Filename As Variant, _ - Optional ByRef Options As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByRef Width As Variant, _ - Optional ByRef Height As Variant, _ - Optional ByRef InPercent As Boolean, _ - Optional ByRef Filter As FREE_IMAGE_FILTER, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As IPicture - -Dim hDIB As Long - - ' This function is an extended version of the VB method 'LoadPicture'. As - ' the VB version it takes a filename parameter to load the image and throws - ' the same errors in most cases. - - ' This function now is only a thin wrapper for the FreeImage_LoadEx() wrapper - ' function (as compared to releases of this wrapper prior to version 1.8). So, - ' have a look at this function's discussion of the parameters. - - ' However, we do mask out the FILO_LOAD_NOPIXELS load option, since this - ' function shall create a VB Picture object, which does not support - ' FreeImage's header-only loading option. - - - If (Not IsMissing(Filename)) Then - hDIB = FreeImage_LoadEx(Filename, (Options And (Not FILO_LOAD_NOPIXELS)), _ - Width, Height, InPercent, Filter, Format) - Set LoadPictureEx = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_SaveEx(ByVal Bitmap As Long, _ - ByVal Filename As String, _ - Optional ByVal Format As FREE_IMAGE_FORMAT = FIF_UNKNOWN, _ - Optional ByVal Options As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByVal ColorDepth As FREE_IMAGE_COLOR_DEPTH, _ - Optional ByVal Width As Variant, _ - Optional ByVal Height As Variant, _ - Optional ByVal InPercent As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal UnloadSource As Boolean) As Boolean - -Dim hDIBRescale As Long -Dim bConvertedOnRescale As Boolean -Dim bIsNewDIB As Boolean -Dim lBPP As Long -Dim lBPPOrg As Long -Dim strExtension As String - - ' This function is an easy to use replacement for FreeImage's FreeImage_Save() - ' function which supports inline size- and color conversions as well as an - ' auto image format detection algorithm that determines the desired image format - ' by the given filename. An even more sophisticated algorithm may auto-detect - ' the proper color depth for a explicitly given or auto-detected image format. - - ' The function provides all image formats, and save options, the FreeImage - ' library can write. The optional parameter 'Format' may contain the desired - ' image format. When omitted, the function tries to get the image format from - ' the filename extension. - - ' The optional parameter 'ColorDepth' may contain the desired color depth for - ' the saved image. This can be either any value of the FREE_IMAGE_COLOR_DEPTH - ' enumeration or the value FICD_AUTO what is the default value of the parameter. - ' When 'ColorDepth' is FICD_AUTO, the function tries to get the most suitable - ' color depth for the specified image format if the image's current color depth - ' is not supported by the specified image format. Therefore, the function - ' firstly reduces the color depth step by step until a proper color depth is - ' found since an incremention would only increase the file's size with no - ' quality benefit. Only when there is no lower color depth is found for the - ' image format, the function starts to increase the color depth. - - ' Keep in mind that an explicitly specified color depth that is not supported - ' by the image format results in a runtime error. For example, when saving - ' a 24 bit image as GIF image, a runtime error occurs. - - ' The function checks, whether the given filename has a valid extension or - ' not. If not, the "primary" extension for the used image format will be - ' appended to the filename. The parameter 'Filename' remains untouched in - ' this case. - - ' To learn more about the "primary" extension, read the documentation for - ' the 'FreeImage_GetPrimaryExtensionFromFIF' function. - - ' The parameters 'Width', 'Height', 'InPercent' and 'Filter' make it possible - ' to save the image in a resized version. 'Width', 'Height' specify the desired - ' width and height, 'Filter' determines, what image filter should be used - ' on the resizing process. Since FreeImage_SaveEx relies on FreeImage_RescaleEx, - ' please refer to the documentation of FreeImage_RescaleEx to learn more - ' about these four parameters. - - ' The optional 'UnloadSource' parameter is for unloading the saved image, so - ' you can save and unload an image with this function in one operation. - ' CAUTION: at current, the image is unloaded, even if the image was not - ' saved correctly! - - - If (Bitmap) Then - - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to save 'header-only' bitmaps.") - End If - - If ((Not IsMissing(Width)) Or _ - (Not IsMissing(Height))) Then - - lBPP = FreeImage_GetBPP(Bitmap) - hDIBRescale = FreeImage_RescaleEx(Bitmap, Width, Height, InPercent, UnloadSource, Filter) - bIsNewDIB = (hDIBRescale <> Bitmap) - Bitmap = hDIBRescale - bConvertedOnRescale = (lBPP <> FreeImage_GetBPP(Bitmap)) - End If - - If (Format = FIF_UNKNOWN) Then - Format = FreeImage_GetFIFFromFilename(Filename) - End If - If (Format <> FIF_UNKNOWN) Then - If ((FreeImage_FIFSupportsWriting(Format)) And _ - (FreeImage_FIFSupportsExportType(Format, FIT_BITMAP))) Then - - If (Not FreeImage_IsFilenameValidForFIF(Format, Filename)) Then - strExtension = "." & FreeImage_GetPrimaryExtensionFromFIF(Format) - End If - - ' check color depth - If (ColorDepth <> FICD_AUTO) Then - ' mask out bit 1 (0x02) for the case ColorDepth is FICD_MONOCHROME_DITHER (0x03) - ' FREE_IMAGE_COLOR_DEPTH values are true bit depths in general expect FICD_MONOCHROME_DITHER - ' by masking out bit 1, 'FreeImage_FIFSupportsExportBPP()' tests for bitdepth 1 - ' what is correct again for dithered images. - ColorDepth = (ColorDepth And (Not &H2)) - If (Not FreeImage_FIFSupportsExportBPP(Format, ColorDepth)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "FreeImage Library plugin '" & FreeImage_GetFormatFromFIF(Format) & "' " & _ - "is unable to write images with a color depth " & _ - "of " & ColorDepth & " bpp.") - - ElseIf (FreeImage_GetBPP(Bitmap) <> ColorDepth) Then - Bitmap = FreeImage_ConvertColorDepth(Bitmap, ColorDepth, (UnloadSource Or bIsNewDIB)) - bIsNewDIB = True - - End If - Else - - If (lBPP = 0) Then - lBPP = FreeImage_GetBPP(Bitmap) - End If - - If (Not FreeImage_FIFSupportsExportBPP(Format, lBPP)) Then - lBPPOrg = lBPP - Do - lBPP = pGetPreviousColorDepth(lBPP) - Loop While ((Not FreeImage_FIFSupportsExportBPP(Format, lBPP)) Or _ - (lBPP = 0)) - If (lBPP = 0) Then - lBPP = lBPPOrg - Do - lBPP = pGetNextColorDepth(lBPP) - Loop While ((Not FreeImage_FIFSupportsExportBPP(Format, lBPP)) Or _ - (lBPP = 0)) - End If - - If (lBPP <> 0) Then - Bitmap = FreeImage_ConvertColorDepth(Bitmap, lBPP, (UnloadSource Or bIsNewDIB)) - bIsNewDIB = True - End If - - ElseIf (bConvertedOnRescale) Then - ' restore original color depth - ' always unload current DIB here, since 'bIsNewDIB' is True - Bitmap = FreeImage_ConvertColorDepth(Bitmap, lBPP, True) - - End If - End If - - FreeImage_SaveEx = FreeImage_Save(Format, Bitmap, Filename & strExtension, Options) - If ((bIsNewDIB) Or (UnloadSource)) Then - Call FreeImage_Unload(Bitmap) - End If - Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "FreeImage Library plugin '" & FreeImage_GetFormatFromFIF(Format) & "' " & _ - "is unable to write images of the image format requested.") - End If - Else - ' unknown image format error - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unknown image format. Neither an explicit image format " & _ - "was specified nor any known image format was determined " & _ - "from the filename specified.") - End If - End If - -End Function - -Public Function SavePictureEx(ByRef Picture As IPicture, _ - ByRef Filename As String, _ - Optional ByRef Format As FREE_IMAGE_FORMAT, _ - Optional ByRef Options As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByRef ColorDepth As FREE_IMAGE_COLOR_DEPTH, _ - Optional ByRef Width As Variant, _ - Optional ByRef Height As Variant, _ - Optional ByRef InPercent As Boolean, _ - Optional ByRef Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC) As Boolean - -Dim hDIB As Long - -Const vbObjectOrWithBlockVariableNotSet As Long = 91 -Const vbInvalidPictureError As Long = 481 - - ' This function is an extended version of the VB method 'SavePicture'. As - ' the VB version it takes a Picture object and a filename parameter to - ' save the image and throws the same errors in most cases. - - ' This function now is only a thin wrapper for the FreeImage_SaveEx() wrapper - ' function (as compared to releases of this wrapper prior to version 1.8). So, - ' have a look at this function's discussion of the parameters. - - - If (Not Picture Is Nothing) Then - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - SavePictureEx = FreeImage_SaveEx(hDIB, Filename, Format, Options, _ - ColorDepth, Width, Height, InPercent, _ - FILTER_BICUBIC, True) - Else - Call Err.Raise(vbInvalidPictureError) - End If - Else - Call Err.Raise(vbObjectOrWithBlockVariableNotSet) - End If - -End Function - -Public Function SaveImageContainerEx(ByRef Container As Object, _ - ByRef Filename As String, _ - Optional ByVal IncludeDrawings As Boolean, _ - Optional ByRef Format As FREE_IMAGE_FORMAT, _ - Optional ByRef Options As FREE_IMAGE_SAVE_OPTIONS, _ - Optional ByRef ColorDepth As FREE_IMAGE_COLOR_DEPTH, _ - Optional ByRef Width As Variant, _ - Optional ByRef Height As Variant, _ - Optional ByRef InPercent As Boolean, _ - Optional ByRef Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC) As Long - - ' This function is an extended version of the VB method 'SavePicture'. As - ' the VB version it takes an image hosting control and a filename parameter to - ' save the image and throws the same errors in most cases. - - ' This function merges the functionality of both wrapper functions - ' 'SavePictureEx()' and 'FreeImage_CreateFromImageContainer()'. Basically this - ' function is identical to 'SavePictureEx' expect that is does not take a - ' IOlePicture (IPicture) object but a VB image hosting container control. - - ' Please, refer to each of this two function's inline documentation for a - ' more detailed description. - - Call SavePictureEx(pGetIOlePictureFromContainer(Container, IncludeDrawings), _ - Filename, Format, Options, ColorDepth, Width, Height, InPercent, Filter) - -End Function - -Public Function FreeImage_OpenMultiBitmapEx(ByVal Filename As String, _ - Optional ByVal ReadOnly As Boolean, _ - Optional ByVal KeepCacheInMemory As Boolean, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As Long - - Format = FreeImage_GetFileType(Filename) - If (Format <> FIF_UNKNOWN) Then - Select Case Format - - Case FIF_TIFF, FIF_GIF, FIF_ICO - FreeImage_OpenMultiBitmapEx = FreeImage_OpenMultiBitmap(Format, Filename, False, _ - ReadOnly, KeepCacheInMemory, Flags) - - Case Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "FreeImage Library plugin '" & FreeImage_GetFormatFromFIF(Format) & "' " & _ - "does not have any support for multi-page bitmaps.") - End Select - Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "The file specified has an unknown image format.") - End If - -End Function - -Public Function FreeImage_CreateMultiBitmapEx(ByVal Filename As String, _ - Optional ByVal KeepCacheInMemory As Boolean, _ - Optional ByVal Flags As FREE_IMAGE_LOAD_OPTIONS, _ - Optional ByRef Format As FREE_IMAGE_FORMAT) As Long - - If (Format = FIF_UNKNOWN) Then - Format = FreeImage_GetFIFFromFilename(Filename) - End If - - If (Format <> FIF_UNKNOWN) Then - Select Case Format - - Case FIF_TIFF, FIF_GIF, FIF_ICO - FreeImage_CreateMultiBitmapEx = FreeImage_OpenMultiBitmap(Format, Filename, True, _ - False, KeepCacheInMemory, Flags) - - Case Else - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "FreeImage Library plugin '" & _ - FreeImage_GetFormatFromFIF(Format) & "' " & _ - "does not have any support for multi-page bitmaps.") - End Select - Else - ' unknown image format error - Call Err.Raise(5, _ - "MFreeImage", _ - Error$(5) & vbCrLf & vbCrLf & _ - "Unknown image format. Neither an explicit image format " & _ - "was specified nor any known image format was determined " & _ - "from the filename specified.") - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' OlePicture aware toolkit, rescale and conversion functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_RescaleIOP(ByRef Picture As IPicture, _ - Optional ByVal Width As Variant, _ - Optional ByVal Height As Variant, _ - Optional ByVal IsPercentValue As Boolean, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for wrapper function FreeImage_RescaleEx() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - hDIB = FreeImage_RescaleEx(hDIB, Width, Height, IsPercentValue, _ - True, Filter, ForceCloneCreation) - Set FreeImage_RescaleIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_RescaleByPixelIOP(ByRef Picture As IPicture, _ - Optional ByVal WidthInPixels As Long, _ - Optional ByVal HeightInPixels As Long, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As IPicture - - ' Thin wrapper for function 'FreeImage_RescaleExIOP' for removing method - ' overload fake. This function rescales the image directly to the size - ' specified by the 'WidthInPixels' and 'HeightInPixels' parameters. - - Set FreeImage_RescaleByPixelIOP = FreeImage_RescaleIOP(Picture, WidthInPixels, HeightInPixels, _ - False, Filter, ForceCloneCreation) - -End Function - -Public Function FreeImage_RescaleByPercentIOP(ByRef Picture As IPicture, _ - Optional ByVal WidthPercentage As Double, _ - Optional ByVal HeightPercentage As Double, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As IPicture - - ' Thin wrapper for function 'FreeImage_RescaleExIOP' for removing method - ' overload fake. This function rescales the image by a percent value - ' based on the image's original size. - - Set FreeImage_RescaleByPercentIOP = FreeImage_RescaleIOP(Picture, WidthPercentage, HeightPercentage, _ - True, Filter, ForceCloneCreation) - -End Function - -Public Function FreeImage_RescaleByFactorIOP(ByRef Picture As IPicture, _ - Optional ByVal WidthFactor As Double, _ - Optional ByVal HeightFactor As Double, _ - Optional ByVal Filter As FREE_IMAGE_FILTER = FILTER_BICUBIC, _ - Optional ByVal ForceCloneCreation As Boolean) As IPicture - - ' Thin wrapper for function 'FreeImage_RescaleExIOP' for removing method - ' overload fake. This function rescales the image by a factor - ' based on the image's original size. - - Set FreeImage_RescaleByFactorIOP = FreeImage_RescaleIOP(Picture, WidthFactor, HeightFactor, _ - False, Filter, ForceCloneCreation) - -End Function - -Public Function FreeImage_MakeThumbnailIOP(ByRef Picture As IPicture, _ - ByVal MaxPixelSize As Long, _ - Optional ByVal Convert As Boolean) As IPicture - -Dim hDIB As Long -Dim hDIBThumbnail As Long - - ' IOlePicture based wrapper for wrapper function FreeImage_MakeThumbnail() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - hDIBThumbnail = FreeImage_MakeThumbnail(hDIB, MaxPixelSize, Convert) - If (hDIBThumbnail) Then - Set FreeImage_MakeThumbnailIOP = FreeImage_GetOlePicture(hDIBThumbnail, , True) - End If - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_ConvertColorDepthIOP(ByRef Picture As IPicture, _ - ByVal Conversion As FREE_IMAGE_CONVERSION_FLAGS, _ - Optional ByVal Threshold As Byte = 128, _ - Optional ByVal DitherMethod As FREE_IMAGE_DITHER = FID_FS, _ - Optional ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE = FIQ_WUQUANT) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for wrapper function FreeImage_ConvertColorDepth() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - hDIB = FreeImage_ConvertColorDepth(hDIB, Conversion, True, Threshold, _ - DitherMethod, QuantizeMethod) - Set FreeImage_ConvertColorDepthIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_ColorQuantizeExIOP(ByRef Picture As IPicture, _ - Optional ByVal QuantizeMethod As FREE_IMAGE_QUANTIZE = FIQ_WUQUANT, _ - Optional ByVal PaletteSize As Long = 256, _ - Optional ByVal ReserveSize As Long, _ - Optional ByRef ReservePalette As Variant = Null) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for wrapper function FreeImage_ColorQuantizeEx() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - hDIB = FreeImage_ColorQuantizeEx(hDIB, QuantizeMethod, True, PaletteSize, _ - ReserveSize, ReservePalette) - Set FreeImage_ColorQuantizeExIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_RotateClassicIOP(ByRef Picture As IPicture, _ - ByVal Angle As Double) As IPicture - -Dim hDIB As Long -Dim hDIBNew As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_RotateClassic() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 1, 8, 24, 32 - hDIBNew = FreeImage_RotateClassic(hDIB, Angle) - Set FreeImage_RotateClassicIOP = FreeImage_GetOlePicture(hDIBNew, , True) - - End Select - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_RotateIOP(ByRef Picture As IPicture, _ - ByVal Angle As Double, _ - Optional ByVal ColorPtr As Long) As IPicture - -Dim hDIB As Long -Dim hDIBNew As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_Rotate() - - ' The optional ColorPtr parameter takes a pointer to (e.g. the address of) an - ' RGB color value. So, all these assignments are valid for ColorPtr: - ' - ' Dim tColor As RGBQUAD - ' - ' VarPtr(tColor) - ' VarPtr(&H33FF80) - ' VarPtr(vbWhite) ' However, the VB color constants are in BGR format! - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 1, 8, 24, 32 - hDIBNew = FreeImage_Rotate(hDIB, Angle, ByVal ColorPtr) - Set FreeImage_RotateIOP = FreeImage_GetOlePicture(hDIBNew, , True) - - End Select - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_RotateExIOP(ByRef Picture As IPicture, _ - ByVal Angle As Double, _ - Optional ByVal ShiftX As Double, _ - Optional ByVal ShiftY As Double, _ - Optional ByVal OriginX As Double, _ - Optional ByVal OriginY As Double, _ - Optional ByVal UseMask As Boolean) As IPicture - -Dim hDIB As Long -Dim hDIBNew As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_RotateEx() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 8, 24, 32 - hDIBNew = FreeImage_RotateEx(hDIB, Angle, ShiftX, ShiftY, OriginX, OriginY, UseMask) - Set FreeImage_RotateExIOP = FreeImage_GetOlePicture(hDIBNew, , True) - - End Select - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_FlipHorizontalIOP(ByRef Picture As IPicture) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_FlipHorizontal() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Call FreeImage_FlipHorizontalInt(hDIB) - Set FreeImage_FlipHorizontalIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_FlipVerticalIOP(ByRef Picture As IPicture) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_FlipVertical() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Call FreeImage_FlipVerticalInt(hDIB) - Set FreeImage_FlipVerticalIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_AdjustCurveIOP(ByRef Picture As IPicture, _ - ByRef LookupTable As Variant, _ - Optional ByVal Channel As FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_AdjustCurve() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 8, 24, 32 - Call FreeImage_AdjustCurveEx(hDIB, LookupTable, Channel) - Set FreeImage_AdjustCurveIOP = FreeImage_GetOlePicture(hDIB, , True) - - End Select - End If - -End Function - -Public Function FreeImage_AdjustGammaIOP(ByRef Picture As IPicture, _ - ByVal Gamma As Double) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_AdjustGamma() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 8, 24, 32 - Call FreeImage_AdjustGammaInt(hDIB, Gamma) - Set FreeImage_AdjustGammaIOP = FreeImage_GetOlePicture(hDIB, , True) - - End Select - End If - -End Function - -Public Function FreeImage_AdjustBrightnessIOP(ByRef Picture As IPicture, _ - ByVal Percentage As Double) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_AdjustBrightness() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 8, 24, 32 - Call FreeImage_AdjustBrightnessInt(hDIB, Percentage) - Set FreeImage_AdjustBrightnessIOP = FreeImage_GetOlePicture(hDIB, , True) - - End Select - End If - -End Function - -Public Function FreeImage_AdjustContrastIOP(ByRef Picture As IPicture, _ - ByVal Percentage As Double) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_AdjustContrast() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 8, 24, 32 - Call FreeImage_AdjustContrastInt(hDIB, Percentage) - Set FreeImage_AdjustContrastIOP = FreeImage_GetOlePicture(hDIB, , True) - - End Select - End If - -End Function - -Public Function FreeImage_InvertIOP(ByRef Picture As IPicture) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_Invert() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Call FreeImage_InvertInt(hDIB) - Set FreeImage_InvertIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - -End Function - -Public Function FreeImage_GetChannelIOP(ByRef Picture As IPicture, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As IPicture - -Dim hDIB As Long -Dim hDIBNew As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_GetChannel() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 24, 32 - hDIBNew = FreeImage_GetChannel(hDIB, Channel) - Set FreeImage_GetChannelIOP = FreeImage_GetOlePicture(hDIBNew, , True) - - End Select - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_SetChannelIOP(ByRef Picture As IPicture, _ - ByVal BitmapSrc As Long, _ - ByVal Channel As FREE_IMAGE_COLOR_CHANNEL) As IPicture - -Dim hDIB As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_SetChannel() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - Select Case FreeImage_GetBPP(hDIB) - - Case 24, 32 - If (FreeImage_SetChannel(hDIB, BitmapSrc, Channel)) Then - Set FreeImage_SetChannelIOP = FreeImage_GetOlePicture(hDIB, , True) - End If - - End Select - Call FreeImage_Unload(hDIB) - End If - -End Function - -Public Function FreeImage_CopyIOP(ByRef Picture As IPicture, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Right As Long, _ - ByVal Bottom As Long) As IPicture - -Dim hDIB As Long -Dim hDIBNew As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_Copy() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - hDIBNew = FreeImage_Copy(hDIB, Left, Top, Right, Bottom) - Call FreeImage_Unload(hDIB) - Set FreeImage_CopyIOP = FreeImage_GetOlePicture(hDIBNew, , True) - End If - -End Function - -Public Function FreeImage_PasteIOP(ByRef PictureDst As IPicture, _ - ByRef PictureSrc As IPicture, _ - ByVal Left As Long, _ - ByVal Top As Long, _ - ByVal Alpha As Long, _ - Optional ByVal KeepOriginalDestImage As Boolean) As IPicture - -Dim hDIBDst As Long -Dim hDIBSrc As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_Paste() - - hDIBDst = FreeImage_CreateFromOlePicture(PictureDst) - If (hDIBDst) Then - hDIBSrc = FreeImage_CreateFromOlePicture(PictureSrc) - If (hDIBSrc) Then - If FreeImage_Paste(hDIBDst, hDIBSrc, Left, Top, Alpha) Then - Set FreeImage_PasteIOP = FreeImage_GetOlePicture(hDIBDst, , True) - If (Not KeepOriginalDestImage) Then - Set PictureDst = FreeImage_PasteIOP - End If - End If - Call FreeImage_Unload(hDIBSrc) - End If - End If - -End Function - -Public Function FreeImage_CompositeIOP(ByRef Picture As IPicture, _ - Optional ByVal UseFileBackColor As Boolean, _ - Optional ByVal AppBackColor As OLE_COLOR, _ - Optional ByRef BackgroundPicture As IPicture) As IPicture - -Dim hDIB As Long -Dim hDIBbg As Long -Dim hDIBResult As Long -Dim lUseFileBackColor As Long - - ' IOlePicture based wrapper for FreeImage function FreeImage_Composite() - - hDIB = FreeImage_CreateFromOlePicture(Picture) - If (hDIB) Then - - If (UseFileBackColor) Then - lUseFileBackColor = 1 - End If - - hDIBbg = FreeImage_CreateFromOlePicture(BackgroundPicture) - - hDIBResult = FreeImage_Composite(hDIB, lUseFileBackColor, ConvertColor(AppBackColor), hDIBbg) - If (hDIBResult) Then - Set FreeImage_CompositeIOP = FreeImage_GetOlePicture(hDIBResult, , True) - End If - - Call FreeImage_Unload(hDIB) - If (hDIBbg) Then - Call FreeImage_Unload(hDIBbg) - End If - End If - -End Function - - -'-------------------------------------------------------------------------------- -' VB-coded Toolkit functions -'-------------------------------------------------------------------------------- - -Public Function FreeImage_GetColorizedPalette(ByVal Color As OLE_COLOR, _ - Optional ByVal SplitValue As Variant = 0.5) As RGBQUAD() - -Dim atPalette(255) As RGBQUAD -Dim lSplitIndex As Long -Dim lSplitIndexInv As Long -Dim lRed As Long -Dim lGreen As Long -Dim lBlue As Long -Dim i As Long - - ' compute the split index - Select Case VarType(SplitValue) - - Case vbByte, vbInteger, vbLong - lSplitIndex = SplitValue - - Case vbDouble, vbSingle, vbDecimal - lSplitIndex = 256 * SplitValue - - Case Else - lSplitIndex = 128 - - End Select - - ' check ranges of split index - If (lSplitIndex < 0) Then - lSplitIndex = 0 - ElseIf (lSplitIndex > 255) Then - lSplitIndex = 255 - End If - lSplitIndexInv = 256 - lSplitIndex - - ' extract color components red, green and blue - lRed = (Color And &HFF) - lGreen = ((Color \ &H100&) And &HFF) - lBlue = ((Color \ &H10000) And &HFF) - - For i = 0 To lSplitIndex - 1 - With atPalette(i) - .rgbRed = (lRed / lSplitIndex) * i - .rgbGreen = (lGreen / lSplitIndex) * i - .rgbBlue = (lBlue / lSplitIndex) * i - End With - Next i - For i = lSplitIndex To 255 - With atPalette(i) - .rgbRed = lRed + ((255 - lRed) / lSplitIndexInv) * (i - lSplitIndex) - .rgbGreen = lGreen + ((255 - lGreen) / lSplitIndexInv) * (i - lSplitIndex) - .rgbBlue = lBlue + ((255 - lBlue) / lSplitIndexInv) * (i - lSplitIndex) - End With - Next i - - FreeImage_GetColorizedPalette = atPalette - -End Function - -Public Function FreeImage_Colorize(ByVal Bitmap As Long, _ - ByVal Color As OLE_COLOR, _ - Optional ByVal SplitValue As Variant = 0.5) As Long - - If (Bitmap) Then - If (Not FreeImage_HasPixels(Bitmap)) Then - Call Err.Raise(5, "MFreeImage", Error$(5) & vbCrLf & vbCrLf & _ - "Unable to colorize a 'header-only' bitmap.") - End If - FreeImage_Colorize = FreeImage_ConvertToGreyscale(Bitmap) - Call FreeImage_SetPalette(FreeImage_Colorize, _ - FreeImage_GetColorizedPalette(Color, SplitValue)) - End If - -End Function - -Public Function FreeImage_Sepia(ByVal Bitmap As Long, _ - Optional ByVal SplitValue As Variant = 0.5) As Long - - FreeImage_Sepia = FreeImage_Colorize(Bitmap, &H658AA2, SplitValue) ' RGB(162, 138, 101) - -End Function - - -'-------------------------------------------------------------------------------- -' Compression functions wrappers -'-------------------------------------------------------------------------------- - -Public Function FreeImage_ZLibCompressEx(ByRef Target As Variant, _ - Optional ByRef TargetSize As Long, _ - Optional ByRef Source As Variant, _ - Optional ByVal SourceSize As Long, _ - Optional ByVal Offset As Long) As Long - -Dim lSourceDataPtr As Long -Dim lTargetDataPtr As Long -Dim bTargetCreated As Boolean - - ' This function is a more VB friendly wrapper for compressing data with - ' the 'FreeImage_ZLibCompress' function. - - ' The parameter 'Target' may either be a VB style array of Byte, Integer - ' or Long or a pointer to a memory block. If 'Target' is a pointer to a - ' memory block (when it contains an address), 'TargetSize' must be - ' specified and greater than zero. If 'Target' is an initialized array, - ' the whole array will be used to store compressed data when 'TargetSize' - ' is missing or below or equal to zero. If 'TargetSize' is specified, only - ' the first TargetSize bytes of the array will be used. - ' In each case, all rules according to the FreeImage API documentation - ' apply, what means that the target buffer must be at least 0.1% greater - ' than the source buffer plus 12 bytes. - ' If 'Target' is an uninitialized array, the contents of 'TargetSize' - ' will be ignored and the size of the array 'Target' will be handled - ' internally. When the function returns, 'Target' will be initialized - ' as an array of Byte and sized correctly to hold all the compressed - ' data. - - ' Nearly all, that is true for the parameters 'Target' and 'TargetSize', - ' is also true for 'Source' and 'SourceSize', expect that 'Source' should - ' never be an uninitialized array. In that case, the function returns - ' immediately. - - ' The optional parameter 'Offset' may contain a number of bytes to remain - ' untouched at the beginning of 'Target', when an uninitialized array is - ' provided through 'Target'. When 'Target' is either a pointer or an - ' initialized array, 'Offset' will be ignored. This parameter is currently - ' used by 'FreeImage_ZLibCompressVB' to store the length of the uncompressed - ' data at the first four bytes of 'Target'. - - - ' get the pointer and the size in bytes of the source - ' memory block - lSourceDataPtr = pGetMemoryBlockPtrFromVariant(Source, SourceSize) - If (lSourceDataPtr) Then - ' when we got a valid pointer, get the pointer and the size in bytes - ' of the target memory block - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - If (lTargetDataPtr = 0) Then - ' if 'Target' is a null pointer, we will initialized it as an array - ' of bytes; here we will take 'Offset' into account - ReDim Target(SourceSize + Int(SourceSize * 0.1) + _ - 12 + Offset) As Byte - ' get pointer and size in bytes (will never be a null pointer) - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - ' adjust according to 'Offset' - lTargetDataPtr = lTargetDataPtr + Offset - TargetSize = TargetSize - Offset - bTargetCreated = True - End If - - ' compress source data - FreeImage_ZLibCompressEx = FreeImage_ZLibCompress(lTargetDataPtr, _ - TargetSize, _ - lSourceDataPtr, _ - SourceSize) - - ' the function returns the number of bytes needed to store the - ' compressed data or zero on failure - If (FreeImage_ZLibCompressEx) Then - If (bTargetCreated) Then - ' when we created the array, we need to adjust it's size - ' according to the length of the compressed data - ReDim Preserve Target(FreeImage_ZLibCompressEx - 1 + Offset) - End If - End If - End If - -End Function - -Public Function FreeImage_ZLibUncompressEx(ByRef Target As Variant, _ - Optional ByRef TargetSize As Long, _ - Optional ByRef Source As Variant, _ - Optional ByVal SourceSize As Long) As Long - -Dim lSourceDataPtr As Long -Dim lTargetDataPtr As Long - - ' This function is a more VB friendly wrapper for compressing data with - ' the 'FreeImage_ZLibUncompress' function. - - ' The parameter 'Target' may either be a VB style array of Byte, Integer - ' or Long or a pointer to a memory block. If 'Target' is a pointer to a - ' memory block (when it contains an address), 'TargetSize' must be - ' specified and greater than zero. If 'Target' is an initialized array, - ' the whole array will be used to store uncompressed data when 'TargetSize' - ' is missing or below or equal to zero. If 'TargetSize' is specified, only - ' the first TargetSize bytes of the array will be used. - ' In each case, all rules according to the FreeImage API documentation - ' apply, what means that the target buffer must be at least as large, to - ' hold all the uncompressed data. - ' Unlike the function 'FreeImage_ZLibCompressEx', 'Target' can not be - ' an uninitialized array, since the size of the uncompressed data can - ' not be determined by the ZLib functions, but must be specified by a - ' mechanism outside the FreeImage compression functions' scope. - - ' Nearly all, that is true for the parameters 'Target' and 'TargetSize', - ' is also true for 'Source' and 'SourceSize'. - - - ' get the pointer and the size in bytes of the source - ' memory block - lSourceDataPtr = pGetMemoryBlockPtrFromVariant(Source, SourceSize) - If (lSourceDataPtr) Then - ' when we got a valid pointer, get the pointer and the size in bytes - ' of the target memory block - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - If (lTargetDataPtr) Then - ' if we do not have a null pointer, uncompress the data - FreeImage_ZLibUncompressEx = FreeImage_ZLibUncompress(lTargetDataPtr, _ - TargetSize, _ - lSourceDataPtr, _ - SourceSize) - End If - End If - -End Function - -Public Function FreeImage_ZLibGZipEx(ByRef Target As Variant, _ - Optional ByRef TargetSize As Long, _ - Optional ByRef Source As Variant, _ - Optional ByVal SourceSize As Long, _ - Optional ByVal Offset As Long) As Long - -Dim lSourceDataPtr As Long -Dim lTargetDataPtr As Long -Dim bTargetCreated As Boolean - - ' This function is a more VB friendly wrapper for compressing data with - ' the 'FreeImage_ZLibGZip' function. - - ' The parameter 'Target' may either be a VB style array of Byte, Integer - ' or Long or a pointer to a memory block. If 'Target' is a pointer to a - ' memory block (when it contains an address), 'TargetSize' must be - ' specified and greater than zero. If 'Target' is an initialized array, - ' the whole array will be used to store compressed data when 'TargetSize' - ' is missing or below or equal to zero. If 'TargetSize' is specified, only - ' the first TargetSize bytes of the array will be used. - ' In each case, all rules according to the FreeImage API documentation - ' apply, what means that the target buffer must be at least 0.1% greater - ' than the source buffer plus 24 bytes. - ' If 'Target' is an uninitialized array, the contents of 'TargetSize' - ' will be ignored and the size of the array 'Target' will be handled - ' internally. When the function returns, 'Target' will be initialized - ' as an array of Byte and sized correctly to hold all the compressed - ' data. - - ' Nearly all, that is true for the parameters 'Target' and 'TargetSize', - ' is also true for 'Source' and 'SourceSize', expect that 'Source' should - ' never be an uninitialized array. In that case, the function returns - ' immediately. - - ' The optional parameter 'Offset' may contain a number of bytes to remain - ' untouched at the beginning of 'Target', when an uninitialized array is - ' provided through 'Target'. When 'Target' is either a pointer or an - ' initialized array, 'Offset' will be ignored. This parameter is currently - ' used by 'FreeImage_ZLibGZipVB' to store the length of the uncompressed - ' data at the first four bytes of 'Target'. - - - ' get the pointer and the size in bytes of the source - ' memory block - lSourceDataPtr = pGetMemoryBlockPtrFromVariant(Source, SourceSize) - If (lSourceDataPtr) Then - ' when we got a valid pointer, get the pointer and the size in bytes - ' of the target memory block - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - If (lTargetDataPtr = 0) Then - ' if 'Target' is a null pointer, we will initialized it as an array - ' of bytes; here we will take 'Offset' into account - ReDim Target(SourceSize + Int(SourceSize * 0.1) + _ - 24 + Offset) As Byte - ' get pointer and size in bytes (will never be a null pointer) - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - ' adjust according to 'Offset' - lTargetDataPtr = lTargetDataPtr + Offset - TargetSize = TargetSize - Offset - bTargetCreated = True - End If - - ' compress source data - FreeImage_ZLibGZipEx = FreeImage_ZLibGZip(lTargetDataPtr, _ - TargetSize, _ - lSourceDataPtr, _ - SourceSize) - - ' the function returns the number of bytes needed to store the - ' compressed data or zero on failure - If (FreeImage_ZLibGZipEx) Then - If (bTargetCreated) Then - ' when we created the array, we need to adjust it's size - ' according to the length of the compressed data - ReDim Preserve Target(FreeImage_ZLibGZipEx - 1 + Offset) - End If - End If - End If - -End Function - -Public Function FreeImage_ZLibCRC32Ex(ByVal CRC As Long, _ - Optional ByRef Source As Variant, _ - Optional ByVal SourceSize As Long) As Long - -Dim lSourceDataPtr As Long - - ' This function is a more VB friendly wrapper for compressing data with - ' the 'FreeImage_ZLibCRC32' function. - - ' The parameter 'Source' may either be a VB style array of Byte, Integer - ' or Long or a pointer to a memory block. If 'Source' is a pointer to a - ' memory block (when it contains an address), 'SourceSize' must be - ' specified and greater than zero. If 'Source' is an initialized array, - ' the whole array will be used to calculate the new CRC when 'SourceSize' - ' is missing or below or equal to zero. If 'SourceSize' is specified, only - ' the first SourceSize bytes of the array will be used. - - - ' get the pointer and the size in bytes of the source - ' memory block - lSourceDataPtr = pGetMemoryBlockPtrFromVariant(Source, SourceSize) - If (lSourceDataPtr) Then - ' if we do not have a null pointer, calculate the CRC including 'crc' - FreeImage_ZLibCRC32Ex = FreeImage_ZLibCRC32(CRC, _ - lSourceDataPtr, _ - SourceSize) - End If - -End Function - -Public Function FreeImage_ZLibGUnzipEx(ByRef Target As Variant, _ - Optional ByRef TargetSize As Long, _ - Optional ByRef Source As Variant, _ - Optional ByVal SourceSize As Long) As Long - -Dim lSourceDataPtr As Long -Dim lTargetDataPtr As Long - - ' This function is a more VB friendly wrapper for compressing data with - ' the 'FreeImage_ZLibGUnzip' function. - - ' The parameter 'Target' may either be a VB style array of Byte, Integer - ' or Long or a pointer to a memory block. If 'Target' is a pointer to a - ' memory block (when it contains an address), 'TargetSize' must be - ' specified and greater than zero. If 'Target' is an initialized array, - ' the whole array will be used to store uncompressed data when 'TargetSize' - ' is missing or below or equal to zero. If 'TargetSize' is specified, only - ' the first TargetSize bytes of the array will be used. - ' In each case, all rules according to the FreeImage API documentation - ' apply, what means that the target buffer must be at least as large, to - ' hold all the uncompressed data. - ' Unlike the function 'FreeImage_ZLibGZipEx', 'Target' can not be - ' an uninitialized array, since the size of the uncompressed data can - ' not be determined by the ZLib functions, but must be specified by a - ' mechanism outside the FreeImage compression functions' scope. - - ' Nearly all, that is true for the parameters 'Target' and 'TargetSize', - ' is also true for 'Source' and 'SourceSize'. - - - ' get the pointer and the size in bytes of the source - ' memory block - lSourceDataPtr = pGetMemoryBlockPtrFromVariant(Source, SourceSize) - If (lSourceDataPtr) Then - ' when we got a valid pointer, get the pointer and the size in bytes - ' of the target memory block - lTargetDataPtr = pGetMemoryBlockPtrFromVariant(Target, TargetSize) - If (lTargetDataPtr) Then - ' if we do not have a null pointer, uncompress the data - FreeImage_ZLibGUnzipEx = FreeImage_ZLibGUnzip(lTargetDataPtr, _ - TargetSize, _ - lSourceDataPtr, _ - SourceSize) - End If - End If - -End Function - -Public Function FreeImage_ZLibCompressVB(ByRef Data() As Byte, _ - Optional ByVal IncludeSize As Boolean = True) As Byte() - -Dim lOffset As Long -Dim lArrayDataPtr As Long - - ' This function is another, even more VB friendly wrapper for the FreeImage - ' 'FreeImage_ZLibCompress' function, that uses the 'FreeImage_ZLibCompressEx' - ' function. This function is very easy to use, since it deals only with VB - ' style Byte arrays. - - ' The parameter 'Data()' is a Byte array, providing the uncompressed source - ' data, that will be compressed. - - ' The optional parameter 'IncludeSize' determines whether the size of the - ' uncompressed data should be stored in the first four bytes of the returned - ' byte buffer containing the compressed data or not. When 'IncludeSize' is - ' True, the size of the uncompressed source data will be stored. This works - ' in conjunction with the corresponding 'FreeImage_ZLibUncompressVB' function. - - ' The function returns a VB style Byte array containing the compressed data. - - - ' start population the memory block with compressed data - ' at offset 4 bytes, when the unclompressed size should - ' be included - If (IncludeSize) Then - lOffset = 4 - End If - - Call FreeImage_ZLibCompressEx(FreeImage_ZLibCompressVB, , Data, , lOffset) - - If (IncludeSize) Then - ' get the pointer actual pointing to the array data of - ' the Byte array 'FreeImage_ZLibCompressVB' - lArrayDataPtr = deref(deref(VarPtrArray(FreeImage_ZLibCompressVB)) + 12) - - ' copy uncompressed size into the first 4 bytes - Call CopyMemory(ByVal lArrayDataPtr, UBound(Data) + 1, 4) - End If - -End Function - -Public Function FreeImage_ZLibUncompressVB(ByRef Data() As Byte, _ - Optional ByVal SizeIncluded As Boolean = True, _ - Optional ByVal SizeNeeded As Long) As Byte() - -Dim abBuffer() As Byte - - ' This function is another, even more VB friendly wrapper for the FreeImage - ' 'FreeImage_ZLibUncompress' function, that uses the 'FreeImage_ZLibUncompressEx' - ' function. This function is very easy to use, since it deals only with VB - ' style Byte arrays. - - ' The parameter 'Data()' is a Byte array, providing the compressed source - ' data that will be uncompressed either withthe size of the uncompressed - ' data included or not. - - ' When the optional parameter 'SizeIncluded' is True, the function assumes, - ' that the first four bytes contain the size of the uncompressed data as a - ' Long value. In that case, 'SizeNeeded' will be ignored. - - ' When the size of the uncompressed data is not included in the buffer 'Data()' - ' containing the compressed data, the optional parameter 'SizeNeeded' must - ' specify the size in bytes needed to hold all the uncompressed data. - - ' The function returns a VB style Byte array containing the uncompressed data. - - - If (SizeIncluded) Then - ' get uncompressed size from the first 4 bytes and allocate - ' buffer accordingly - Call CopyMemory(SizeNeeded, Data(0), 4) - ReDim abBuffer(SizeNeeded - 1) - Call FreeImage_ZLibUncompressEx(abBuffer, , VarPtr(Data(4)), UBound(Data) - 3) - Call pSwap(VarPtrArray(FreeImage_ZLibUncompressVB), VarPtrArray(abBuffer)) - - ElseIf (SizeNeeded) Then - ' no size included in compressed data, so just forward the - ' call to 'FreeImage_ZLibUncompressEx' and trust on SizeNeeded - ReDim abBuffer(SizeNeeded - 1) - Call FreeImage_ZLibUncompressEx(abBuffer, , Data) - Call pSwap(VarPtrArray(FreeImage_ZLibUncompressVB), VarPtrArray(abBuffer)) - - End If - -End Function - -Public Function FreeImage_ZLibGZipVB(ByRef Data() As Byte, _ - Optional ByVal IncludeSize As Boolean = True) As Byte() - -Dim lOffset As Long -Dim lArrayDataPtr As Long - - ' This function is another, even more VB friendly wrapper for the FreeImage - ' 'FreeImage_ZLibGZip' function, that uses the 'FreeImage_ZLibGZipEx' - ' function. This function is very easy to use, since it deals only with VB - ' style Byte arrays. - - ' The parameter 'Data()' is a Byte array, providing the uncompressed source - ' data that will be compressed. - - ' The optional parameter 'IncludeSize' determines whether the size of the - ' uncompressed data should be stored in the first four bytes of the returned - ' byte buffer containing the compressed data or not. When 'IncludeSize' is - ' True, the size of the uncompressed source data will be stored. This works - ' in conjunction with the corresponding 'FreeImage_ZLibGUnzipVB' function. - - ' The function returns a VB style Byte array containing the compressed data. - - - ' start population the memory block with compressed data - ' at offset 4 bytes, when the unclompressed size should - ' be included - If (IncludeSize) Then - lOffset = 4 - End If - - Call FreeImage_ZLibGZipEx(FreeImage_ZLibGZipVB, , Data, , lOffset) - - If (IncludeSize) Then - ' get the pointer actual pointing to the array data of - ' the Byte array 'FreeImage_ZLibCompressVB' - lArrayDataPtr = deref(deref(VarPtrArray(FreeImage_ZLibGZipVB)) + 12) - - ' copy uncompressed size into the first 4 bytes - Call CopyMemory(ByVal lArrayDataPtr, UBound(Data) + 1, 4) - End If - -End Function - -Public Function FreeImage_ZLibGUnzipVB(ByRef Data() As Byte, _ - Optional ByVal SizeIncluded As Boolean = True, _ - Optional ByVal SizeNeeded As Long) As Byte() - -Dim abBuffer() As Byte - - ' This function is another, even more VB friendly wrapper for the FreeImage - ' 'FreeImage_ZLibGUnzip' function, that uses the 'FreeImage_ZLibGUnzipEx' - ' function. This function is very easy to use, since it deals only with VB - ' style Byte arrays. - - ' The parameter 'Data()' is a Byte array, providing the compressed source - ' data that will be uncompressed either withthe size of the uncompressed - ' data included or not. - - ' When the optional parameter 'SizeIncluded' is True, the function assumes, - ' that the first four bytes contain the size of the uncompressed data as a - ' Long value. In that case, 'SizeNeeded' will be ignored. - - ' When the size of the uncompressed data is not included in the buffer 'Data()' - ' containing the compressed data, the optional parameter 'SizeNeeded' must - ' specify the size in bytes needed to hold all the uncompressed data. - - ' The function returns a VB style Byte array containing the uncompressed data. - - - If (SizeIncluded) Then - ' get uncompressed size from the first 4 bytes and allocate - ' buffer accordingly - Call CopyMemory(SizeNeeded, Data(0), 4) - ReDim abBuffer(SizeNeeded - 1) - Call FreeImage_ZLibGUnzipEx(abBuffer, , VarPtr(Data(4)), UBound(Data) - 3) - Call pSwap(VarPtrArray(FreeImage_ZLibGUnzipVB), VarPtrArray(abBuffer)) - - ElseIf (SizeNeeded) Then - ' no size included in compressed data, so just forward the - ' call to 'FreeImage_ZLibUncompressEx' and trust on SizeNeeded - ReDim abBuffer(SizeNeeded - 1) - Call FreeImage_ZLibGUnzipEx(abBuffer, , Data) - Call pSwap(VarPtrArray(FreeImage_ZLibGUnzipVB), VarPtrArray(abBuffer)) - - End If - -End Function - - -'-------------------------------------------------------------------------------- -' Public functions to destroy custom safearrays -'-------------------------------------------------------------------------------- - -Public Function FreeImage_DestroyLockedArray(ByRef Data As Variant) As Long - -Dim lpArrayPtr As Long - - ' This function destroys an array, that was self created with a custom - ' array descriptor of type ('fFeatures' member) 'FADF_AUTO Or FADF_FIXEDSIZE'. - ' Such arrays are returned by mostly all of the array-dealing wrapper - ' functions. Since these should not destroy the actual array data, when - ' going out of scope, they are craeted as 'FADF_FIXEDSIZE'.' - - ' So, VB sees them as fixed or temporarily locked, when you try to manipulate - ' the array's dimensions. There will occur some strange effects, you should - ' know about: - - ' 1. When trying to 'ReDim' the array, this run-time error will occur: - ' Error #10, 'This array is fixed or temporarily locked' - - ' 2. When trying to assign another array to the array variable, this - ' run-time error will occur: - ' Error #13, 'Type mismatch' - - ' 3. The 'Erase' statement has no effect on the array - - ' Although VB clears up these arrays correctly, when the array variable - ' goes out of scope, you have to destroy the array manually, when you want - ' to reuse the array variable in current scope. - - ' For an example assume, that you want do walk all scanlines in an image: - - ' For i = 0 To FreeImage_GetHeight(Bitmap) - ' - ' ' assign scanline-array to array variable - ' abByte = FreeImage_GetScanLineEx(Bitmap, i) - ' - ' ' do some work on it... - ' - ' ' destroy the array (only the array, not the actual data) - ' Call FreeImage_DestroyLockedArray(dbByte) - ' Next i - - ' The function returns zero on success and any other value on failure - - ' !! Attention !! - ' This function uses a Variant parameter for passing the array to be - ' destroyed. Since VB does not allow to pass an array of non public - ' structures through a Variant parameter, this function can not be used - ' with arrays of cutom type. - - ' You will get this compiler error: "Only public user defined types defined - ' in public object modules can be used as parameters or return types for - ' public procedures of class modules or as fields of public user defined types" - - ' So, there is a function in the wrapper called 'FreeImage_DestroyLockedArrayByPtr' - ' that takes a pointer to the array variable which can be used to work around - ' that VB limitation and furthermore can be used for any of these self-created - ' arrays. To get the array variable's pointer, a declared version of the - ' VB 'VarPtr' function can be used which works for all types of arrays expect - ' String arrays. Declare this function like this in your code: - - ' Private Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" ( _ - ByRef Ptr() As Any) As Long - - ' Then an array could be destroyed by calling the 'FreeImage_DestroyLockedArrayByPtr' - ' function like this: - - ' lResult = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(MyLockedArray)) - - ' Additionally there are some handy wrapper functions available, one for each - ' commonly used structure in FreeImage like RGBTRIPLE, RGBQUAD, FICOMPLEX etc. - - - ' Currently, these functions do return 'FADF_AUTO Or FADF_FIXEDSIZE' arrays - ' that must be destroyed using this or any of it's derived functions: - - ' FreeImage_GetPaletteEx() with FreeImage_DestroyLockedArrayRGBQUAD() - ' FreeImage_GetPaletteLong() with FreeImage_DestroyLockedArray() - ' FreeImage_SaveToMemoryEx2() with FreeImage_DestroyLockedArray() - ' FreeImage_AcquireMemoryEx() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineEx() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineBITMAP8() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineBITMAP16() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineBITMAP24() with FreeImage_DestroyLockedArrayRGBTRIPLE() - ' FreeImage_GetScanLineBITMAP32() with FreeImage_DestroyLockedArrayRGBQUAD() - ' FreeImage_GetScanLineINT16() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineINT32() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineFLOAT() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineDOUBLE() with FreeImage_DestroyLockedArray() - ' FreeImage_GetScanLineCOMPLEX() with FreeImage_DestroyLockedArrayFICOMPLEX() - ' FreeImage_GetScanLineRGB16() with FreeImage_DestroyLockedArrayFIRGB16() - ' FreeImage_GetScanLineRGBA16() with FreeImage_DestroyLockedArrayFIRGBA16() - ' FreeImage_GetScanLineRGBF() with FreeImage_DestroyLockedArrayFIRGBF() - ' FreeImage_GetScanLineRGBAF() with FreeImage_DestroyLockedArrayFIRGBAF() - - - ' ensure, this is an array - If (VarType(Data) And vbArray) Then - - ' data is a VB array, what means a SAFEARRAY in C/C++, that is - ' passed through a ByRef Variant variable, that is a pointer to - ' a VARIANTARG structure - - ' the VARIANTARG structure looks like this: - - ' typedef struct tagVARIANT VARIANTARG; - ' struct tagVARIANT - ' { - ' Union - ' { - ' struct __tagVARIANT - ' { - ' VARTYPE vt; - ' WORD wReserved1; - ' WORD wReserved2; - ' WORD wReserved3; - ' Union - ' { - ' [...] - ' SAFEARRAY *parray; // used when not VT_BYREF - ' [...] - ' SAFEARRAY **pparray; // used when VT_BYREF - ' [...] - - ' the data element (SAFEARRAY) has an offset of 8, since VARTYPE - ' and WORD both have a length of 2 bytes; the pointer to the - ' VARIANTARG structure is the VarPtr of the Variant variable in VB - - ' getting the contents of the data element (in C/C++: *(data + 8)) - lpArrayPtr = deref(VarPtr(Data) + 8) - - ' call the 'FreeImage_DestroyLockedArrayByPtr' function to destroy - ' the array properly - Call FreeImage_DestroyLockedArrayByPtr(lpArrayPtr) - Else - - FreeImage_DestroyLockedArray = -1 - End If - -End Function - -Public Function FreeImage_DestroyLockedArrayByPtr(ByVal ArrayPtr As Long) As Long - -Dim lpSA As Long - - ' This function destroys a self-created array with a custom array - ' descriptor by a pointer to the array variable. - - ' dereference the pointer once (in C/C++: *ArrayPtr) - lpSA = deref(ArrayPtr) - ' now 'lpSA' is a pointer to the actual SAFEARRAY structure - ' and could be a null pointer when the array is not initialized - ' then, we have nothing to do here but return (-1) to indicate - ' an "error" - If (lpSA) Then - - ' destroy the array descriptor - Call SafeArrayDestroyDescriptor(lpSA) - - ' make 'lpSA' a null pointer, that is an uninitialized array; - ' keep in mind, that we here use 'ArrayPtr' as a ByVal argument, - ' since 'ArrayPtr' is a pointer to lpSA (the address of lpSA); - ' we need to zero these four bytes, 'ArrayPtr' points to - Call CopyMemory(ByVal ArrayPtr, 0&, 4) - Else - - ' the array is already uninitialized, so return an "error" value - FreeImage_DestroyLockedArrayByPtr = -1 - End If - -End Function - -Public Function FreeImage_DestroyLockedArrayRGBTRIPLE(ByRef Data() As RGBTRIPLE) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'RGBTRIPLE'. - - FreeImage_DestroyLockedArrayRGBTRIPLE = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayRGBQUAD(ByRef Data() As RGBQUAD) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'RGBQUAD'. - - FreeImage_DestroyLockedArrayRGBQUAD = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayFICOMPLEX(ByRef Data() As FICOMPLEX) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'FICOMPLEX'. - - FreeImage_DestroyLockedArrayFICOMPLEX = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayFIRGB16(ByRef Data() As FIRGB16) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'FIRGB16'. - - FreeImage_DestroyLockedArrayFIRGB16 = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayFIRGBA16(ByRef Data() As FIRGBA16) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'FIRGBA16'. - - FreeImage_DestroyLockedArrayFIRGBA16 = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayFIRGBF(ByRef Data() As FIRGBF) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'FIRGBF'. - - FreeImage_DestroyLockedArrayFIRGBF = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - -Public Function FreeImage_DestroyLockedArrayFIRGBAF(ByRef Data() As FIRGBAF) As Long - - ' This function is a thin wrapper for 'FreeImage_DestroyLockedArrayByPtr' - ' for destroying arrays of type 'FIRGBAF'. - - FreeImage_DestroyLockedArrayFIRGBAF = FreeImage_DestroyLockedArrayByPtr(VarPtrArray(Data)) - -End Function - - - -'-------------------------------------------------------------------------------- -' Private IOlePicture related helper functions -'-------------------------------------------------------------------------------- - -Private Function pGetIOlePictureFromContainer(ByRef Container As Object, _ - Optional ByVal IncludeDrawings As Boolean) As IPicture - - ' Returns a VB IOlePicture object (IPicture) from a VB image hosting control. - ' See the inline documentation of function 'FreeImage_CreateFromImageContainer' - ' for a detailed description of this helper function. - - If (Not Container Is Nothing) Then - - Select Case TypeName(Container) - - Case "PictureBox", "Form" - If (IncludeDrawings) Then - If (Not Container.AutoRedraw) Then - Call Err.Raise(5, _ - "MFreeImage", _ - Error$(5) & vbCrLf & vbCrLf & _ - "Custom drawings can only be included into the DIB when " & _ - "the container's 'AutoRedraw' property is set to True.") - Exit Function - End If - Set pGetIOlePictureFromContainer = Container.Image - Else - Set pGetIOlePictureFromContainer = Container.Picture - End If - - Case Else - - Dim bHasPicture As Boolean - Dim bHasImage As Boolean - Dim bIsAutoRedraw As Boolean - - On Error Resume Next - bHasPicture = (Container.Picture <> 0) - bHasImage = (Container.Image <> 0) - bIsAutoRedraw = Container.AutoRedraw - On Error GoTo 0 - - If ((IncludeDrawings) And _ - (bHasImage) And _ - (bIsAutoRedraw)) Then - Set pGetIOlePictureFromContainer = Container.Image - - ElseIf (bHasPicture) Then - Set pGetIOlePictureFromContainer = Container.Picture - - Else - Call Err.Raise(5, _ - "MFreeImage", _ - Error$(5) & vbCrLf & vbCrLf & _ - "Cannot create DIB from container control. Container " & _ - "control has no 'Picture' property.") - - End If - - End Select - - End If - -End Function - - - -'-------------------------------------------------------------------------------- -' Private image and color helper functions -'-------------------------------------------------------------------------------- - -Private Function pGetPreviousColorDepth(ByVal bpp As Long) As Long - - ' This function returns the 'previous' color depth of a given - ' color depth. Here, 'previous' means the next smaller color - ' depth. - - Select Case bpp - - Case 32 - pGetPreviousColorDepth = 24 - - Case 24 - pGetPreviousColorDepth = 16 - - Case 16 - pGetPreviousColorDepth = 15 - - Case 15 - pGetPreviousColorDepth = 8 - - Case 8 - pGetPreviousColorDepth = 4 - - Case 4 - pGetPreviousColorDepth = 1 - - End Select - -End Function - -Private Function pGetNextColorDepth(ByVal bpp As Long) As Long - - ' This function returns the 'next' color depth of a given - ' color depth. Here, 'next' means the next greater color - ' depth. - - Select Case bpp - - Case 1 - pGetNextColorDepth = 4 - - Case 4 - pGetNextColorDepth = 8 - - Case 8 - pGetNextColorDepth = 15 - - Case 15 - pGetNextColorDepth = 16 - - Case 16 - pGetNextColorDepth = 24 - - Case 24 - pGetNextColorDepth = 32 - - End Select - -End Function - - - -'-------------------------------------------------------------------------------- -' Private metadata helper functions -'-------------------------------------------------------------------------------- - -Private Function pGetTagFromTagPtr(ByVal Model As FREE_IMAGE_MDMODEL, _ - ByVal TagPtr As Long) As FREE_IMAGE_TAG - -Dim tTag As FITAG -Dim lTemp As Long -Dim i As Long - - ' This function converts data stored in a real FreeImage tag - ' pointer (FITAG **tag) into a VB friendly structure FREE_IMAGE_TAG. - - If (TagPtr <> 0) Then - - ' this is like (only like!) tTag tag = (FITAG) TagPtr; in C/C++ - ' we copy Len(tTag) bytes from the address in TagPtr in to a - ' private FITAG structure tTag so we have easy access to all - ' FITAG members - Call CopyMemory(tTag, ByVal deref(TagPtr), Len(tTag)) - - With pGetTagFromTagPtr - - ' first fill all members expect 'Value' in our - ' VB friendly FREE_IMAGE_TAG structure - - ' since we use this VB friendly FREE_IMAGE_TAG structure - ' for later tag modification too, we also need to store the - ' tag model and the pointer to the actual FreeImage FITAG - ' structure - .Model = Model - .TagPtr = TagPtr - - ' although FITAG's 'count' and 'length' members are - ' unsigned longs, we do not expect values greater - ' than 2,147,483,647, so we store them in normal VB - ' signed longs - .Count = tTag.Count - .Length = tTag.Length - - ' strings are stored as pointers to the actual string - ' data in FITAG - .Description = pGetStringFromPointerA(tTag.Description) - .Key = pGetStringFromPointerA(tTag.Key) - - ' FITAG's 'id' and 'type' members are unsigned shorts; - ' first of all 'id' may exceed the range of a signed - ' short (Integer data type in VB), so we store them in - ' signed longs and use CopyMemory for to keep the - ' unsigned bit layout - Call CopyMemory(.Id, tTag.Id, 2) - Call CopyMemory(.Type, tTag.Type, 2) - - ' StringValue is the result of FreeImage_TagToString(); we - ' also store this tag representation in our structure - .StringValue = FreeImage_TagToString(Model, TagPtr) - - - ' now comes the hard part, getting the tag's value - - Select Case .Type - - Case FIDT_BYTE, _ - FIDT_UNDEFINED - If (.Count > 1) Then - Dim abBytes() As Byte - ' for a byte array, just redim a VB Byte array and - ' copy Count bytes from the pointer - ReDim abBytes(.Count - 1) - Call CopyMemory(abBytes(0), ByVal tTag.Value, .Count) - .Value = abBytes - Else - ' copy a single byte into a Long and assign - ' with CByte() - Call CopyMemory(lTemp, ByVal tTag.Value, 1) - .Value = CByte(lTemp) - End If - - Case FIDT_ASCII - ' for an ASCII string, 'value' is just a pointer to the - ' string's actual data - .Value = pGetStringFromPointerA(tTag.Value) - - Case FIDT_SHORT - Dim iTemp As Integer - If (.Count > 1) Then - ' for a unsigned long array, first redim Value to - ' proper size - ReDim .Value(.Count - 1) - ' iterate over all items - For i = 0 To .Count - 1 - ' copy each value into a Long and - ' assign with FreeImage_UnsignedShort() to the - ' corresponding item in the (Variant) Value array - Call CopyMemory(iTemp, ByVal tTag.Value + i * 2, 2) - .Value(i) = FreeImage_UnsignedShort(iTemp) - Next i - Else - ' copy a single byte into a Long and assign - ' with FreeImgage_UnsignedShort() - Call CopyMemory(iTemp, ByVal tTag.Value, 2) - ' this works although FreeImage_UnsignedShort() takes - ' an Integer parameter since lTemp was 0 before and - ' we copied only 2 bytes so, VB's implicit conversion - ' to Integer will never produce an overflow - .Value = FreeImage_UnsignedShort(iTemp) - End If - - Case FIDT_LONG, _ - FIDT_IFD - If (.Count > 1) Then - ' for a unsigned long array, first redim Value to - ' proper size - ReDim .Value(.Count - 1) - ' iterate over all items - For i = 0 To .Count - 1 - ' copy each value into a (signed) Long and - ' assign with FreeImage_UnsignedLong() to the - ' corresponding item in the (Variant) Value array - Call CopyMemory(lTemp, ByVal tTag.Value + i * 4, 4) - .Value(i) = FreeImage_UnsignedLong(lTemp) - Next i - Else - ' copy a single unsigned long into a (signed) Long and - ' assign with FreeImage_UnsignedLong() - Call CopyMemory(lTemp, ByVal tTag.Value, 2) - .Value = FreeImage_UnsignedLong(lTemp) - End If - - Case FIDT_RATIONAL, _ - FIDT_SRATIONAL - ' rational values are always stored in the FREE_IMAGE_TAG - ' structure's FIRATIONAL array 'RationalValue' so, allocate - ' enough space in both the 'Value' and 'RationalValue' - ' members to hold 'Count' items - ReDim .Value(.Count - 1) - ReDim .RationalValue(.Count - 1) - For i = 0 To .Count - 1 - ' iterate over all items - With .RationalValue(i) - ' for each item, copy both numerator and denominator - ' into a (signed) Long and assign it to the corresponding - ' member of the FIRATIONAL structure so, we first assume - ' havinge a signed rational (FIDT_SRATIONAL) here - Call CopyMemory(lTemp, ByVal tTag.Value + i * 8, 4) - .Numerator = lTemp - Call CopyMemory(lTemp, ByVal tTag.Value + i * 8 + 4, 4) - .Denominator = lTemp - End With - ' if we have an unsigned rational (FIDT_RATIONAL), convert - ' numerator and denominator - If (.Type = FIDT_RATIONAL) Then - ' convert with FreeImage_UnsignedLong() - With .RationalValue(i) - .Numerator = FreeImage_UnsignedLong(.Numerator) - .Denominator = FreeImage_UnsignedLong(.Denominator) - End With - ' normalze the unsigned rational value - Call pNormalizeRational(.RationalValue(i)) - Else - ' normalze the signed rational value - Call pNormalizeSRational(.RationalValue(i)) - End If - ' store the current fraction's (maybe only approximated) value in - ' the 'Value' member of the FREE_IMAGE_TAG structure - .Value(i) = .RationalValue(i).Numerator / .RationalValue(i).Denominator - Next i - - Case FIDT_SBYTE - If (.Count > 1) Then - ' for a signed byte array, first redim Value to - ' proper size - ReDim .Value(.Count - 1) - ' iterate over all items - For i = 0 To .Count - 1 - ' copy each signed byte value into a Long and - ' check, whether it is negative (bit 7 set) - Call CopyMemory(lTemp, ByVal tTag.Value, 1) - If (lTemp And 128) Then - ' if negative, calculate the negative value - ' and store it in an Integer - .Value(i) = CInt(-256 - (Not (lTemp - 1))) - Else - ' if positive, assign to Value as byte - .Value(i) = CByte(lTemp) - End If - Next i - Else - ' copy a single signed byte into a Long and - ' check, whether it is negative (bit 7 set) - Call CopyMemory(lTemp, ByVal tTag.Value, 1) - If (lTemp And 128) Then - ' if negative, calculate the negative value - ' and store it in an Integer - .Value = CInt(-256 - (Not (lTemp - 1))) - Else - ' if positive, assign to Value as byte - .Value = CByte(lTemp) - End If - End If - - Case FIDT_SSHORT - If (.Count > 1) Then - Dim aiSShorts() As Integer - ' for a signed short array, just redim a VB Integer array and - ' copy Count bytes from the pointer - ReDim aiSShorts(.Count - 1) - Call CopyMemory(aiSShorts(0), ByVal tTag.Value, .Count * 2) - .Value = aiSShorts - Else - ' copy a single signed short into a Long and assign - ' with CInt() - Call CopyMemory(lTemp, ByVal tTag.Value, 2) - .Value = CInt(lTemp) - End If - - Case FIDT_SLONG - If (.Count > 1) Then - Dim alSLongs() As Long - ' for a signed long array, just redim a VB Long array and - ' copy Count bytes from the pointer - ReDim alSLongs(.Count - 1) - Call CopyMemory(alSLongs(0), ByVal tTag.Value, .Count * 4) - .Value = alSLongs - Else - ' copy a single signed long into a Long and assign - ' directly - Call CopyMemory(lTemp, ByVal tTag.Value, 4) - .Value = lTemp - End If - - Case FIDT_FLOAT - If (.Count > 1) Then - Dim asngFloats() As Single - ' for a float array, just redim a VB Single array and - ' copy Count bytes from the pointer - ReDim asngFloats(.Count - 1) - Call CopyMemory(asngFloats(0), ByVal tTag.Value, .Count * 4) - .Value = asngFloats - Else - Dim sngFloat As Single - ' copy a single float into a Single and assign - ' directly - Call CopyMemory(sngFloat, ByVal tTag.Value, 4) - .Value = sngFloat - End If - - Case FIDT_DOUBLE - If (.Count > 1) Then - Dim adblDoubles() As Double - ' for a double array, just redim a VB Double array and - ' copy Count bytes from the pointer - ReDim adblDoubles(.Count - 1) - Call CopyMemory(adblDoubles(0), ByVal tTag.Value, .Count * 8) - .Value = adblDoubles - Else - Dim dblDouble As Double - ' copy a single double into a Double and assign - ' directly - Call CopyMemory(dblDouble, ByVal tTag.Value, 8) - .Value = dblDouble - End If - - Case FIDT_PALETTE - ' copy 'Count' palette entries (RGBQUAD) form the value - ' pointer into the proper dimensioned array of RGBQUAD - ReDim .Palette(.Count - 1) - For i = 0 To .Count - 1 - Call CopyMemory(.Palette(i), ByVal tTag.Value + i * 4, 4) - Next i - - End Select - - End With - End If - -End Function - -Private Sub pNormalizeRational(ByRef Value As FIRATIONAL) - -Dim vntCommon As Long - - ' This function normalizes an unsigned fraction stored in a FIRATIONAL - ' structure by cancelling down the fraction. This is commonly done - ' by dividing both numerator and denominator by their greates - ' common divisor (gcd) - - With Value - If ((.Numerator <> 1) And (.Denominator <> 1)) Then - vntCommon = gcd(.Numerator, .Denominator) - If (vntCommon <> 1) Then - ' convert values back to an unsigned long (may - ' result in a subtype Currency if the range of the - ' VB Long is insufficient for storing the value!) - .Numerator = FreeImage_UnsignedLong(.Numerator / vntCommon) - .Denominator = FreeImage_UnsignedLong(.Denominator / vntCommon) - End If - End If - End With - -End Sub - -Private Sub pNormalizeSRational(ByRef Value As FIRATIONAL) - -Dim lCommon As Long - - ' This function normalizes a signed fraction stored in a FIRATIONAL - ' structure by cancelling down the fraction. This is commonly done - ' by dividing both numerator and denominator by their greates - ' common divisor (gcd) - - With Value - If ((.Numerator <> 1) And (.Denominator <> 1)) Then - lCommon = gcd(.Numerator, .Denominator) - If (lCommon <> 1) Then - ' using the CLng() function for not to get - ' a subtype Double here - .Numerator = CLng(.Numerator / lCommon) - .Denominator = CLng(.Denominator / lCommon) - End If - End If - - ' adjust the position of the negative sign if one is present: - ' it should preceed the numerator, not the denominator - If (.Denominator < 0) Then - .Denominator = -.Denominator - .Numerator = -.Numerator - End If - End With - -End Sub - -Private Function gcd(ByVal a As Variant, ByVal B As Variant) As Variant - -Dim vntTemp As Variant - - ' calculate greatest common divisor - - Do While (B) - vntTemp = B - ' calculate b = a % b (modulo) - ' this could be just: - ' b = a Mod b - ' but VB's Mod operator fails for unsigned - ' long values stored in currency variables - ' so, we use the mathematical definition of - ' the modulo operator taken from WikipediA. - B = a - floor(a / B) * B - a = vntTemp - Loop - gcd = a - -End Function - -Private Function floor(ByRef a As Variant) As Variant - - ' this is a VB version of the floor() function - If (a < 0) Then - floor = VBA.Int(a) - Else - floor = -VBA.Fix(-a) - End If - -End Function - -Private Function pTagToTagPtr(ByRef Tag As FREE_IMAGE_TAG) As Boolean - -Dim tTagSave As FITAG -Dim lpTag As Long -Dim abValueBuffer() As Byte -Dim lLength As Long -Dim lCount As Long - - ' This function converts tag data stored in a VB friendly structure - ' FREE_IMAGE_TAG into a real FreeImage tag pointer (FITAG **tag). - - ' This function is called, whenever tag data should be updated for an - ' image, since the FreeImage's tag pointer remains valid during the - ' whole lifetime of a DIB. So, changes written to that pointer (or - ' even better, the FITAG structure at the address, the pointer points - ' to), are real updates to the image's tag. - - With Tag - - lpTag = deref(.TagPtr) - - ' save current (FITAG) tag for an optional 'undo' operation - ' invoked on failure - Call CopyMemory(tTagSave, ByVal lpTag, Len(tTagSave)) - - ' set tag id - Call CopyMemory(ByVal lpTag + 8, .Id, 2) - ' set tag type - Call CopyMemory(ByVal lpTag + 10, .Type, 2) - ' set tag key (use native FreeImage function to handle - ' memory allocation) - Call FreeImage_SetTagKey(.TagPtr, .Key) - - ' here, we update the tag's value - ' generally, we create a plain byte buffer containing all the - ' value's data and use FreeImage_SetTagValue() with the - ' const void *value pointer set to the byte buffer's address. - - ' the variable abValueBuffer is our byte buffer that is, - ' depending on the FreeImage tag data type, allocated and filled - ' accordingly - ' The variables 'lLength' and 'lCount' are set up correctly for - ' each data type and will be filled into the FITAG structure - ' before calling FreeImage_SetTagValue(); after all, the VB - ' Tag structure's (FREE_IMAGE_TAG) 'Count' and 'Length' members - ' are updated with 'lLength' and 'lCount'. - - Select Case .Type - - Case FIDT_ASCII - ' use StrConv() to get an ASCII byte array from a VB String (BSTR) - abValueBuffer = StrConv(.Value, vbFromUnicode) - ' according to FreeImage's source code, both 'count' and 'length' - ' must be the length of the string - lCount = Len(.Value) - lLength = lCount - - Case FIDT_PALETTE - ' ensure, that there are at least 'Count' entries in the - ' palette array - lCount = .Count - If (UBound(.Palette) + 1 < lCount) Then - ' if not, adjust Count - lCount = UBound(.Palette) + 1 - End If - ' 4 bytes per element - lLength = lCount * 4 - ' allocate buffer and copy data from Palatte array - ReDim abValueBuffer(lLength - 1) - Call CopyMemory(abValueBuffer(0), .Palette(LBound(.Palette)), lLength) - - Case FIDT_RATIONAL, _ - FIDT_SRATIONAL - ' we use a helper function to get a byte buffer for any type of - ' rational value - lCount = pGetRationalValueBuffer(.RationalValue, abValueBuffer) - If (lCount > .Count) Then - lCount = .Count - End If - ' eight bytes per element (2 longs) - lLength = lCount * 8 - - Case Else - ' we use a helper function to get a byte buffer for any other type - lCount = pGetValueBuffer(.Value, .Type, lLength, abValueBuffer) - If (lCount > .Count) Then - lCount = .Count - End If - ' lLength was used as an OUT parameter when calling pGetValueBuffer - ' it now contains the size of one element in bytes so, multiply with - ' lCount to get the total length - lLength = lLength * lCount - - End Select - - ' set tag length - Call CopyMemory(ByVal lpTag + 16, lLength, 4) - ' set tag count - Call CopyMemory(ByVal lpTag + 12, lCount, 4) - - If (FreeImage_SetTagValue(.TagPtr, VarPtr(abValueBuffer(0))) <> 0) Then - - ' update Tag's members - ' update Count - .Count = lCount - ' update Length - .Length = lLength - ' update StringValue - .StringValue = FreeImage_TagToString(.Model, .TagPtr) - pTagToTagPtr = True - Else - - ' restore saved (FITAG) tag values on failure - Call CopyMemory(ByVal lpTag, tTagSave, Len(tTagSave)) - End If - - End With - -End Function - -Private Function pGetValueBuffer(ByRef Value As Variant, _ - ByVal MetaDataVarType As FREE_IMAGE_MDTYPE, _ - ByRef ElementSize As Long, _ - ByRef Buffer() As Byte) As Long - -Dim lElementCount As Long -Dim bIsArray As Boolean -Dim abValueBuffer(7) As Byte -Dim cBytes As Long -Dim i As Long - - ' This function copies any value provided in the Variant 'Value' - ' parameter into the byte array Buffer. 'Value' may contain an - ' array as well. The values in the byte buffer are aligned to fit - ' the FreeImage data type for tag values specified in - ' 'MetaDataVarType'. For integer values, it does not matter, in - ' which VB data type the values are provided. For example, it is - ' possible to transform a provided byte array into a unsigned long - ' array. - - ' The parameter 'ElementSize' is an OUT value, providing the actual - ' size per element in the byte buffer in bytes to the caller. - - ' This function works for the types FIDT_BYTE, FIDT_SHORT, FIDT_LONG, - ' FIDT_SBYTE , FIDT_SSHORT, FIDT_SLONG, FIDT_FLOAT, FIDT_DOUBLE - ' and FIDT_IFD - - ElementSize = pGetElementSize(MetaDataVarType) - If (Not IsArray(Value)) Then - lElementCount = 1 - Else - On Error Resume Next - lElementCount = UBound(Value) - LBound(Value) + 1 - On Error GoTo 0 - bIsArray = True - End If - - If (lElementCount > 0) Then - ReDim Buffer((lElementCount * ElementSize) - 1) - - If (Not bIsArray) Then - cBytes = pGetVariantAsByteBuffer(Value, abValueBuffer) - If (cBytes > ElementSize) Then - cBytes = ElementSize - End If - Call CopyMemory(Buffer(0), abValueBuffer(0), cBytes) - Else - For i = LBound(Value) To UBound(Value) - cBytes = pGetVariantAsByteBuffer(Value(i), abValueBuffer) - If (cBytes > ElementSize) Then - cBytes = ElementSize - End If - Call CopyMemory(Buffer(0 + (i * ElementSize)), abValueBuffer(0), cBytes) - Next i - End If - - pGetValueBuffer = lElementCount - End If - -End Function - -Private Function pGetRationalValueBuffer(ByRef RationalValues() As FIRATIONAL, _ - ByRef Buffer() As Byte) As Long - -Dim lElementCount As Long -Dim abValueBuffer(7) As Byte -Dim cBytes As Long -Dim i As Long - - ' This function copies a number of elements from the FIRATIONAL array - ' 'RationalValues' into the byte buffer 'Buffer'. - - ' From the caller's point of view, this function is the same as - ' 'pGetValueBuffer', except, it only works for arrays of FIRATIONAL. - - ' This function works for the types FIDT_RATIONAL and FIDT_SRATIONAL. - - lElementCount = UBound(RationalValues) - LBound(RationalValues) + 1 - ReDim Buffer(lElementCount * 8 + 1) - - For i = LBound(RationalValues) To UBound(RationalValues) - cBytes = pGetVariantAsByteBuffer(RationalValues(i).Numerator, abValueBuffer) - If (cBytes > 4) Then - cBytes = 4 - End If - Call CopyMemory(Buffer(0 + (i * 8)), abValueBuffer(0), cBytes) - - cBytes = pGetVariantAsByteBuffer(RationalValues(i).Denominator, abValueBuffer) - If (cBytes > 4) Then - cBytes = 4 - End If - Call CopyMemory(Buffer(4 + (i * 8)), abValueBuffer(0), cBytes) - Next i - - pGetRationalValueBuffer = lElementCount - -End Function - -Private Function pGetVariantAsByteBuffer(ByRef Value As Variant, _ - ByRef Buffer() As Byte) As Long - -Dim lLength As Long - - ' This function fills a byte buffer 'Buffer' with data taken - ' from a Variant parameter. Depending on the Variant's type and, - ' width, it copies N (lLength) bytes into the buffer starting - ' at the buffer's first byte at Buffer(0). The function returns - ' the number of bytes copied. - - ' It is much easier to assign the Variant to a variable of - ' the proper native type first, since gathering a Variant's - ' actual value is a hard job to implement for each subtype. - - Select Case VarType(Value) - - Case vbByte - Buffer(0) = Value - lLength = 1 - - Case vbInteger - Dim iInteger As Integer - iInteger = Value - lLength = 2 - Call CopyMemory(Buffer(0), iInteger, lLength) - - Case vbLong - Dim lLong As Long - lLong = Value - lLength = 4 - Call CopyMemory(Buffer(0), lLong, lLength) - - Case vbCurrency - Dim cCurrency As Currency - ' since the Currency data type is a so called scaled - ' integer, we have to divide by 10.000 first to get the - ' proper bit layout. - cCurrency = Value / 10000 - lLength = 8 - Call CopyMemory(Buffer(0), cCurrency, lLength) - - Case vbSingle - Dim sSingle As Single - sSingle = Value - lLength = 4 - Call CopyMemory(Buffer(0), sSingle, lLength) - - Case vbDouble - Dim dblDouble As Double - dblDouble = Value - lLength = 8 - Call CopyMemory(Buffer(0), dblDouble, lLength) - - End Select - - pGetVariantAsByteBuffer = lLength - -End Function - -Private Function pGetElementSize(ByVal vt As FREE_IMAGE_MDTYPE) As Long - - ' This function returns the width in bytes for any of the - ' FreeImage metadata tag data types. - - Select Case vt - - Case FIDT_BYTE, _ - FIDT_SBYTE, _ - FIDT_UNDEFINED, _ - FIDT_ASCII - pGetElementSize = 1 - - Case FIDT_SHORT, _ - FIDT_SSHORT - pGetElementSize = 2 - - Case FIDT_LONG, _ - FIDT_SLONG, _ - FIDT_FLOAT, _ - FIDT_PALETTE, _ - FIDT_IFD - pGetElementSize = 4 - - Case Else - pGetElementSize = 8 - - End Select - -End Function - - - -'-------------------------------------------------------------------------------- -' Private pointer manipulation helper functions -'-------------------------------------------------------------------------------- - -Private Function pGetStringFromPointerA(ByRef Ptr As Long) As String - -Dim abBuffer() As Byte -Dim lLength As Long - - ' This function creates and returns a VB BSTR variable from - ' a C/C++ style string pointer by making a redundant deep - ' copy of the string's characters. - - If (Ptr) Then - ' get the length of the ANSI string pointed to by ptr - lLength = lstrlen(Ptr) - If (lLength) Then - ' copy characters to a byte array - ReDim abBuffer(lLength - 1) - Call CopyMemory(abBuffer(0), ByVal Ptr, lLength) - ' convert from byte array to unicode BSTR - pGetStringFromPointerA = StrConv(abBuffer, vbUnicode) - End If - End If - -End Function - -Private Function deref(ByVal Ptr As Long) As Long - - ' This function dereferences a pointer and returns the - ' contents as it's return value. - - ' in C/C++ this would be: - ' return *(ptr); - - Call CopyMemory(deref, ByVal Ptr, 4) - -End Function - -Private Sub pSwap(ByVal lpSrc As Long, _ - ByVal lpDst As Long) - -Dim lpTmp As Long - - ' This function swaps two DWORD memory blocks pointed to - ' by lpSrc and lpDst, whereby lpSrc and lpDst are actually - ' no pointer types but contain the pointer's address. - - ' in C/C++ this would be: - ' void pSwap(int lpSrc, int lpDst) { - ' int tmp = *(int*)lpSrc; - ' *(int*)lpSrc = *(int*)lpDst; - ' *(int*)lpDst = tmp; - ' } - - Call CopyMemory(lpTmp, ByVal lpSrc, 4) - Call CopyMemory(ByVal lpSrc, ByVal lpDst, 4) - Call CopyMemory(ByVal lpDst, lpTmp, 4) - -End Sub - -Private Function pGetMemoryBlockPtrFromVariant(ByRef Data As Variant, _ - Optional ByRef SizeInBytes As Long, _ - Optional ByRef ElementSize As Long) As Long - - ' This function returns the pointer to the memory block provided through - ' the Variant parameter 'data', which could be either a Byte, Integer or - ' Long array or the address of the memory block itself. In the last case, - ' the parameter 'SizeInBytes' must not be omitted or zero, since it's - ' correct value (the size of the memory block) can not be determined by - ' the address only. So, the function fails, if 'SizeInBytes' is omitted - ' or zero and 'data' is not an array but contains a Long value (the address - ' of a memory block) by returning Null. - - ' If 'data' contains either a Byte, Integer or Long array, the pointer to - ' the actual array data is returned. The parameter 'SizeInBytes' will - ' be adjusted correctly, if it was less or equal zero upon entry. - - ' The function returns Null (zero) if there was no supported memory block - ' provided. - - ' do we have an array? - If (VarType(Data) And vbArray) Then - Select Case (VarType(Data) And (Not vbArray)) - - Case vbByte - ElementSize = 1 - pGetMemoryBlockPtrFromVariant = pGetArrayPtrFromVariantArray(Data) - If (pGetMemoryBlockPtrFromVariant) Then - If (SizeInBytes <= 0) Then - SizeInBytes = (UBound(Data) + 1) - - ElseIf (SizeInBytes > (UBound(Data) + 1)) Then - SizeInBytes = (UBound(Data) + 1) - - End If - End If - - Case vbInteger - ElementSize = 2 - pGetMemoryBlockPtrFromVariant = pGetArrayPtrFromVariantArray(Data) - If (pGetMemoryBlockPtrFromVariant) Then - If (SizeInBytes <= 0) Then - SizeInBytes = (UBound(Data) + 1) * 2 - - ElseIf (SizeInBytes > ((UBound(Data) + 1) * 2)) Then - SizeInBytes = (UBound(Data) + 1) * 2 - - End If - End If - - Case vbLong - ElementSize = 4 - pGetMemoryBlockPtrFromVariant = pGetArrayPtrFromVariantArray(Data) - If (pGetMemoryBlockPtrFromVariant) Then - If (SizeInBytes <= 0) Then - SizeInBytes = (UBound(Data) + 1) * 4 - - ElseIf (SizeInBytes > ((UBound(Data) + 1) * 4)) Then - SizeInBytes = (UBound(Data) + 1) * 4 - - End If - End If - - End Select - Else - ElementSize = 1 - If ((VarType(Data) = vbLong) And _ - (SizeInBytes >= 0)) Then - pGetMemoryBlockPtrFromVariant = Data - End If - End If - -End Function - -Private Function pGetArrayPtrFromVariantArray(ByRef Data As Variant) As Long - -Dim eVarType As VbVarType -Dim lDataPtr As Long - - ' This function returns a pointer to the first array element of - ' a VB array (SAFEARRAY) that is passed through a Variant type - ' parameter. (Don't try this at home...) - - ' cache VarType in variable - eVarType = VarType(Data) - - ' ensure, this is an array - If (eVarType And vbArray) Then - - ' data is a VB array, what means a SAFEARRAY in C/C++, that is - ' passed through a ByRef Variant variable, that is a pointer to - ' a VARIANTARG structure - - ' the VARIANTARG structure looks like this: - - ' typedef struct tagVARIANT VARIANTARG; - ' struct tagVARIANT - ' { - ' Union - ' { - ' struct __tagVARIANT - ' { - ' VARTYPE vt; - ' WORD wReserved1; - ' WORD wReserved2; - ' WORD wReserved3; - ' Union - ' { - ' [...] - ' SAFEARRAY *parray; // used when not VT_BYREF - ' [...] - ' SAFEARRAY **pparray; // used when VT_BYREF - ' [...] - - ' the data element (SAFEARRAY) has an offset of 8, since VARTYPE - ' and WORD both have a length of 2 bytes; the pointer to the - ' VARIANTARG structure is the VarPtr of the Variant variable in VB - - ' getting the contents of the data element (in C/C++: *(data + 8)) - lDataPtr = deref(VarPtr(Data) + 8) - - ' dereference the pointer again (in C/C++: *(lDataPtr)) - lDataPtr = deref(lDataPtr) - - ' test, whether 'lDataPtr' now is a Null pointer - ' in that case, the array is not yet initialized and so we can't dereference - ' it another time since we have no permisson to acces address 0 - - ' the contents of 'lDataPtr' may be Null now in case of an uninitialized - ' array; then we can't access any of the SAFEARRAY members since the array - ' variable doesn't event point to a SAFEARRAY structure, so we will return - ' the null pointer - - If (lDataPtr) Then - ' the contents of lDataPtr now is a pointer to the SAFEARRAY structure - - ' the SAFEARRAY structure looks like this: - - ' typedef struct FARSTRUCT tagSAFEARRAY { - ' unsigned short cDims; // Count of dimensions in this array. - ' unsigned short fFeatures; // Flags used by the SafeArray - ' // routines documented below. - ' #if defined(WIN32) - ' unsigned long cbElements; // Size of an element of the array. - ' // Does not include size of - ' // pointed-to data. - ' unsigned long cLocks; // Number of times the array has been - ' // locked without corresponding unlock. - ' #Else - ' unsigned short cbElements; - ' unsigned short cLocks; - ' unsigned long handle; // Used on Macintosh only. - ' #End If - ' void HUGEP* pvData; // Pointer to the data. - ' SAFEARRAYBOUND rgsabound[1]; // One bound for each dimension. - ' } SAFEARRAY; - - ' since we live in WIN32, the pvData element has an offset - ' of 12 bytes from the base address of the structure, - ' so dereference the pvData pointer, what indeed is a pointer - ' to the actual array (in C/C++: *(lDataPtr + 12)) - lDataPtr = deref(lDataPtr + 12) - End If - - ' return this value - pGetArrayPtrFromVariantArray = lDataPtr - - ' a more shorter form of this function would be: - ' (doesn't work for uninitialized arrays, but will likely crash!) - 'pGetArrayPtrFromVariantArray = deref(deref(deref(VarPtr(data) + 8)) + 12) - End If - -End Function diff --git a/DSTexCompress/FreeImage/Wrapper/VB6/mfreeimage/WhatsNew_VB.txt b/DSTexCompress/FreeImage/Wrapper/VB6/mfreeimage/WhatsNew_VB.txt deleted file mode 100644 index bb85095..0000000 --- a/DSTexCompress/FreeImage/Wrapper/VB6/mfreeimage/WhatsNew_VB.txt +++ /dev/null @@ -1,625 +0,0 @@ -What's New for FreeImage VB Wrapper - -* : fixed -- : removed -! : changed -+ : added - -August 11, 2010 - 2.13 -+ [Carsten Klein] added PSD load flags PSD_CMYK and PSD_LAB as well as the enum constants FILO_PSD_CYMK and FILO_PSD_LAB. -+ [Carsten Klein] added TIFF_LOGLUV save flag as well as the enum constant FISO_TIFF_LOGLUV. - -July 20, 2010 - 2.12 -+ [Carsten Klein] added support for the new EXIF_RAW metadata model by adding enum constant FIMD_EXIF_RAW. -+ [Carsten Klein] added the new FIF_LOAD_NOPIXELS flag as well as the enum constant FILO_LOAD_NOPIXELS. -+ [Carsten Klein] added function declaration FreeImage_HasPixelsInt and a real VB Boolean returning function FreeImage_HasPixels. -+ [Carsten Klein] added function declaration FreeImage_FIFSupportsNoPixelsInt and a real VB Boolean returning function FreeImage_FIFSupportsNoPixels. - -June 20, 2010 - 2.11 -+ [Carsten Klein] added new save flag JPEG_OPTIMIZE (also added FISO_JPEG_OPTIMIZE to enumeration FREE_IMAGE_SAVE_OPTIONS). - -April 20, 2010 - 2.10 -+ [Carsten Klein] added new save flag TARGA_SAVE_RLE (also added FISO_TARGA_SAVE_RLE to enumeration FREE_IMAGE_SAVE_OPTIONS). -! [Carsten Klein] changed constants FREEIMAGE_MINOR_VERSION and FREEIMAGE_RELEASE_SERIAL: set to 14 and 0 respectively to match current version 3.14.0 -+ [Carsten Klein] added function FreeImage_ConvertToFloat. -+ [Carsten Klein] added function FreeImage_SaveMultiBitmapToMemory. -+ [Carsten Klein] added wrapper functions FreeImage_SaveMultiBitmapToMemoryEx and FreeImage_SaveMultiBitmapToMemoryEx2. -+ [Carsten Klein] added wrapper function FreeImage_OpenMultiBitmapEx, which only opens existing files, but has support for automatic image format detection. -+ [Carsten Klein] added wrapper function FreeImage_CreateMultiBitmapEx, which only creates new (empty) multi-page bitmaps with support for automatic image format detection. -* [Carsten Klein] fixed a bug in FreeImage_LoadEx: now uses the file specified for format detection rather than the filename extension. -+ [Carsten Klein] improved error messages in function FreeImage_LoadEx. -* [Carsten Klein] fixed a bug in FreeImage_AcquireMemoryEx: no more crashes when passing an uninitialized array. -+ [Carsten Klein] added thin wrapper functions, enabling proper handling of Boolean parameters: -+ added wrapper function FreeImage_OpenMultiBitmap -+ added wrapper function FreeImage_UnlockPage -+ added wrapper function FreeImage_RotateEx -+ added wrapper function FreeImage_MakeThumbnail -+ added wrapper function FreeImage_GetAdjustColorsLookupTable -+ added wrapper function FreeImage_ApplyColorMapping -+ added wrapper function FreeImage_SwapColors -+ added wrapper function FreeImage_SwapColorsByLong -+ added wrapper function FreeImage_ApplyIndexMapping -+ added wrapper function FreeImage_SetTransparent -+ added wrapper function FreeImage_ConvertFromRawBits -+ added wrapper function FreeImage_ConvertToRawBits -+ added wrapper function FreeImage_ConvertToStandardType -+ added wrapper function FreeImage_ConvertToType -! [Carsten Klein] changed the parameter names of most functions. -! [Carsten Klein] changed signature of functions FreeImage_ConvertFromRawBits and FreeImage_ConvertToRawBits: 'ByRef Bits As Long' is now 'ByVal BitsPtr As Long'. -+ [Carsten Klein] added wrapper functions FreeImage_ConvertFromRawBitsEx and FreeImage_ConvertToRawBitsEx. -* [Carsten Klein] fixed a bug in declaration of function FreeImage_TmoReinhard05Ex: parameters 'Adaption' and 'ColorCorrection' are now passed by value. -- [Carsten Klein] removed half-implemented function FreeImage_SetChannelEx. -+ [Carsten Klein] added wrapper function FreeImage_SetChannelIOP. -- [Carsten Klein] removed needless default values of optional parameters. -- [Carsten Klein] removed function declaration FreeImage_CompositeByLong: replaced by declaration FreeImage_Composite. -! [Carsten Klein] changed function declaration FreeImage_Composite: application back color is now passed as ByRef ... As Any and so takes both RGBQUAD and Long valus. -+ [Carsten Klein] added wrapper function FreeImage_UnloadEx, which additionally sets the ByRef-passed Bitmap handle to zero after unloading. -+ [Carsten Klein] added wrapper functions ConvertColor and ConvertOleColor to convert VB-style BGR colors into RGB color values. - -! now FreeImage version 3.14.0 - -February 9, 2010 - 2.9.1 -* [Carsten Klein] fixed a bug in FreeImage_GetBackgroundColorAsLong: parameter 'bkcolor' is now properly passed ByRef. - -February 9, 2010 - 2.9 -* [Carsten Klein] fixed a syntax typo - -February 8, 2010 - 2.8 -* [Mike Weir] fixed a bug in function FreeImage_ApplyColorMappingEx: now properly includes all specified mapping entries -* [Carsten Klein] fixed a bug in function FreeImage_ApplyIndexMappingEx: now properly includes all specified mapping entries -* [Mike Weir] fixed a bug in function FreeImage_RescaleEx: now also rescales the image, if either the new width or height matches the image's current size -* [WinAnd / Carsten Klein] fixed a bug in function FreeImage_GetTransparencyTableExClone: returns an uninitialized array if there is no transparency table -* [WinAnd / Carsten Klein] fixed a bug in function FreeImage_SearchPalette: no longer crashes if there is no transparency table - -December 21, 2009 - 2.7 -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 1 to match current version 3.13.1 - -! now FreeImage version 3.13.1 - -December 18, 2009 - 2.6 -- [Carsten Klein] removed usage of constants vbPicTypeBitmap and vbPicTypeIcon: these are not available in VBA environments like Excel, Access or Outlook. - -September 08, 2009 - 2.5 -! [Carsten Klein] changed constant FREEIMAGE_MINOR_VERSION: set to 13 to match current version 3.13.0 -+ [Carsten Klein] added load flag constant JPEG_EXIFROTATE and new member FILO_JPEG_EXIFROTATE to enumeration FREE_IMAGE_LOAD_OPTIONS. -+ [Carsten Klein] added support for the PFM image format. -+ [Carsten Klein] added support for the PICT and RAW image formats. -+ [Carsten Klein] added UNICODE functions FreeImage_JPEGTransformU and FreeImage_JPEGCropU. -+ [Carsten Klein] added enumeration FREE_IMAGE_COLOR_OPTIONS, which contains options to specify colors, used with FreeImage_FillBackground and FreeImage_EnlargeCanvas. -+ [Carsten Klein] added function FreeImage_FillBackground: although this returns BOOL in C/C++, the VB version only returns a Long. -+ [Carsten Klein] added wrapper functions FreeImage_FillBackgroundEx and FreeImage_FillBackgroundByLong, taking an RGBQUAD and a Long 'Color' argument respectively and return a true VB Boolean. -+ [Carsten Klein] added function FreeImage_EnlargeCanvas. -+ [Carsten Klein] added functions FreeImage_AllocateEx and FreeImage_AllocateExT. -+ [Carsten Klein] added function FreeImage_TmoReinhard05Ex. -+ [Carsten Klein] added function FreeImage_Rotate. -+ [Carsten Klein] added wrapper function FreeImage_RotateIOP. - -! now FreeImage version 3.13.0 - -March 18, 2009 - 2.4.2 -+ [Carsten Klein] added enumeration FREE_IMAGE_FRAME_DISPOSAL_METHODS, which provides the frame disposal options needed to create animated GIF files. - -July 29, 2008 - 2.4.1 -* [Carsten Klein] minor documentation updates -! [Carsten Klein] renamed member FICF_PALETTISED_8BPP of enumeration FREE_IMAGE_CONVERSION_FLAGS into FICF_PALLETISED_8BPP. - -June 30, 2008 - 2.4 -* [Carsten Klein] fixed some minor issues in FreeImage_PaintTransparent() - -June 06, 2008 - 2.3 -+ [Carsten Klein] added new compression flags to the JPEG and PNG plugins -! [Carsten Klein] renamed wrapper function FreeImage_CloneMetadata() to FreeImage_CloneMetadataEx(): now, there is a native function called FreeImage_CloneMetadata(). -+ [Carsten Klein] added private and internal function declaration for FreeImage_CloneMetadata() along with it's public Boolean returning wrapper function. -- [Carsten Klein] removed the FreeImage_ColorQuantizeEx() stuff from both functions FreeImage_ConvertColorDepth() and FreeImage_ConvertColorDepthIOP(): removed parameters PaletteSize, ReserveSize and ReservePalette. -- [Carsten Klein] changed declaration of FreeImage_ColorQuantizeEx() to be a internal function private to the wrapper with an 'Int' appendix. -+ [Carsten Klein] added two more VB-friendly public wrapper functions FreeImage_ColorQuantizeEx() and FreeImage_ColorQuantizeExIOP(). -+ [Carsten Klein] added wrapper function FreeImage_GetPalettePtr(): gets the pointer to a specified array of RGBQUADs: intended to be used together with any of the ColorQuantizeEx functions. -! [Carsten Klein] changed constant FREEIMAGE_MINOR_VERSION: set to 11 to match current version 3.11.0 - -! now FreeImage version 3.11.0 - -December 14, 2007 - 2.2.1 -+ [Carsten Klein] added constants for member 'biCompression' in BITMAPINFOHEADER struct -+ [Carsten Klein] added wrapper function FreeImage_GetInfoHeaderEx(), which returns a fully populated BITMAPINFOHEADER struct for a bitmap. -* [Carsten Klein] fixed a bug in FreeImage_GetFileTypeFromMemoryEx(): now calls FreeImage_CloseMemory() releasing the hStream to prevent memory leaks. -+ [Carsten Klein] added wrapper function FreeImage_GetColorizedPalette(): returns a colorized greyscale palettte. -+ [Carsten Klein] added wrapper function FreeImage_Colorize(): applies a colorized greyscale palettte obtained from FreeImage_GetColorizedPalette() to a bitmap. -+ [Carsten Klein] added wrapper function FreeImage_Sepia(): calls FreeImage_Colorize() with proper parameters to apply a so called sepia palette to a bitmap. - -December 12, 2007 - 2.2 -* [Carsten Klein] Fixed a small bug in FreeImage_PaintTransparent, which now calls function FreeImage_ConvertTo32Bits instead of FreeImage_ConvertTo32Bits2. - -November 15, 2007 - 2.1 -* [Carsten Klein] adjusted page numbers of the API documentation in FreeImage function declarations to match FreeImage 3.10.0 API documentation -- [Carsten Klein] removed parameter 'bUnloadSource' from function FreeImage_GetOlePictureIcon(): an hIcon should not be destroyed if OleCreatePictureIndirect() is called with fOwn = True. -! [Carsten Klein] refactored FreeImage_GetOlePicture(): now relies on FreeImage_GetBitmap(). - -November 10, 2007 - 2.0.8 -! [Carsten Klein] changed declaration of FreeImage_SetOutputMessage(): now points transparently to the __stdcall version of this function in the library. -+ [Carsten Klein] added function declaraton for FreeImage_MultigridPoissonSolver(). -+ [Carsten Klein] added function declaraton for FreeImage_GetTransparentIndex() and FreeImage_SetTransparentIndex(). -+ [Carsten Klein] added private and internal function declaraton for FreeImage_AdjustColors() along with it's public Boolean returning wrapper function. -+ [Carsten Klein] added function declaraton for FreeImage_GetAdjustColorsLookupTable(). -+ [Carsten Klein] added wrapper function FreeImage_GetAdjustColorsLookupTableEx(): this takes a real VB style Byte array ton receive the lookup table created. -+ [Carsten Klein] added function declaraton for FreeImage_ApplyColorMapping(). -+ [Carsten Klein] added wrapper function FreeImage_ApplyColorMappingEx(): this takes a real VB style RGBQUAD array. -+ [Carsten Klein] added function declaratons for FreeImage_SwapColors() and FreeImage_SwapColorsByLong(). -+ [Carsten Klein] added function declaraton for FreeImage_ApplyIndexMapping(). -+ [Carsten Klein] added wrapper function FreeImage_ApplyIndexMappingEx(): this takes a real VB style Byte array. -+ [Carsten Klein] added function declaraton for FreeImage_SwapPaletteIndices(). - -November 05, 2007 - 2.0.7 -+ [Carsten Klein] added 4 bit color depth to both function pGetNextColorDepth() and pGetPrevousColorDepth() -- [Carsten Klein] removed member FICF_PREPARE_RESCALE from enumeration FREE_IMAGE_CONVERSION_FLAGS -- [Carsten Klein] removed all references to FICF_PREPARE_RESCALE: Converting color depth before rescaling an image is no longer performed by the wrapper. Since FreeImage now transparently converts color depth on rescaling, doing this in the wrapper is no longer needed. -! [Carsten Klein] refactored wrapper function FreeImage_ConvertColorDepth(): removed case FICF_PREPARE_RESCALE; is now more similar to C# wrapper's version of this function. -! [Carsten Klein] refactored wrapper function FreeImage_SaveEx(): removed case FICF_PREPARE_RESCALE; is now more similar to C# wrapper's version of this function. - -September 14, 2007 - 2.0.6 -+ [Carsten Klein] added function declaration and Boolean wrapper function for FreeImage_PreMultiplyWithAlpha(). - -July 26, 2007 - 2.0.5 -+ [Carsten Klein] added wrapper function FreeImage_GetBitmap(): returns an HBITMAP created by the CreateDIBSection() function and so has the same color depth as the original DIB. -+ [Carsten Klein] added wrapper function FreeImage_GetBitmapForDevice(): returns an HBITMAP created by the CreateDIBitmap() function and so has the same color depth as the specified reference DC or as the desktop, if the 'hDC' parameter was omitted. -- [Carsten Klein] removed function declaration for GetWindowDC(): this function is no longer used. -* [Carsten Klein] fixed a bug in wrapper function FreeImage_IsExtensionValidForFIF(): string comparison now includes a comma. -* [Carsten Klein] fixed a bug in wrapper function FreeImage_IsFilenameValidForFIF(): string comparison now includes a comma. - -July 25, 2007 - 2.0.4 -* [Carsten Klein] fixed a bug in function FreeImage_GetPaletteExClone(): now actually returns the palette as RGBQUAD array plus some other minor improvements -+ [Carsten Klein] added wrapper function FreeImage_GetPaletteExLongClone(): this function returns a VB style Byte array that is only wrapped around FreeImage's pointer to a DIB's transparency table. -+ [Carsten Klein] added wrapper function FreeImage_GetTransparencyTableEx(): this function returns a VB style Byte array that is only wrapped around FreeImage's pointer to a DIB's transparency table. -! [Carsten Klein] changed name of wrapper function FreeImage_GetTransparencyTableEx(): this function is now named FreeImage_GetTransparencyTableExClone(), since it actually returns a clone (deep copy) of an image's transparency table (compare with FreeImage_GetPaletteExClone()). -+ [Carsten Klein] added wrapper function FreeImage_SetPalette(): sets an image's palette through a VB style RGBQUAD array. -+ [Carsten Klein] added wrapper function FreeImage_SetPaletteLong(): sets an image's palette through a VB style Long array. -+ [Carsten Klein] added function declaration for CreateDIBsection() -+ [Carsten Klein] added function declaration for DeleteDC() -* [Carsten Klein] fixed a bug in wrapper function FreeImage_CreateFromScreen(): now the memory DC is deleted with the DeleteDC() function and no longer with the DeleteObject() function. - -July 05, 2007 - 2.0.3 -+ [Carsten Klein] added wrapper function FreeImage_GetFileTypeFromMemoryEx(): more VB friendly version of FreeImage_GetFileTypeFromMemory() which may take an array rather than a FIMEMORY stream. - -May 21, 2007 - 2.0.2 -! [Carsten Klein] changed constant FREEIMAGE_MINOR_VERSION: set to 10 to match current version 3.10.0 -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 0 to match current version 3.10.0 -+ [Carsten Klein] added image format constants FIF_EXR, FIF_J2K and FIF_JP2 to enumeration FREE_IMAGE_FORMAT. -+ [Carsten Klein] added tone mapping operator constant FITMO_FATTAL02 to enumeration FREE_IMAGE_TMO. -+ [Carsten Klein] added save option constants J2K_DEFAULT and JP2_DEFAULT for JPEG2000 format. -+ [Carsten Klein] added save option constants EXR_DEFAULT, EXR_FLOAT, EXR_NONE, EXR_ZIP, EXR_PIZ, EXR_PXR24, EXR_B44 and EXR_LC for EXR format. -+ [Carsten Klein] added save option constants for EXR format to enumeration FREE_IMAGE_SAVE_OPTIONS. -+ [Carsten Klein] added declared function FreeImage_TmoFattal02(): adds support for Gradient domain high dynamic range compression (R. Fattal, 2002) - -! now FreeImage version 3.10.0 - -February 24, 2007 - 2.0.1 -* [Carsten Klein] fixed a bug in function FreeImage_CreateFromScreen(): now size of image created is according to window to be captured if parameter 'hwnd' <> 0. -+ [Carsten Klein] added parameter 'bClientAreaOnly' to function FreeImage_CreateFromScreen(). -+ [Carsten Klein] added blitting option 'CAPTUREBLT' when calling function BitBlt() in function FreeImage_CreateFromScreen(). -- [Carsten Klein] removed unused variable 'hDIB' from functions FreeImage_CreateFromScreen() and FreeImage_LoadEx(). Thanks to Bruce Rusk for pointing that out. - -February 16, 2007 - 2.0 -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 3 to match current version 3.9.3 -! [Carsten Klein] changed JPEG load/save flag option values: changed constants and both enumerations FREE_IMAGE_LOAD_OPTIONS and FREE_IMAGE_SAVE_OPTIONS. -+ [Carsten Klein] added ICC Color Profile support: -! changed signature of declared function FreeImage_GetICCProfile(): is now declared 'Private' and suffixed with '...Int()'. -+ added wrapper function FreeImage_GetICCProfile(): is the public wrapper function for private function FreeImage_GetICCProfileInt(), returing a real FIICCPROFILE structure. -+ added constant FREE_IMAGE_ICC_COLOR_MODEL_MASK. -+ added enumeration FREE_IMAGE_ICC_COLOR_MODEL. -+ added wrapper function FreeImage_GetICCProfileColorModel(): returns the color profile's color model (FIICCPROFILE.flags member). -+ added wrapper function FreeImage_GetICCProfileSize(): returns the color profile data's size in bytes. -+ added wrapper function FreeImage_GetICCProfileDataPointer(): returns the pointer to the color profile data. -+ added wrapper function FreeImage_HasICCProfile(): returns whether a color profile is available for a dib or not. -! [Carsten Klein] changed behaviour of wrapper function FreeImage_RescaleEx() and all it's derived functions: no clone is returned if the actual and desired image size are the same. -+ [Carsten Klein] added parameter 'bForceCloneCreation' to wrapper function FreeImage_RescaleEx() and all it's derived functions. - -! now FreeImage version 3.9.3 - -January 09, 2007 - 1.9.4 -! [Carsten Klein] changed scope of declared function FreeImage_GetFileTypeUInt(): is now private according to all other '...Int' functions wrapped by a VB-friendly function. -! [Carsten Klein] changed scope of declared function FreeImage_GetFIFFromFilenameUInt(): is now private according to all other '...Int' functions wrapped by a VB-friendly function. -! [Carsten Klein] changed signature of declared functions FreeImage_GetBackgroundColorInt() and FreeImage_SetBackgroundColorInt(): now both have a 'ByRef bkcolor As RGBQUAD' parameter instead of 'ByVal bkcolor As Long'. -+ [Carsten Klein] added declared functions FreeImage_GetBackgroundColorAsLongInt(): this has a 'ByRef bkcolor As Long' parameter and provides the background color as a Long value. -+ [Carsten Klein] added declared functions FreeImage_SetBackgroundColorAsLongInt(): this has a 'ByRef bkcolor As Long' parameter and takes the background color as a Long value. -! [Carsten Klein] changed signature of wrapper functions FreeImage_GetBackgroundColor() and FreeImage_SetBackgroundColor(): now both have a 'ByRef bkcolor As RGBQUAD' parameter instead of 'ByVal bkcolor As Long'. -+ [Carsten Klein] added wrapper functions FreeImage_GetBackgroundColorAsLong() and FreeImage_SetBackgroundColorAsLong(): both have a 'ByRef bkcolor As Long' parameter and so offer getting and setting the background color through a Long value. -+ [Carsten Klein] added wrapper functions FreeImage_GetBackgroundColorEx() and FreeImage_SetBackgroundColorEx(): both both take 4 ByRef Byte parameters 'Alpha', 'Red', 'Green' and 'Blue', one for each color component. - -January 05, 2007 - 1.9.3 -+ [Carsten Klein] added wrapper function FreeImage_GetLockedPageNumbersEx(): this returns a real VB-style array of Longs containing the page numbers of all locked pages. - -January 02, 2007 - 1.9.2 -* [Carsten Klein] fixed a bug in inline description of function FreeImage_GetPaletteEx(): now tells to use function FreeImage_DestroyLockedArrayRGBQUAD() to free an array returned by this function. -* [Carsten Klein] fixed some minor bugs in inline documentation. -* [Carsten Klein] fixed a serious bug in function FreeImage_SaveEx(): parameter 'bUnloadSource' is now interpreted correctly under all circumstances. -* [Carsten Klein] fixed some minor issues in function FreeImage_SaveEx(). - -December 29, 2006 - 1.9.1 -+ [Carsten Klein] added enumeration item FID_BAYER16x16: now supports Bayer ordered dispersed dot dithering (order 4 dithering matrix). - -October 31, 2006 - 1.9 -* [Carsten Klein] adjusted page numbers of the API documentation in header comments in FreeImage function declarations to match FreeImage 3.9.2 API documentation -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 2 to match current version 3.9.2 -+ [Carsten Klein] added function declaration for FreeImage_JPEGCrop(): added both declaration and Boolean returning wrapper function. -! [Carsten Klein] changed data type of all occurences of parameter 'Flags' from Long to either FREE_IMAGE_LOAD_OPTIONS or FREE_IMAGE_SAVE_OPTIONS enum. This is true for declared funcitons as well as for wrapper functions. -+ [Carsten Klein] added function declaration for FreeImage_LoadMultiBitmapFromMemory(). -+ [Carsten Klein] added wrapper function FreeImage_LoadMultiBitmapFromMemoryEx(): this is dealing with a VB style array (SAFEARRAY) like FreeImage_LoadFromMemoryEx() does. - -! now FreeImage version 3.9.2 - -October 30, 2006 - 1.8 -* [Carsten Klein] fixed a memory leak in wrapper function SavePictureEx(). Thanks to Roogames for reporting that bug. -! [Carsten Klein] changed return type of wrapper function SavePictureEx() to Boolean. -+ [Carsten Klein] added wrapper function FreeImage_SaveEx() which brings all the features, as there are inline size- and color conversion and format guessing, so far only known from SavePictureEx() for DIBs. -! [Carsten Klein] changed wrapper function SavePictureEx(): now this is only a thin wrapper for function FreeImage_SaveEx(). -+ [Carsten Klein] added enumeration FREE_IMAGE_LOAD_OPTIONS. -- [Carsten Klein] refactored enumeration FREE_IMAGE_SAVE_OPTIONS: removed unnecessary items from enumeration. -! [Carsten Klein] changed wrapper function LoadPictureEx(): added parameter 'Options' (enum FREE_IMAGE_LOAD_OPTIONS) to specify image loading options (called 'flags' in FreeImage). -+ [Carsten Klein] added wrapper function FreeImage_LoadEx() which brings all the features, as there are inline size- and color conversion and format guessing, so far only known from LoadPictureEx() for DIBs. -! [Carsten Klein] changed wrapper function LoadPictureEx(): now this is only a thin wrapper for function FreeImage_LoadEx(). - -October 13, 2006 - 1.7.2 -+ [Carsten Klein] added User32 function GetDesktopWindow() -+ added User32 function GetWindowDC() -- [Carsten Klein] removed unused constants DI_MASK, DI_IMAGE and DI_NORMAL -+ added GDI32 function GetDeviceCaps() with constants HORZRES and VERTRES -+ added GDI32 function SelectObject() -+ added GDI32 function DeleteObject() -+ added GDI32 function CreateCompatibleBitmap() -+ added GDI32 function CreateCompatibleDC() -+ added GDI32 function BitBlt() -+ [Carsten Klein] added wrapper function FreeImage_CreateFromScreen(): this function lets you capture the whole screen or any certain window - -October 10, 2006 - 1.7.1 -! [Carsten Klein] changed parameter name 'Page' into 'hPageDib' in declared function FreeImage_UnlockPage(). 'hPageDib' must be the (dib-)handle obtained from FreeImage_LockPage() and not the page number. Now, the declaration is less confusing. Thanks to Ender Wiggin. - -August 4, 2006 - 1.7 -* [Carsten Klein] fixed a bug in pGetTagFromTagPtr(): removed overflow error when converting unsigned short tags (FIDT_SHORT) with values between 32768 and 65535. Thanks to Andr Hendriks. -! [Carsten Klein] changed constant FREEIMAGE_RELEASE_SERIAL: set to 1 to match current version 3.9.1 - -! now FreeImage version 3.9.1 - -July 17, 2006 - 1.6 -+ [Carsten Klein] added more public wrapper functions for tag copying and cloning: -+ added function FreeImage_CopyMetadata() -+ added function FreeImage_CloneMetadata() -- [Carsten Klein] removed dead API functions, dead structures and dead variables -* [Carsten Klein] fixed a bug in FreeImage_ConvertColorDepth(): now color images are converted to 24 bits when used with FICF_PREPARE_RESCALE, all others to 8 bit - -July 16, 2006 - 1.5.6 -+ [Carsten Klein] added more public wrapper functions for VB friendly tag access: these functions deal with a FREE_IMAGE_TAG structure instead of FreeImage's Tag pointer. -+ added function FreeImage_SetMetadataEx() -+ added function FreeImage_CreateTagEx() -+ added function FreeImage_AppendTag() -+ added function FreeImage_RemoveTag() -+ added function FreeImage_RemoveTagEx() -+ added function FreeImage_TagExists() -+ added function FreeImage_TagExistsEx() -+ added function FreeImage_DeleteTagEx() -+ added function FreeImage_CloneTagEx() -+ added function FreeImage_RemoveMetadataModel() -+ added function FreeImage_UpdateMetadata() -+ added function FreeImage_UnsignedLong() -+ added function FreeImage_UnsignedShort() -+ added function FreeImage_CreateRational() -+ added function FreeImage_CreateSignedRational() -+ added function FreeImage_GetImageComment() -+ added function FreeImage_SetImageComment() -+ [Carsten Klein] added some private helper functions to leverage tag updating: -+ added helper function pTagToTagPtr() -+ added helper function pGetValueBuffer() -+ added helper function pGetRationalValueBuffer() -+ added helper function pGetVariantAsByteBuffer() -+ added helper function pGetElementSize() - -July 5, 2006 - 1.5.5 -! [Carsten Klein] changed function signature of FreeImage_FindNextMetadataEx(): optional parameter 'Model' is now present; see the function's inline documentation - -June 30, 2006 - 1.5.4 -* [Carsten Klein] fixed bug in functions creating a FreeImage DIB from a windows hBitmap: workaround for palettized bitmaps is now implemented -* fixed function FreeImage_CreateFromOLEPicture() -* fixed function FreeImage_CreateFromDC() - -June 22, 2006 - 1.5.3 -! [Carsten Klein] changed function declaration of FreeImage_GetMetadataInt(): parameter 'model' is now 'ByVal' and Tag is a Long pointer -! [Carsten Klein] changed function declaration of FreeImage_SetMetadataInt(): parameter 'model' is now 'ByVal' and Tag is a Long pointer -! [Carsten Klein] changed function declaration of FreeImage_GetMetadata(): parameter Tag is a Long pointer now -! [Carsten Klein] changed function declaration of FreeImage_SetMetadata(): parameter Tag is a Long pointer now -+ [Carsten Klein] added function declarations for tag creation and destruction: -+ added declaration for function FreeImage_CreateTag() -+ added declaration for procedure FreeImage_DeleteTag() -+ added declaration for function FreeImage_CloneTag() -+ [Carsten Klein] added new items to structure FREE_IMAGE_TAG: -+ added item 'Model As FREE_IMAGE_MDMODEL' -+ added item 'TagPtr As Long' -+ [Carsten Klein] added wrapper functions for more VB friendly Tag access: these functions deal with a FREE_IMAGE_TAG structure instead of FreeImage's Tag pointer. -+ added function FreeImage_FindFirstMetadataEx() -+ added function FreeImage_FindNextMetadataEx() -+ added function FreeImage_GetAllMetadataTags() -+ added function FreeImage_GetMetadataEx() -* [Carsten Klein] fixed and adjusted page numbers of the API documentation in header comments in FreeImage function declarations -- [Carsten Klein] removed workaround for thresholding and dithering non-MINISBLACK 8 bit images in function FreeImage_ConvertColorDepth(): was fixed in FreeImage 3.9.0 -* [Carsten Klein] fixed all pending issues in function FreeImage_PaintDC(): is now in production state - -June 14, 2006 - 1.5.2 -! [Carsten Klein] changed signature of function FreeImage_CreateMask() -+ [Carsten Klein] added function FreeImage_CreateMaskImage(): this creates a monochrome mask from a source image -+ [Carsten Klein] added function FreeImage_CreateMaskInPlace(): this creates a monochrome mask from a source image -+ [Carsten Klein] added enumeration FREE_IMAGE_ICON_TRANSPARENCY_OPTION_FLAGS -+ [Carsten Klein] added wrapper function FreeImage_CreateSimpleBWMaskImage(): wrapper for FreeImage_CreateMaskImage() with reduced number of parameters; creates a b/w mask -+ [Carsten Klein] added wrapper function FreeImage_CreateSimpleBWMaskInPlace(): wrapper for FreeImage_CreateMaskInPlace() with reduced number of parameters; creates a b/w mask -+ [Carsten Klein] added function declaration for FreeImage_MakeThumbnail() -+ [Carsten Klein] added function for FreeImage_GetOlePictureThumbnail() -+ [Carsten Klein] added function for FreeImage_MakeThumbnailIOP() -+ [Carsten Klein] documented function FreeImage_ReadMemoryEx() -+ [Carsten Klein] documented function FreeImage_WriteMemoryEx() -! [Carsten Klein] divided FreeImage_TagFromPointer into an interface only function with a private helper function pGetTagFromTagPtr(): -+ added helper function pGetTagFromTagPtr() -! [Carsten Klein] added private helper functions to leverage the FIDT_RATIONAL and FIDT_SRATIONAL data type: -+ added helper function pNormalizeRational() -+ added helper function pNormalizeSRational() -+ added helper function gcd() -+ added helper function floor() -! [Carsten Klein] changed name of structure 'FITAG_int' to 'FITAG': is now as in FreeImage library -! [Carsten Klein] changed name of structure 'FITAG' to 'FREE_IMAGE_TAG': this new structure plays an important role in the wrapper's new VB friendly tag accessing concept -! [Carsten Klein] changed function declaration of FreeImage_GetMetadataCount(): parameter 'model' is now 'ByVal' -! [Carsten Klein] changed function declaration of FreeImage_TagToString(): parameter 'model' is now 'ByVal' and function returns a Long -! [Carsten Klein] renamed function declaration of FreeImage_TagToString() to FreeImage_TagToStringInt(): function is now Private and wrapped by a VB String returning function -+ [Carsten Klein] added wrapper function FreeImage_TagToString() returning a real VB String -+ [Carsten Klein] added structure FIRATIONAL: structure to hold an image tag's rational value -+ [Carsten Klein] added new items to structure FREE_IMAGE_TAG: -+ added item 'StringValue As String' -+ added item 'Palette() As RGBQUAD' -+ added item 'RationalValue() As FIRATIONAL' - -June 13, 2006 - 1.5.1 -! [Carsten Klein] changed version constant 'FREEIMAGE_MINOR_VERSION' to 9 to meet version 3.9.0 -* [Carsten Klein] fixed and adjusted page numbers of the API documentation in header comments in FreeImage function declarations to match FreeImage 3.9.0 API documentation -+ [Carsten Klein] added function declaration for new Memory I/O functions in 3.9.0 -+ added declaration FreeImage_ReadMemory() -+ added declaration FreeImage_WriteMemory() -! [Carsten Klein] changed/added optional parameter 'element_size' to private function pGetMemoryBlockPtrFromVariant(): caller now can get size in bytes one array element -+ [Carsten Klein] added wrapper functions for new Memory I/O functions in 3.9.0 -+ added function FreeImage_ReadMemoryEx() -+ added function FreeImage_WriteMemoryEx() -+ [Carsten Klein] added constants and updated enumerations for new 3.9.0 file formats 'FAXG3' and 'SGI' -+ [Carsten Klein] added Windows GDI icon related declarations: -+ added function declaration for CreateIconIndirect() -+ added function declaration for DestroyIcon() -+ added structure ICONINFO -+ [Carsten Klein] added function FreeImage_GetIcon(): returns a hIcon handle -+ [Carsten Klein] added function FreeImage_GetOlePictureIcon(): returns a VB Picture object of type vbPicTypeIcon -+ [Carsten Klein] added enumeration FREE_IMAGE_MASK_FLAGS -+ [Carsten Klein] added function FreeImage_CreateMaskColors(): returns an array filled with items from an argument list; synonym for VB's Array() function -+ [Carsten Klein] added enumeration FREE_IMAGE_teMask(): this creates a monochrome mask from a source image -+ [Carsten Klein] added function FreeImage_CreaMASK_CREATION_OPTION_FLAGS - -! now FreeImage version 3.9.0 - -June 12, 2006 - 1.5 -* [Carsten Klein] fixed bug in wrapper function FreeImage_PaintDCEx(): now handles boolean test correctly: 'If ((hDC <> 0) And (hDIB <> 0)) Then -> Thanks to ender_wiggin for reporting that bug. -+ [Carsten Klein] added private function pGetIOlePictureFromContainer(): used to get IPicture from image hosting control (Form, PictureBox) including custom drawings -+ [Carsten Klein] added wrapper function FreeImage_CreateFromImageContainer(): used to create FreeImage DIB from image hosting control (Form, PictureBox) including custom drawings -+ [Carsten Klein] added wrapper function SaveImageContainerEx(): derivate of wrapper function 'SavePictureEx()': saves content of image hosting control (Form, PictureBox) including custom drawings - -February 27, 2006 - 1.4.8 -+ [Carsten Klein] added inline documentation for these wrapper functions: -+ documented function FreeImage_CompareColorsLongLong() -+ documented function FreeImage_CompareColorsRGBTRIPLELong() -+ documented function FreeImage_CompareColorsRGBQUADLong() -+ documented function FreeImage_SearchPalette() -! [Carsten Klein] changed and updated general remarks in section "General notes on implementation and design" -! [Carsten Klein] changed all function declarations of FreeImage functions that return a BOOL in C/C++: see "Functions returning Booleans" in section "General notes on implementation and design" -! [Carsten Klein] changed all function signatures of functions that are derived from or extend FreeImage BOOL functions: see "Functions returning Booleans" in section "General notes on implementation and design" -+ [Carsten Klein] added wrapper functions for all FreeImage functions that return a BOOL in C/C++: see "Functions returning Booleans" in section "General notes on implementation and design" -+ [Carsten Klein] added wrapper function FreeImage_CreateFromDC(): creates an DIB from a DC. Thanks to Evan (wxforecaster) for this suggestion. -+ [Carsten Klein] added declaration of GDI function GetCurrentObject() and constant OBJ_BITMAP -+ [Carsten Klein] added wrapper function FreeImage_IsAvailable(): used to test for existence of FreeImage Library (FreeImage.dll) - -February 9, 2006 - 1.4.7 -+ [Carsten Klein] added private helper function pGetPreviousColorDepth() -+ [Carsten Klein] added private helper function pGetNextColorDepth() -! [Carsten Klein] changed/extended signature of wrapper function SavePictureEx(): now includes a parameter 'ColorDepth' -+ [Carsten Klein] added enumeration FREE_IMAGE_COLOR_DEPTH -+ [Carsten Klein] added error handling capabilities to wrapper function SavePictureEx() -+ [Carsten Klein] added/updated inline documentation of wrapper function SavePictureEx() - -October 31, 2005 - 1.4.6 -+ [Carsten Klein] added wrapper function FreeImage_SwapColorLong(): this converts from a RGB to a BGR color value stored in a Long and vice versa - -October 27, 2005 - 1.4.5 -+ [Carsten Klein] added function FreeImage_IsTransparencyTableTransparent(): checks for transparency directly on the transparency table - -October 13, 2005 - 1.4.4 -+ [Carsten Klein] added some functions to compare colors in different formats and with tolerance: -+ added function FreeImage_CompareColorsLongLong() -+ added function FreeImage_CompareColorsRGBTRIPLELong() -+ added function FreeImage_CompareColorsRGBQUADLong() -+ [Carsten Klein] added enumeration FREE_IMAGE_COLOR_FORMAT_FLAGS -+ [Carsten Klein] added enumeration FREE_IMAGE_TRANSPARENCY_STATE_FLAGS -+ [Carsten Klein] added function FreeImage_SearchPalette(): to search the palette index for a given color - -October 13, 2005 - 1.4.3 -+ [Carsten Klein] added additional function declaration FreeImage_SetPixelColorByLong(): now color values may be provided in a long value -+ [Carsten Klein] added additional function declaration FreeImage_GetPixelColorByLong(): now color values may be received in a long value -+ [Carsten Klein] added function FreeImage_SetPixelColorEx(): color values may be provided by four different byte values -+ [Carsten Klein] added function FreeImage_GetPixelColorEx(): color values are returned through four different byte values - -October 11, 2005 - 1.4.2 -* [Carsten Klein] fixed bug in wrapper function FreeImage_GetBitsExRGBQUAD(): now tests for and works with 32 bit images - -October 10, 2005 - 1.4.1 -* [Carsten Klein] fixed serious bug in FreeImage_GetBitsEx...() functions: created custom array descriptor now really has two dimensions -* fixed wrapper function FreeImage_GetBitsEx() -* fixed wrapper function FreeImage_GetBitsExRGBTRIPLE() -* fixed wrapper function FreeImage_GetBitsExRGBQUAD() - -September 9, 2005 - 1.4 -! [Carsten Klein] changed wrapper function FreeImage_ConvertColorDepth(): now uses FreeImage_ConvertToGreyscale -+ [Carsten Klein] added version numbers to change log -+ [Carsten Klein] added comments to IOlePicture aware toolkit and conversion functions -* [Carsten Klein] fixed and adjusted page numbers of the API documentation in header comments in FreeImage function declarations - -! now FreeImage version 3.8.0 - -September 8, 2005 - 1.3.5 -! [Carsten Klein] changed version constant 'FREEIMAGE_MINOR_VERSION' to 8 to meet version 3.8.0 -+ [Carsten Klein] added function declarations for UNICODE dealing functions with additional token 'Int' appended: -+ added function FreeImage_LoadUInt() -+ added function FreeImage_SaveUInt() -+ added function FreeImage_GetFileTypeUInt() -+ added function FreeImage_GetFIFFromFilenameUInt() -+ [Carsten Klein] added wrapper functions to ease the use of UNICODE dealing functions: -+ added function FreeImage_LoadU() -+ added function FreeImage_SaveU() -+ added function FreeImage_GetFileTypeU() -+ added function FreeImage_GetFIFFromFilenameU() -+ [Carsten Klein] added function declaration for FreeImage_ConvertToGreyscale() - -July 18, 2005 - 1.3.4 -! [Carsten Klein] changed inline comments in these wrapper functions: -! changed FreeImage_GetBitsEx(): mixed up width and height in SAFEAARAY creation -! changed FreeImage_GetBitsExRGBTRIPLE(): mixed up width and height in SAFEAARAY creation -! changed FreeImage_GetBitsExRGBQUAD(): mixed up width and height in SAFEAARAY creation -+ [Carsten Klein] added wrapper function FreeImage_GetScanLinesRGBTRIPLE(): - -June 30, 2005 - 1.3.3 -+ [Carsten Klein] added Kernel32 function FillMemory() - -June 24, 2005 - 1.3.2 -+ [Carsten Klein] added pixel access functions FreeImage_GetBitsExRGBTRIPLE() and FreeImage_GetBitsExRGBQUAD() -+ [Carsten Klein] added IOlePicture based wrapper function FreeImage_ConvertColorDepthIOP() -+ [Carsten Klein] added IOlePicture based wrapper functions for FreeImage_RescaleIOP(): -+ added function FreeImage_FreeImage_RescaleByPixelIOP() -+ added function FreeImage_FreeImage_RescaleByPercentIOP() -+ added function FreeImage_FreeImage_RescaleByFactorIOP() -+ [Carsten Klein] added IOlePicture based wrapper function FreeImage_RescaleIOP() -* [Carsten Klein] fixed a bug in FreeImage_GetOlePicture(): now OlePictures returned through IPicture may be used directly by other functions accepting IPicture types without any assignment to IPictureDisp - -June 24, 2005 - 1.3.1 -! [Carsten Klein] changed inproper function declaration of function FreeImage_AdjustCurve(): now parameter 'LUT' is passed ByVal -+ [Carsten Klein] added wrapper function FreeImage_AdjustCurveEx() -+ [Carsten Klein] added IOlePicture based wrapper functions for FreeImage toolkit functions: -+ added function FreeImage_RotateClassicIOP() -+ added function FreeImage_RotateExIOP() -+ added function FreeImage_FlipHorizontalIOP() -+ added function FreeImage_FlipVerticalIOP() -+ added function FreeImage_AdjustCurveIOP() -+ added function FreeImage_AdjustGammaIOP() -+ added function FreeImage_AdjustBrightnessIOP() -+ added function FreeImage_AdjustContrastIOP() -+ added function FreeImage_InvertIOP() -+ added function FreeImage_GetChannelIOP() -+ added function FreeImage_CopyIOP() -+ added function FreeImage_PasteIOP() - -June 22, 2005 - 1.3 -+ [Carsten Klein] added inline comments and documentation for pixel access functions - -June 18, 2005 - 1.2.9 -+ [Carsten Klein] added function FreeImage_GetBitsEx() -+ [Carsten Klein] added structure SAFEARRAY2D to create 2 dimensional custom arrays -+ [Carsten Klein] added function declarations for converting scanlines to 4 bpp: -+ added declaration for FreeImage_ConvertLine1To4() -+ added declaration for FreeImage_ConvertLine8To4() -+ added declaration for FreeImage_ConvertLine16To4_555() -+ added declaration for FreeImage_ConvertLine16To4_565() -+ added declaration for FreeImage_ConvertLine24To4() -+ added declaration for FreeImage_ConvertLine32To4() - -June 16, 2005 - 1.2.8 -! [Carsten Klein] changed inproper function declaration for all functions FreeImage_ConvertLineXXXX(): now parameters 'target' and 'Source' are passed ByVal - -June 15, 2005 - 1.2.7 -+ [Carsten Klein] added function FreeImage_DestroyLockedArrayByPtr() to destroy a locked array by it's pointer (VB can't pass a array of structures through a Variant type) -+ [Carsten Klein] added some wrapper functions for FreeImage_DestroyLockedArrayByPtr() for common FreeImage structures: -+ added function FreeImage_DestroyLockedArrayRGBTRIPLE() -+ added function FreeImage_DestroyLockedArrayRGBQUAD() -+ added function FreeImage_DestroyLockedArrayFICOMPLEX() -+ added function FreeImage_DestroyLockedArrayFIRGB16() -+ added function FreeImage_DestroyLockedArrayFIRGBA16() -+ added function FreeImage_DestroyLockedArrayFIRGBF() -+ added function FreeImage_DestroyLockedArrayFIRGBAF() -+ [Carsten Klein] added functions to return scanlines as VB style arrays in all supported FreeImage formats: -+ added function FreeImage_GetScanLineBITMAP8() -+ added function FreeImage_GetScanLineBITMAP16() -+ added function FreeImage_GetScanLineBITMAP24() -+ added function FreeImage_GetScanLineBITMAP32() -+ added function FreeImage_GetScanLineINT16() -+ added function FreeImage_GetScanLineINT32() -+ added function FreeImage_GetScanLineFLOAT() -+ added function FreeImage_GetScanLineDOUBLE() -+ added function FreeImage_GetScanLineCOMPLEX() -+ added function FreeImage_GetScanLineRGB16() -+ added function FreeImage_GetScanLineRGBA16() -+ added function FreeImage_GetScanLineRGBF() -+ added function FreeImage_GetScanLineRGBAF() - -June 14, 2005 - 1.2.6 -! [Carsten Klein] updated documentation on array-dealing functions using arrays with custom array descriptors -+ [Carsten Klein] added function FreeImage_DestroyLockedArray() to destroy a self created array 'FADF_AUTO Or FADF_FIXEDSIZE' array -+ [Carsten Klein] added function FreeImage_GetPaletteExLong() to return palette data in an array of type Long -+ [Carsten Klein] added parameters 'lPaletteSize', 'vntReservePalette' and 'lReserveSize' to FreeImage_ConvertColorDepth() - -June 13, 2005 - 1.2.5 -* [Carsten Klein] fixed a bug in helper function pGetMemoryBlockPtrFromVariant(): now 'size_in_bytes' will never exceed the size of an array provided - -June 12, 2005 - 1.2.4 -+ [Carsten Klein] added ZLib compression function wrappers dealing with VB style arrays: -+ added function FreeImage_ZLibCompressVB() -+ added function FreeImage_ZLibUncompressVB() -+ added function FreeImage_ZLibGZipVB() -+ added function FreeImage_ZLibGUnzipVB() - -June 10, 2005 - 1.2.3 -+ [Carsten Klein] added ZLib compression function wrappers dealing with VB style arrays: -+ added function FreeImage_ZLibCompressEx() -+ added function FreeImage_ZLibUncompressEx() -+ added function FreeImage_ZLibGZipEx() -+ added function FreeImage_ZLibCRC32Ex() -+ added function FreeImage_ZLibGUnzipEx() -+ [Carsten Klein] added more VB friendly ZLib compression function wrappers: -+ added function FreeImage_ZLibCompressVB() -+ added function FreeImage_ZLibUncompressVB() -+ added function FreeImage_ZLibGZipVB() -+ added function FreeImage_ZLibGUnzipVB() -! [Carsten Klein] fixed wrong function declaration of functions FreeImage_ZLibGUnzip(): alias was '_FreeImage_ZLibZlibGUnzip@16' (double ZLib) -! [Carsten Klein] fixed function pGetArrayPtrFromVariantArray() that now can deal with uninitialized arrays -! fixed function pGetMemoryBlockPtrFromVariant() that now can deal with uninitialized arrays -! [Carsten Klein] fixed wrong function declaration of functions FreeImage_AdjustBrightness(): ...@8 -> ...@12 -! fixed wrong function declaration of functions FreeImage_AdjustContrast(): ...@8 -> ...@12 -! fixed wrong function declaration of functions FreeImage_AdjustGamma(): ...@8 -> ...@12 -! fixed wrong function declaration of functions FreeImage_RotateClassic(): ...@8 -> ...@12 -! fixed wrong function declaration of functions FreeImage_RotateEx(): ...@28 -> ...@48 - -June 9, 2005 - 1.2.2 -! [Carsten Klein] fixed wrong function declaration of function FreeImage_OpenMultiBitmap(): added parameter 'flags' (...@20 -> ...@24) - -June 8, 2005 - 1.2.1 -! [Carsten Klein] refactored function FreeImage_LoadFromMemoryEx(): now using pGetMemoryBlockPtrFromVariant() -+ [Carsten Klein] added private function pGetMemoryBlockPtrFromVariant() to get poiner and size of a memory block from a Variant parameter -! [Carsten Klein] changed declaration of ZLib related functions: 'target' and 'Source' are now 'ByVal Long' - -June 7, 2005 - 1.2 -+ [Carsten Klein] added some more inline comments and documentation -+ [Carsten Klein] added optional parameter 'bUnloadSource' to function FreeImage_SaveToMemoryEx() -+ added optional parameter 'bUnloadSource' to function FreeImage_SaveToMemoryEx2() -+ [Carsten Klein] added optional parameter 'InPercent' to function SavePictureEx() -! implemented the capability to resize the image on saving in function SavePictureEx() -+ [Carsten Klein] added parameters 'InPercent' and 'Format' to function LoadPictureEx() -* [Carsten Klein] fixed wrong function declaration of function FreeImage_JPEGTransform() (...@12 -> ...@16) - -June 6, 2005 - 1.1.2 -+ [Carsten Klein] added some more inline comments and documentation - -May 30, 2005 - 1.1.1 -* [Carsten Klein] fixed percent calculating bug in function FreeImage_RescaleEx() -! changed behaviour of parameter 'bIsPercentValue' -> it now has no effect on integer values -+ added function FreeImage_RescaleByPixel() to avoid confusion with overloading -+ added function FreeImage_RescaleByPercent() to avoid confusion with overloading -+ added function FreeImage_RescaleByFactor() to avoid confusion with overloading -! [Carsten Klein] changed name of parameter 'bUnloadDIB' to 'bUnloadSource' of function FreeImage_GetOlePicture() -+ [Carsten Klein] added some more inline comments and documentation -* [Carsten Klein] fixed a potential runtime error in function FreeImage_SetTransparencyTableEx(): 'Count' will no longer exceed 256 - -May 24, 2005 - 1.1 -+ [Carsten Klein] added a new VB wrapper diff --git a/DSTexCompress/FreeImage/Wrapper/VB6/test/SimpleTest.frm b/DSTexCompress/FreeImage/Wrapper/VB6/test/SimpleTest.frm deleted file mode 100644 index 4649dce..0000000 --- a/DSTexCompress/FreeImage/Wrapper/VB6/test/SimpleTest.frm +++ /dev/null @@ -1,45 +0,0 @@ -VERSION 5.00 -Begin VB.Form SimpleTest - Caption = "SimpleTest" - ClientHeight = 1035 - ClientLeft = 60 - ClientTop = 345 - ClientWidth = 2325 - LinkTopic = "Form1" - ScaleHeight = 1035 - ScaleWidth = 2325 - StartUpPosition = 3 'Windows Default - Begin VB.CommandButton btnTest - Caption = "Test" - Height = 495 - Left = 240 - TabIndex = 0 - Top = 240 - Width = 1575 - End -End -Attribute VB_Name = "SimpleTest" -Attribute VB_GlobalNameSpace = False -Attribute VB_Creatable = False -Attribute VB_PredeclaredId = True -Attribute VB_Exposed = False -Option Explicit -' NOTE : -' To run this test program, you will have to copy the FreeImage.dll file -' in this directory. -' Change also the "test.tif" file name with a path to any tif file on your -' hard disk -' -Private Sub btnTest_Click() - Dim dib As Long - Dim bOK As Long - ' Load a tif image - dib = FreeImage_Load(FIF_TIFF, "test.tif", 0) - - ' Save this image as PNG - bOK = FreeImage_Save(FIF_PNG, dib, "test.png", 0) - - ' Unload the dib - FreeImage_Unload (dib) - -End Sub diff --git a/DSTexCompress/FreeImage/Wrapper/VB6/test/SimpleTest.vbp b/DSTexCompress/FreeImage/Wrapper/VB6/test/SimpleTest.vbp deleted file mode 100644 index b1da887..0000000 --- a/DSTexCompress/FreeImage/Wrapper/VB6/test/SimpleTest.vbp +++ /dev/null @@ -1,38 +0,0 @@ -Type=Exe -Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\WINNT\system32\stdole2.tlb#OLE Automation -Form=SimpleTest.frm -Module=FreeImage; ..\modFreeImage.bas -IconForm="SimpleTest" -Startup="SimpleTest" -HelpFile="" -Title="SimpleTest" -ExeName32="SimpleTest.exe" -Command32="" -Name="TestFreeImage" -HelpContextID="0" -CompatibleMode="0" -MajorVer=1 -MinorVer=0 -RevisionVer=0 -AutoIncrementVer=0 -ServerSupportFiles=0 -VersionCompanyName="HDN" -CompilationType=0 -OptimizationType=0 -FavorPentiumPro(tm)=0 -CodeViewDebugInfo=0 -NoAliasing=0 -BoundsCheck=0 -OverflowCheck=0 -FlPointCheck=0 -FDIVCheck=0 -UnroundedFP=0 -StartMode=0 -Unattended=0 -Retained=0 -ThreadPerObject=0 -MaxNumberOfThreads=1 -DebugStartupOption=0 - -[MS Transaction Server] -AutoRefresh=1 diff --git a/DSTexCompress/FreeImage/license-fi.txt b/DSTexCompress/FreeImage/license-fi.txt deleted file mode 100644 index 479fb4d..0000000 --- a/DSTexCompress/FreeImage/license-fi.txt +++ /dev/null @@ -1,142 +0,0 @@ -FreeImage Public License - Version 1.0 ---------------------------------------------- - -1. Definitions. - -1.1. "Contributor" means each entity that creates or contributes to the creation of Modifications. - -1.2. "Contributor Version" means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. - -1.3. "Covered Code" means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. - -1.4. "Electronic Distribution Mechanism" means a mechanism generally accepted in the software development community for the electronic transfer of data. - -1.5. "Executable" means Covered Code in any form other than Source Code. - -1.6. "Initial Developer" means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. - -1.7. "Larger Work" means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. - -1.8. "License" means this document. - -1.9. "Modifications" means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a -Modification is: - -A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. - -B. Any new file that contains any part of the Original Code or previous Modifications. - -1.10. "Original Code" means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. - -1.11. "Source Code" means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control -compilation and installation of an Executable, or a list of source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. - -1.12. "You" means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You" includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the -direction or management of such entity, whether by contract or otherwise, or (b) ownership of fifty percent (50%) or more of the outstanding shares or beneficial ownership of such entity. - -2. Source Code License. - -2.1. The Initial Developer Grant. -The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: - -(a) to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, or as part of a Larger Work; and - -(b) under patents now or hereafter owned or controlled by Initial Developer, to make, have made, use and sell ("Utilize") the Original Code (or portions thereof), but solely to the extent that -any such patent is reasonably necessary to enable You to Utilize the Original Code (or portions thereof) and not to any greater extent that may be necessary to Utilize further Modifications or -combinations. - -2.2. Contributor Grant. -Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: - -(a) to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code or as part of a Larger Work; and - -(b) under patents now or hereafter owned or controlled by Contributor, to Utilize the Contributor Version (or portions thereof), but solely to the extent that any such patent is reasonably necessary to enable You to Utilize the Contributor Version (or portions thereof), and not to any greater extent that -may be necessary to Utilize further Modifications or combinations. - -3. Distribution Obligations. - -3.1. Application of License. -The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or -restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. - -3.2. Availability of Source Code. -Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. - -3.3. Description of Modifications. -You must cause all Covered Code to which you contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. - -3.4. Intellectual Property Matters - -(a) Third Party Claims. -If You have knowledge that a party claims an intellectual property right in particular functionality or code (or its utilization under this License), you must include a text file with the source code distribution titled "LEGAL" which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If you obtain such knowledge after You make Your Modification available as described in Section 3.2, You shall promptly modify the LEGAL file in all copies You make -available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. - -(b) Contributor APIs. -If Your Modification is an application programming interface and You own or control patents which are reasonably necessary to implement that API, you must also include this information in the LEGAL file. - -3.5. Required Notices. -You must duplicate the notice in Exhibit A in each file of the Source Code, and this License in any documentation for the Source Code, where You describe recipients' rights relating to Covered Code. If You created one or more Modification(s), You may add your name as a Contributor to the notice described in Exhibit A. If it is not possible to put such notice in a particular Source Code file due to its -structure, then you must include such notice in a location (such as a relevant directory file) where a user would be likely to look for such a notice. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or -liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of -warranty, support, indemnity or liability terms You offer. - -3.6. Distribution of Executable Versions. -You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You -describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code under a license of Your choice, which may contain terms different from this License, -provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. - -3.7. Larger Works. -You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - -If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. - -5. Application of this License. - -This License applies to code to which the Initial Developer has attached the notice in Exhibit A, and to related Covered Code. - -6. Versions of the License. - -6.1. New Versions. -Floris van den Berg may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. - -6.2. Effect of New Versions. -Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Floris van den Berg -No one other than Floris van den Berg has the right to modify the terms applicable to Covered Code created under this License. - -6.3. Derivative Works. -If you create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), you must (a) rename Your license so that the phrases "FreeImage", `FreeImage Public License", "FIPL", or any confusingly similar phrase do not appear anywhere in your license and (b) otherwise make it clear that your version of the license contains terms which differ from the FreeImage Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.) - -7. DISCLAIMER OF WARRANTY. - -COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - -This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. - -9. LIMITATION OF LIABILITY. - -UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE -EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THAT EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - -The Covered Code is a "commercial item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer software" and "commercial computer software documentation," as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein. - -11. MISCELLANEOUS. - -This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by Dutch law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in, the The Netherlands: (a) unless otherwise agreed in writing, all disputes relating to this License (excepting any dispute relating to intellectual property rights) shall be subject to final and binding arbitration, with the losing party paying all costs of arbitration; (b) any arbitration relating to this Agreement shall be held in Almelo, The Netherlands; and (c) any litigation relating to this Agreement shall be subject to the jurisdiction of the court of Almelo, The Netherlands with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys fees and expenses. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. - -12. RESPONSIBILITY FOR CLAIMS. - -Except in cases where another Contributor has failed to comply with Section 3.4, You are responsible for damages arising, directly or indirectly, out of Your utilization of rights under this License, based -on the number of copies of Covered Code you made available, the revenues you received from utilizing such rights, and other relevant factors. You agree to work with affected parties to distribute -responsibility on an equitable basis. - -EXHIBIT A. - -"The contents of this file are subject to the FreeImage Public License Version 1.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://home.wxs.nl/~flvdberg/freeimage-license.txt - -Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. \ No newline at end of file diff --git a/DSTexCompress/FreeImage/license-gpl.txt b/DSTexCompress/FreeImage/license-gpl.txt deleted file mode 100644 index 1bcc46f..0000000 --- a/DSTexCompress/FreeImage/license-gpl.txt +++ /dev/null @@ -1,342 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. - - diff --git a/DSTexCompress/FreeImagePlus.dll b/DSTexCompress/FreeImagePlus.dll deleted file mode 100644 index c8efc59..0000000 Binary files a/DSTexCompress/FreeImagePlus.dll and /dev/null differ diff --git a/DSTexCompress/src/Color.h b/DSTexCompress/src/Color.h deleted file mode 100644 index 1afe9b6..0000000 --- a/DSTexCompress/src/Color.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef _COLOR_H_ -#define _COLOR_H_ - -#include "types.h" - -struct Color -{ - s32 r, g, b; - - Color() : r(0), g(0), b(0) {} - Color(u16 c) { DecodePC555(c); } - - // Squared distance - inline u32 Distance(const Color& c) const - { - int dr = c.r - r; - int dg = c.g - g; - int db = c.b - b; - - return dr * dr + dg * dg + db * db; - } - - inline u16 EncodeNDS() const - { - u32 _r = r; if ( _r > 31 ) _r = 31; - u32 _g = g; if ( _g > 31 ) _g = 31; - u32 _b = b; if ( _b > 31 ) _b = 31; - return _r | (_g << 5) | (_b << 10) | (1 << 15); - } - - inline u16 EncodePC555() const - { - u32 _r = r; if ( _r > 31 ) _r = 31; if ( _r < 0 ) _r = 0; - u32 _g = g; if ( _g > 31 ) _g = 31; if ( _g < 0 ) _g = 0; - u32 _b = b; if ( _b > 31 ) _b = 31; if ( _b < 0 ) _b = 0; - return (_r << 10) | (_g << 5) | _b; - } - - inline void DecodePC555(u16 c) - { - r = (c >> 10) & 0x1F; - g = (c >> 5) & 0x1F; - b = c & 0x1F; - } - - inline bool operator==(const Color& c) const - { - return c.r == r && c.g == g && c.b == b; - } - - inline Color operator+(const Color& b) - { - Color c = *this; - - c.r += b.r; - c.g += b.g; - c.b += b.b; - - return c; - } - - inline Color operator-(const Color& b) - { - Color c = *this; - - c.r -= b.r; - c.g -= b.g; - c.b -= b.b; - - return c; - } - - inline Color operator*(s32 mul) - { - Color c = *this; - - c.r *= mul; - c.g *= mul; - c.b *= mul; - - return c; - } - - inline Color operator/(s32 div) - { - Color c = *this; - - c.r /= div; - c.g /= div; - c.b /= div; - - return c; - } -}; - -inline int CompareRed(const Color* a, const Color* b) -{ - return a->r - b->r; -} - -inline int CompareGreen(const Color* a, const Color* b) -{ - return a->g - b->g; -} - -inline int CompareBlue(const Color* a, const Color* b) -{ - return a->b - b->b; -} - -inline void ColorCube(const Color& c, Color& min, Color& max) -{ - if ( c.r < min.r ) min.r = c.r; - if ( c.g < min.g ) min.g = c.g; - if ( c.b < min.b ) min.b = c.b; - if ( c.r > max.r ) max.r = c.r; - if ( c.g > max.g ) max.g = c.g; - if ( c.b > max.b ) max.b = c.b; -} - -#endif // _COLOR_H_ \ No newline at end of file diff --git a/DSTexCompress/src/Compressor.cpp b/DSTexCompress/src/Compressor.cpp deleted file mode 100644 index 401299c..0000000 --- a/DSTexCompress/src/Compressor.cpp +++ /dev/null @@ -1,333 +0,0 @@ -#include "Compressor.h" - -#include -#include "Histogram.h" -#include "Palette.h" -#include "Cut.h" - -static bool IsPowerOfTwo(u32 x) -{ - if ( x == 0 ) return false; - return (x & (x - 1)) == 0; -} - -bool Compressor::Open(const char* input) -{ - if ( ! image.load(input) ) - { - fprintf(stderr, "Can't load %s\n", input); - return false; - } - - u32 width = image.getWidth(); - u32 height = image.getHeight(); - - if ( width < 8 || height < 8 - || width > 1024 || height > 1024 - || !IsPowerOfTwo(width) || !IsPowerOfTwo(height) ) - { - fprintf(stderr, "Wrong texture size (%dx%d)\n", width, height); - return false; - } - - image.convertTo16Bits555(); - - return true; -} - -static void BuildReducedPalette(Histogram& histogram, Palette& pal) -{ - Histogram c[4]; - pal.length = WeirdCut(histogram, c, 4); - - for ( u32 i = 0 ; i < pal.length ; i++ ) - { - pal.colors[i] = c[i].Average(); - } - - pal.UpdateVariance(); -} - -static u32 DistancePixelsPalette(Color* pixels, Palette* pal) -{ - u32 dist = 0; - - for ( u32 i = 0 ; i < 16 ; i++ ) - { - u32 best = pixels->Distance(pal->colors[0]); - - for ( u32 i = 1 ; i < pal->length ; i++ ) - { - u32 d = pixels->Distance(pal->colors[i]); - if ( d < best ) - { - best = d; - } - } - - dist += best; - pixels++; - } - - return dist; -} - -static u32 FindBestPalette(Color* pixels, Palette* palettes, u32 nbPalettes) -{ - u32 id = 0; - u32 best = DistancePixelsPalette(pixels, palettes++); - - for ( u32 i = 1 ; i < nbPalettes ; i++ ) - { - u32 d = DistancePixelsPalette(pixels, palettes); - - if ( d < best ) - { - id = i; - best = d; - } - palettes++; - } - - return id; -} - -static inline u16 Perturb(u16 pix, Color error, s32 factor) -{ - Color c(pix); - c.r = (c.r * 16 + error.r * factor) / 16; - c.g = (c.g * 16 + error.g * factor) / 16; - c.b = (c.b * 16 + error.b * factor) / 16; - return c.EncodePC555(); -} - -void Compressor::Process(const char* output, u32 nbPals, bool extend, bool dither, const char* preview) -{ - u32 width = image.getWidth(); - u32 height = image.getHeight(); - u32 blockWidth = width / 4; - u32 blockHeight = height / 4; - u32 nbBlocks = blockWidth * blockHeight; - u16* pixels = (u16*) image.accessPixels(); - - // Final file is - // + header (width, height, 4-color palette count) - // + data (blocks, indices, palettes) - u32 dataLength = 3 + nbBlocks + nbBlocks / 2 + nbPals * 2; - u32* data = new u32[dataLength]; - data[0] = width; - data[1] = height; - data[2] = nbPals; - u32* pBlocks = data + 3; - u16* pIndices = (u16*)(pBlocks + nbBlocks); - u16* pPalettes = pIndices + nbBlocks; - - // Compute one 4-color palette for each block - printf("Palettizing...\n"); - PaletteGroup palettes; - Block* blocks = new Block[nbBlocks]; - for ( u32 y = 0 ; y < height ; y += 4 ) - { - for ( u32 x = 0 ; x < width ; x += 4 ) - { - u32 ofs = (x / 4) + (y / 4) * blockWidth; - - Block& block = blocks[ofs]; - for ( u32 i = 0 ; i < 4 ; i++ ) - { - for ( u32 j = 0 ; j < 4 ; j++ ) - { - block.pix[j + i * 4].DecodePC555(pixels[(x + j) + (y + i) * width]); - } - } - - Histogram histogram(block); - Palette p; - BuildReducedPalette(histogram, p); - palettes.Add(p); - } - } - - // Reduce palettes - printf("Reducing to %d palettes...\n", nbPals); - PaletteGroup* groups = new PaletteGroup[nbPals]; - u32 nbGroups = WeirdCut(palettes, groups, nbPals); - - u32 nbNewPalettes = nbPals * (extend ? 5 : 1); - Palette* newPalettes = new Palette[nbNewPalettes]; - Palette* pNewPalettes = newPalettes; - for ( u32 i = 0 ; i < nbGroups ; i++ ) - { - Histogram histogram(groups[i]); - BuildReducedPalette(histogram, *pNewPalettes); - - if ( extend ) - { - // Build 2-color extended palettes - // Keep first two colors, extend to 3 (mode 1) - Palette* p = pNewPalettes + nbPals + i; - p->length = 3; - p->colors[0] = pNewPalettes->colors[0]; - p->colors[1] = pNewPalettes->colors[1]; - p->colors[2] = (p->colors[0] + p->colors[1]) / 2; - // Keep last two colors, extend to 3 (mode 1) - p++; - p->length = 3; - p->colors[0] = pNewPalettes->colors[2]; - p->colors[1] = pNewPalettes->colors[3]; - p->colors[2] = (p->colors[0] + p->colors[1]) / 2; - // Keep last two colors, extend to 4 (mode 3) - p += nbPals * 2; - p->length = 4; - p->colors[0] = pNewPalettes->colors[2]; - p->colors[1] = pNewPalettes->colors[3]; - p->colors[2] = (p->colors[0] * 5 + p->colors[1] * 3) / 8; - p->colors[3] = (p->colors[0] * 3 + p->colors[1] * 5) / 8; - // Keep first two colors, extend to 4 (mode 3) - p--; - p->length = 4; - p->colors[0] = pNewPalettes->colors[0]; - p->colors[1] = pNewPalettes->colors[1]; - p->colors[2] = (p->colors[0] * 5 + p->colors[1] * 3) / 8; - p->colors[3] = (p->colors[0] * 3 + p->colors[1] * 5) / 8; - } - - // store to file - for ( u32 c = 0 ; c < 4 ; c++ ) - { - *pPalettes++ = newPalettes[i].colors[c].EncodeNDS(); - } - - pNewPalettes++; - } - - delete[] groups; - - u32* mapping = new u32[nbBlocks]; - - // Match palettes to blocks and save indices - printf("Matching palettes...\n"); - for ( u32 y = 0 ; y < blockHeight ; y++ ) - { - for ( u32 x = 0 ; x < blockWidth ; x++ ) - { - u32 ofs = x + y * blockWidth; - Block& block = blocks[ofs]; - - // (good thing we have fast cpus now, brute force rulez.) - u32 id = FindBestPalette(block.pix, newPalettes, nbNewPalettes); - - mapping[x + y * blockWidth] = id; - - // Encode index data to file - u32 mode; - u32 type = id / nbPals; - if ( type == 0 ) - { - mode = 2; - id *= 2; - } - else if ( type < 3 ) - { - mode = 1; - id -= nbPals; - } - else - { - mode = 3; - id -= nbPals * 3; - } - - *pIndices++ = id | (mode << 14); - } - } - - // Encode blocks - printf("Compressing...\n"); - memset(pBlocks, 0, nbBlocks * sizeof(u32)); - for ( u32 y = 0 ; y < height ; y++ ) - { - for ( u32 x = 0 ; x < width ; x++ ) - { - u32 blockOffset = x / 4 + (y / 4) * blockWidth; - u32 id = mapping[blockOffset]; - - // Encode block to file - Palette& pal = newPalettes[id]; - - u16* pix = &pixels[x + y * width]; - Color c(*pix); - - // find best matching color in palette - u32 best = 0; - u32 dist = c.Distance(pal.colors[0]); - for ( u32 k = 1 ; k < pal.length ; k++ ) - { - u32 d = c.Distance(pal.colors[k]); - if ( d < dist ) - { - dist = d; - best = k; - } - } - - // encode - pBlocks[blockOffset] |= best << (2 * ((x % 4) + (y % 4) * 4)); - -#if DITHERING - // floyd-steinberg dithering - // - // results are terrible with dithering enabled - // I guess the error diffusion makes the palette - // not match with the blocks anymore - if ( dither ) - { - Color error = c - pal.colors[best]; - if ( x < width - 1 ) - { - pix[1] = Perturb(pix[1], error, 7); - if ( y < height - 1 ) - { - pix[width + 1] = Perturb(pix[width + 1], error, 1); - } - } - if ( y < height - 1 ) - { - pix[width] = Perturb(pix[width], error, 5); - if ( x > 0 ) - { - pix[width - 1] = Perturb(pix[width - 1], error, 3); - } - } - } -#endif - - // for preview - *pix = pal.colors[best].EncodePC555(); - } - } - - // Store file - FILE* f = fopen(output, "wb"); - if ( f ) - { - fwrite(data, sizeof(data[0]), dataLength, f); - fclose(f); - } - else - { - fprintf(stderr, "Warning: Could not save to %s\n", output); - } - - // Store preview - if ( preview ) - { - image.convertTo24Bits(); - image.save(preview); - } - - delete[] mapping; - delete[] data; - delete[] newPalettes; - delete[] blocks; -} \ No newline at end of file diff --git a/DSTexCompress/src/Compressor.h b/DSTexCompress/src/Compressor.h deleted file mode 100644 index 5de7bbe..0000000 --- a/DSTexCompress/src/Compressor.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _COMPRESSOR_H_ -#define _COMPRESSOR_H_ - -#include -#include "types.h" - -class Compressor -{ - fipImage image; - -public: - bool Open(const char* input); - void Process(const char* output, u32 nbPalettes, bool extend, bool dither, const char* preview); -}; - -#endif // _COMPRESSOR_H_ \ No newline at end of file diff --git a/DSTexCompress/src/Cut.h b/DSTexCompress/src/Cut.h deleted file mode 100644 index f7a6427..0000000 --- a/DSTexCompress/src/Cut.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _CUT_H_ -#define _CUT_H_ - -template -T* FindMostImportantSplittable(T* list, u32 len) -{ - T* r = 0; - u32 importance = 0; - - for ( u32 i = len ; i > 0 ; i-- ) - { - if ( list->IsSplittable() ) - { - u32 imp = list->GetImportance(); - if ( imp > importance ) - { - importance = imp; - r = list; - } - } - - list++; - } - - return r; -} - -// Median cut inspired -// -// Instead of recursively splitting everything -// it splits the "most important"/"bigger" element -// until the required number of elements -// is met or there is nothing to split. -// -// Returns the number of elements. -template -u32 WeirdCut(const T& src, T* dst, u32 dstLength) -{ - if ( src.IsSplittable() && dstLength > 1 ) - { - T copy(src); - copy.Split(dst[0], dst[1]); - - T* toSplit = FindMostImportantSplittable(dst, 2); - - u32 len = 2; - while ( len < dstLength && toSplit ) - { - T splitMe(*toSplit); - - // reset element, gruik style - toSplit->~T(); - toSplit = new(toSplit) T; - - splitMe.Split(*toSplit, dst[len]); - len++; - toSplit = FindMostImportantSplittable(dst, len); - } - - return len; - } - else - { - dst[0] = src; - - return 1; - } -} - -#endif // _CUT_H_ \ No newline at end of file diff --git a/DSTexCompress/src/Histogram.cpp b/DSTexCompress/src/Histogram.cpp deleted file mode 100644 index 33220dd..0000000 --- a/DSTexCompress/src/Histogram.cpp +++ /dev/null @@ -1,182 +0,0 @@ -#include "Histogram.h" - -#include -#include "Palette.h" - -Histogram::Histogram(const Block& block) -: totalWeight(0), - longestEdge(0xDEADBEEF), - longestEdgeLength(0xC0CACAFE) -{ - entries.reserve(16); - - for ( u32 y = 0 ; y < 4 ; y++ ) - { - for ( u32 x = 0 ; x < 4 ; x++ ) - { - const Color& c = block.pix[x + y * 4]; - - totalWeight++; - - u32 i = 0; - while ( i < entries.size() ) - { - if ( entries[i].color == c ) - { - entries[i].weight++; - break; - } - - i++; - } - - if ( i == entries.size() ) - { - entry e = { c, 1 }; - entries.push_back(e); - } - } - } - - computeLongestEdge(); -} - -Histogram::Histogram(const PaletteGroup& pal) -: totalWeight(0), - longestEdge(0xDEADBEEF), - longestEdgeLength(0xC0CACAFE) -{ - entries.reserve(pal.Length()); - - for ( u32 i = 0 ; i < pal.Length() ; i++ ) - { - const Palette& p = pal.GetPalette(i); - - for ( u32 j = 0 ; j < 4 ; j++ ) - { - totalWeight++; - - const Color& c = p.colors[j]; - - u32 i = 0; - while ( i < entries.size() ) - { - if ( entries[i].color == c ) - { - entries[i].weight++; - break; - } - - i++; - } - - if ( i == entries.size() ) - { - entry e = { c, 1 }; - entries.push_back(e); - } - } - } - - computeLongestEdge(); -} - -void Histogram::computeLongestEdge() -{ - Color min, max; - min.r = min.g = min.b = 32; - - for ( u32 i = 0 ; i < entries.size() ; i++ ) - { - ColorCube(entries[i].color, min, max); - } - - Color len = max - min; - if ( len.r > len.g && len.r > len.b ) - { - longestEdge = 0; - longestEdgeLength = len.r; - } - else - { - if ( len.g > len.b ) - { - longestEdge = 1; - longestEdgeLength = len.g; - } - else - { - longestEdge = 2; - longestEdgeLength = len.b; - } - } -} - -Color Histogram::Average() const -{ - Color a; - - for ( u32 i = 0 ; i < entries.size() ; i++ ) - { - a.r += entries[i].color.r * entries[i].weight; - a.g += entries[i].color.g * entries[i].weight; - a.b += entries[i].color.b * entries[i].weight; - } - - a.r /= totalWeight; - a.g /= totalWeight; - a.b /= totalWeight; - - return a; -} - -void Histogram::Split(Histogram& left, Histogram& right) -{ - // Sort data along longest edge - static int (*cmp[])(const Color*, const Color*) = - { - CompareRed, - CompareGreen, - CompareBlue - }; - - qsort(&entries[0], entries.size(), sizeof(entries[0]), (int (*)(const void*, const void*))cmp[longestEdge]); - - // split data - left.totalWeight = totalWeight / 2; - right.totalWeight = totalWeight - left.totalWeight; - - u32 i = 0, w = 0; - const entry* e = &entries[0]; - while ( w < left.totalWeight ) - { - left.entries.push_back(*e++); - w += left.entries[i].weight; - i++; - } - - if ( w > left.totalWeight ) - { - right.entries.push_back(left.entries[left.entries.size() - 1]); - u32 rw = w - left.totalWeight; - left.entries[left.entries.size() - 1].weight -= rw; - right.entries[0].weight = rw; - i = 1; - w = rw; - } - else - { - i = 0; - w = 0; - } - - while ( w < right.totalWeight ) - { - right.entries.push_back(*e++); - w += right.entries[i].weight; - i++; - } - - left.computeLongestEdge(); - right.computeLongestEdge(); -} \ No newline at end of file diff --git a/DSTexCompress/src/Histogram.h b/DSTexCompress/src/Histogram.h deleted file mode 100644 index 4947315..0000000 --- a/DSTexCompress/src/Histogram.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _HISTOGRAM_H_ -#define _HISTOGRAM_H_ - -#include -#include "Color.h" -class fipImage; -class PaletteGroup; - -struct Block -{ - Color pix[16]; -}; - -class Histogram -{ - struct entry - { - Color color; - u32 weight; - }; - - std::vector entries; - u32 totalWeight; - u32 longestEdge; - u32 longestEdgeLength; - - void computeLongestEdge(); - -public: - Histogram() : entries(0), totalWeight(0), longestEdge(0xFFFFFFFF), longestEdgeLength(0xFFFFFFFF) {} - Histogram(const Block& block); - Histogram(const PaletteGroup& group); - - inline u32 Length() const { return entries.size(); } - inline Color GetColor(u32 c) const { return entries[c].color; } - inline bool IsSplittable() const { return entries.size() > 1; } - inline u32 GetImportance() const { return entries.size() * totalWeight * longestEdgeLength; } - - void Split(Histogram& left, Histogram& right); - - Color Average() const; -}; - -#endif // _HISTOGRAM_H_ \ No newline at end of file diff --git a/DSTexCompress/src/Palette.cpp b/DSTexCompress/src/Palette.cpp deleted file mode 100644 index ef3ae57..0000000 --- a/DSTexCompress/src/Palette.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "Palette.h" - -s32 Max(s32 a, s32 b) -{ - return a > b ? a : b; -} - -s32 Abs(s32 x) -{ - return x < 0 ? -x : x; -} - -void Palette::UpdateVariance() -{ - Color max, min; - min.r = min.g = min.b = 32; - - for ( u32 j = 0 ; j < length ; j++ ) - { - ColorCube(colors[j], min, max); - } - - Color diff = max - min; - //variance = diff.r + diff.g + diff.b; // A-Type - //variance = Max(Max(diff.r, diff.g), diff.b); // B-Type - variance = Max(Max(Abs(diff.r), Abs(diff.g)), Abs(diff.b)); // C-Type -} - -void PaletteGroup::UpdateVariance() -{ - Color min, max; - min.r = min.g = min.b = 32; - Palette* p = &palettes[0]; - for ( u32 i = palettes.size() ; i > 0 ; i-- ) - { - for ( u32 j = 0 ; j < p->length ; j++ ) - { - ColorCube(p->colors[j], min, max); - } - p++; - } - Color diff = max - min; - //variance = diff.r + diff.g + diff.b; // A-Type - //variance = Max(Max(diff.r, diff.g), diff.b); // B-Type - variance = Max(Max(Abs(diff.r), Abs(diff.g)), Abs(diff.b)); // C-Type -} - -void PaletteGroup::Split(PaletteGroup& left, PaletteGroup& right) -{ - qsort(&palettes[0], palettes.size(), sizeof(palettes[0]), (int (*)(const void*, const void*))ComparePalette); - - left.palettes.insert(left.palettes.begin(), - &palettes[0], - &palettes[0] + palettes.size() / 2); - right.palettes.insert(right.palettes.begin(), - &palettes[0] + palettes.size() - left.palettes.size(), - &palettes[0] + palettes.size()); - - left.UpdateVariance(); - right.UpdateVariance(); -} \ No newline at end of file diff --git a/DSTexCompress/src/Palette.h b/DSTexCompress/src/Palette.h deleted file mode 100644 index ef60a63..0000000 --- a/DSTexCompress/src/Palette.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef _PALETTE_H_ -#define _PALETTE_H_ - -#include "Color.h" -#include - -struct Palette -{ - Color colors[4]; - u32 length; - s32 variance; - - Palette() : length(0), variance(0) {} - - void UpdateVariance(); -}; - -inline int ComparePalette(const Palette* a, const Palette* b) -{ - return a->variance - b->variance; -} - -class PaletteGroup -{ - std::vector palettes; - u32 variance; - -public: - PaletteGroup() : variance(0) {} - - inline bool IsSplittable() const { return palettes.size() > 4; } - inline u32 GetImportance() const { return variance * palettes.size(); } - inline u32 Length() const { return palettes.size(); } - inline const Palette& GetPalette(u32 i) const { return palettes[i]; } - inline void Add(Palette& p) { palettes.push_back(p); } - - void UpdateVariance(); - void Split(PaletteGroup& left, PaletteGroup& right); -}; - -#endif // _PALETTE_H_ \ No newline at end of file diff --git a/DSTexCompress/src/main.cpp b/DSTexCompress/src/main.cpp deleted file mode 100644 index 64ee6c8..0000000 --- a/DSTexCompress/src/main.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include -#include -#include "wingetopt.h" -#include "Compressor.h" - -int main(int argc, char** argv) -{ - if ( argc < 3 ) - { - static const char* msg = -#if DITHERING - "Usage: %s [-d] [-e] [-p preview] [-c palette_count] [-o output] \n" - " -d : enable floyd-steinberg dithering\n" -#else - "Usage: %s [-e] [-p preview] [-c palette_count] [-o output] \n" -#endif - " -e : enable 2-colors extended palettes\n" - " -p : output preview to file\n" - " -c : number of 4-colors palettes generated\n" - " default is 192.\n" - " -o : output file, default is input.ctx.\n"; - fprintf(stderr, msg, argv[0]); - return 42; - } - - std::string output; - const char* preview = 0; - u32 nbPalettes = 192; - bool dither = false; - bool extend = false; - - int c; - while ( (c = getopt(argc, argv, "p:c:o:de")) != -1 ) - { - switch ( c ) - { - case 'p': - { - preview = optarg; - break; - } - - case 'c': - { - nbPalettes = atoi(optarg); - break; - } - - case 'o': - { - output = optarg; - break; - } - -#if DITHERING - case 'd': - { - dither = true; - break; - } -#endif - - case 'e': - { - extend = true; - break; - } - } - } - - const char* input = argv[optind]; - if ( output.size() == 0 ) - { - output = input; - output += ".ctx"; - } - - Compressor compressor; - if ( ! compressor.Open(input) ) - { - return 1; - } - - compressor.Process(output.c_str(), nbPalettes, extend, dither, preview); - - return 0; -} \ No newline at end of file diff --git a/DSTexCompress/src/wingetopt.c b/DSTexCompress/src/wingetopt.c deleted file mode 100644 index 9947792..0000000 --- a/DSTexCompress/src/wingetopt.c +++ /dev/null @@ -1,81 +0,0 @@ -//http://note.sonots.com/Comp/CompLang/cpp/getopt.html -/* -POSIX getopt for Windows - -AT&T Public License - -Code given out at the 1985 UNIFORUM conference in Dallas. -*/ - -#ifndef __GNUC__ - -#include "wingetopt.h" -#include -#include - -#ifndef NULL -#define NULL 0 -#endif -#define EOF (-1) -#define ERR(s, c) if(opterr){\ - char errbuf[2];\ - errbuf[0] = c; errbuf[1] = '\n';\ - fputs(argv[0], stderr);\ - fputs(s, stderr);\ - fputc(c, stderr);} - //(void) write(2, argv[0], (unsigned)strlen(argv[0]));\ - //(void) write(2, s, (unsigned)strlen(s));\ - //(void) write(2, errbuf, 2);} - -int opterr = 1; -int optind = 1; -int optopt; -char *optarg; - -int -getopt(argc, argv, opts) -int argc; -char **argv, *opts; -{ - static int sp = 1; - register int c; - register char *cp; - - if(sp == 1) - if(optind >= argc || - argv[optind][0] != '-' || argv[optind][1] == '\0') - return(EOF); - else if(strcmp(argv[optind], "--") == 0) { - optind++; - return(EOF); - } - optopt = c = argv[optind][sp]; - if(c == ':' || (cp=strchr(opts, c)) == NULL) { - ERR(": illegal option -- ", c); - if(argv[optind][++sp] == '\0') { - optind++; - sp = 1; - } - return('?'); - } - if(*++cp == ':') { - if(argv[optind][sp+1] != '\0') - optarg = &argv[optind++][sp+1]; - else if(++optind >= argc) { - ERR(": option requires an argument -- ", c); - sp = 1; - return('?'); - } else - optarg = argv[optind++]; - sp = 1; - } else { - if(argv[optind][++sp] == '\0') { - sp = 1; - optind++; - } - optarg = NULL; - } - return(c); -} - -#endif /* __GNUC__ */ \ No newline at end of file diff --git a/DSTexCompress/src/wingetopt.h b/DSTexCompress/src/wingetopt.h deleted file mode 100644 index 13e5545..0000000 --- a/DSTexCompress/src/wingetopt.h +++ /dev/null @@ -1,33 +0,0 @@ -//http://note.sonots.com/Comp/CompLang/cpp/getopt.html -/* -POSIX getopt for Windows - -AT&T Public License - -Code given out at the 1985 UNIFORUM conference in Dallas. -*/ - -#ifdef __GNUC__ -#include -#endif -#ifndef __GNUC__ - -#ifndef _WINGETOPT_H_ -#define _WINGETOPT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int opterr; -extern int optind; -extern int optopt; -extern char *optarg; -extern int getopt(int argc, char **argv, char *opts); - -#ifdef __cplusplus -} -#endif - -#endif /* _GETOPT_H_ */ -#endif /* __GNUC__ */ \ No newline at end of file diff --git a/Release/DSTexCompress.exe b/Release/DSTexCompress.exe deleted file mode 100644 index eb3e4c5..0000000 Binary files a/Release/DSTexCompress.exe and /dev/null differ diff --git a/Release/FreeImage.dll b/Release/FreeImage.dll deleted file mode 100644 index abe1365..0000000 Binary files a/Release/FreeImage.dll and /dev/null differ diff --git a/Release/FreeImagePlus.dll b/Release/FreeImagePlus.dll deleted file mode 100644 index c8efc59..0000000 Binary files a/Release/FreeImagePlus.dll and /dev/null differ