├── .gitattributes ├── .gitignore ├── FreeImage-dotnet-core.sln ├── README.md ├── UnitTestData └── Images │ ├── Even │ ├── Image_01_dither.tif │ ├── Image_01_threshold.tif │ ├── Image_04.tif │ ├── Image_04_gs_minisblack.tif │ ├── Image_04_gs_unordered.tif │ ├── Image_08.tif │ ├── Image_08_gs_minisblack.tif │ ├── Image_08_gs_unordered.tif │ ├── Image_16_555.bmp │ ├── Image_16_565.bmp │ ├── Image_24.tif │ └── Image_32.tif │ ├── JPEG │ └── Image.jpg │ ├── Metadata │ └── exif.jpg │ ├── MultiPaged │ └── Image.tif │ ├── Odd │ ├── Image_01_dither.tif │ ├── Image_01_threshold.tif │ ├── Image_04.tif │ ├── Image_04_gs_minisblack.tif │ ├── Image_04_gs_unordered.tif │ ├── Image_08.tif │ ├── Image_08_gs_minisblack.tif │ ├── Image_08_gs_unordered.tif │ ├── Image_16_555.bmp │ ├── Image_16_565.bmp │ └── Image_24.tif │ ├── Original_Even.bmp │ └── Original_Odd.bmp ├── license-fi.txt ├── license-gplv2.txt ├── license-gplv3.txt ├── runtimes ├── osx.10.10-x64 │ └── native │ │ └── libfreeimage.3.17.0.dylib ├── ubuntu.16.04-x64 │ └── native │ │ └── libfreeimage-3.17.0.so ├── win7-x64 │ └── native │ │ └── FreeImage.dll └── win7-x86 │ └── native │ └── FreeImage.dll └── src ├── Doc ├── 3.11.0 │ └── FreeImage.NET.shfbproj ├── 3.12.0 │ └── FreeImage.NET.shfbproj ├── 3.13.0 │ └── FreeImage.NET.shfbproj ├── FreeImage.NET.shfbproj └── SHFB.txt ├── FreeImage-dotnet-core ├── Classes │ ├── FreeImageBitmap.cs │ ├── FreeImageEngine.cs │ ├── FreeImagePlugin.cs │ ├── FreeImageStreamIO.cs │ ├── GifInformation.cs │ ├── ImageMetadata.cs │ ├── LocalPlugin.cs │ ├── MemoryArray.cs │ ├── MetadataModel.cs │ ├── MetadataModels.cs │ ├── MetadataTag.cs │ ├── Palette.cs │ ├── PluginRepository.cs │ ├── Scanline.cs │ └── StreamWrapper.cs ├── Delegates.cs ├── Enumerations │ ├── DisposalMethodType.cs │ ├── FREE_IMAGE_COLOR_CHANNEL.cs │ ├── FREE_IMAGE_COLOR_DEPTH.cs │ ├── FREE_IMAGE_COLOR_OPTIONS.cs │ ├── FREE_IMAGE_COLOR_TYPE.cs │ ├── FREE_IMAGE_COMPARE_FLAGS.cs │ ├── FREE_IMAGE_DITHER.cs │ ├── FREE_IMAGE_FILTER.cs │ ├── FREE_IMAGE_FORMAT.cs │ ├── FREE_IMAGE_JPEG_OPERATION.cs │ ├── FREE_IMAGE_LOAD_FLAGS.cs │ ├── FREE_IMAGE_MDMODEL.cs │ ├── FREE_IMAGE_MDTYPE.cs │ ├── FREE_IMAGE_METADATA_COPY.cs │ ├── FREE_IMAGE_QUANTIZE.cs │ ├── FREE_IMAGE_SAVE_FLAGS.cs │ ├── FREE_IMAGE_TMO.cs │ ├── FREE_IMAGE_TYPE.cs │ ├── ICC_FLAGS.cs │ └── MD_SEARCH_FLAGS.cs ├── FreeImage-dotnet-core.csproj ├── FreeImageException.cs ├── FreeImageStaticImports.cs ├── FreeImageWrapper.cs ├── PackageTargets │ └── FreeImage-dotnet-core.targets ├── Properties │ └── AssemblyInfo.cs └── Structs │ ├── BITMAP.cs │ ├── BITMAPINFO.cs │ ├── BITMAPINFOHEADER.cs │ ├── FI16RGB555.cs │ ├── FI16RGB565.cs │ ├── FI1BIT.cs │ ├── FI4BIT.cs │ ├── FIBITMAP.cs │ ├── FICOMPLEX.cs │ ├── FIICCPROFILE.cs │ ├── FIMEMORY.cs │ ├── FIMETADATA.cs │ ├── FIMULTIBITMAP.cs │ ├── FIRGB16.cs │ ├── FIRGBA16.cs │ ├── FIRGBAF.cs │ ├── FIRGBF.cs │ ├── FIRational.cs │ ├── FITAG.cs │ ├── FIURational.cs │ ├── FreeImageIO.cs │ ├── Plugin.cs │ ├── RGBQUAD.cs │ ├── RGBTRIPLE.cs │ └── fi_handle.cs ├── Samples ├── Sample 01 - Loading and saving │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sample 01 - Loading and saving.2005.csproj │ ├── Sample 01 - Loading and saving.csproj │ └── Sample.jpg ├── Sample 02 - Multipaged bitmaps │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sample 02 - Multipaged bitmaps.2005.csproj │ ├── Sample 02 - Multipaged bitmaps.csproj │ └── multipaged.tif ├── Sample 03 - Allocating │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sample 03 - Allocating.2005.csproj │ └── Sample 03 - Allocating.csproj ├── Sample 04 - Getting bitmap informations │ ├── MainForm.Designer.cs │ ├── MainForm.cs │ ├── MainForm.resx │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sample 04 - Getting bitmap informations.2005.csproj │ └── Sample 04 - Getting bitmap informations.csproj ├── Sample 05 - Working with pixels │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sample 05 - Working with pixels.2005.csproj │ ├── Sample 05 - Working with pixels.csproj │ ├── Sample.jpg │ └── Sample.tif ├── Sample 06 - Converting │ ├── MainForm.Designer.cs │ ├── MainForm.cs │ ├── MainForm.resx │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sample 06 - Converting.2005.csproj │ ├── Sample 06 - Converting.csproj │ └── Sample.jpg ├── Sample 07 - ICC Profiles │ ├── Program.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sample 07 - ICC Profiles.2005.csproj │ ├── Sample 07 - ICC Profiles.csproj │ └── Sample.jpg ├── Sample 08 - Creating a plugin │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sample 08 - Creating a plugin.2005.csproj │ ├── Sample 08 - Creating a plugin.csproj │ ├── Sample.jpg │ ├── SampleForm.Designer.cs │ ├── SampleForm.cs │ ├── SampleForm.resx │ └── SerializationPlugin.cs ├── Sample 09 - Working with streams │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sample 09 - Working with streams.2005.csproj │ ├── Sample 09 - Working with streams.csproj │ ├── SampleForm.Designer.cs │ ├── SampleForm.cs │ └── SampleForm.resx ├── Sample 10 - Metadata │ ├── MainForm.Designer.cs │ ├── MainForm.cs │ ├── MainForm.resx │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Sample 10 - Metadata.2005.csproj │ └── Sample 10 - Metadata.csproj └── Sample 11 - Using the FreeImageBitmap class │ ├── MainForm.Designer.cs │ ├── MainForm.cs │ ├── MainForm.resx │ ├── MetaDataFrame.Designer.cs │ ├── MetaDataFrame.cs │ ├── MetaDataFrame.resx │ ├── Properties │ └── AssemblyInfo.cs │ ├── Sample 11 - Using the FreeImageBitmap class.2005.csproj │ └── Sample 11 - Using the FreeImageBitmap class.csproj ├── SourceFileManager ├── FreeImage.cs.template ├── Program.cs ├── Properties │ └── AssemblyInfo.cs ├── SourceFileMerger.2005.csproj └── SourceFileMerger.csproj └── UnitTest ├── ImageManager.cs ├── NUnit.txt ├── SetUpFixture.cs ├── TestFixtures ├── FreeImageBitmapTest.cs ├── ImportedFunctionsTest.cs ├── ImportedStructsTest.cs ├── WrapperFunctionsTest.cs └── WrapperStructsTest.cs ├── UnitTest.csproj └── Utility.cs /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /FreeImage-dotnet-core.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 15 3 | VisualStudioVersion = 15.0.26228.9 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeImage-dotnet-core", "src\FreeImage-dotnet-core\FreeImage-dotnet-core.csproj", "{249C05B3-BB94-4EB1-92AE-E6DF4C2C068A}" 6 | EndProject 7 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B03B4CBD-B223-4F9B-BC26-274A5FDB660D}" 8 | ProjectSection(SolutionItems) = preProject 9 | .gitignore = .gitignore 10 | README.md = README.md 11 | EndProjectSection 12 | EndProject 13 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{32568241-B63B-4E05-A92D-C46C50EECFB9}" 14 | EndProject 15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest", "src\UnitTest\UnitTest.csproj", "{0140ED84-DFCD-4547-9642-4557A24F835E}" 16 | EndProject 17 | Global 18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 19 | Debug|Any CPU = Debug|Any CPU 20 | Release|Any CPU = Release|Any CPU 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {249C05B3-BB94-4EB1-92AE-E6DF4C2C068A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 24 | {249C05B3-BB94-4EB1-92AE-E6DF4C2C068A}.Debug|Any CPU.Build.0 = Debug|Any CPU 25 | {249C05B3-BB94-4EB1-92AE-E6DF4C2C068A}.Release|Any CPU.ActiveCfg = Release|Any CPU 26 | {249C05B3-BB94-4EB1-92AE-E6DF4C2C068A}.Release|Any CPU.Build.0 = Release|Any CPU 27 | {0140ED84-DFCD-4547-9642-4557A24F835E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 28 | {0140ED84-DFCD-4547-9642-4557A24F835E}.Debug|Any CPU.Build.0 = Debug|Any CPU 29 | {0140ED84-DFCD-4547-9642-4557A24F835E}.Release|Any CPU.ActiveCfg = Release|Any CPU 30 | {0140ED84-DFCD-4547-9642-4557A24F835E}.Release|Any CPU.Build.0 = Release|Any CPU 31 | EndGlobalSection 32 | GlobalSection(SolutionProperties) = preSolution 33 | HideSolutionNode = FALSE 34 | EndGlobalSection 35 | GlobalSection(NestedProjects) = preSolution 36 | {249C05B3-BB94-4EB1-92AE-E6DF4C2C068A} = {32568241-B63B-4E05-A92D-C46C50EECFB9} 37 | {0140ED84-DFCD-4547-9642-4557A24F835E} = {32568241-B63B-4E05-A92D-C46C50EECFB9} 38 | EndGlobalSection 39 | EndGlobal 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This is a clone of the FreeImage .NET project (http://freeimage.sourceforge.net/) modified to work with dotnet core. Note that all functions that use System.Drawing.Bitmap have been removed from the netstandard framework versions as there is no implementation for this class. 2 | 3 | FreeImage native binaries are included in the nuget package for Windows x86/x64, Ubuntu x64 (^16.04), and OSX x64 (^10.10). 4 | 5 | For other platforms they will have to be installed separately. Note that the native function calls require the library filename to be "FreeImage," so symlinking may be required (eg. "sudo ln -s /usr/lib/x86_64-linux-gnu/libfreeimage.so /usr/lib/FreeImage"). 6 | 7 | nuget package: https://www.nuget.org/packages/FreeImage-dotnet-core 8 | 9 | `Install-Package FreeImage-dotnet-core` 10 | 11 | #### FreeImage Version 12 | 13 | This is for FreeImage version 3.17.0 14 | 15 | ##### The version number of this package no longer matches the FreeImage native library version! 16 | 17 | #### License 18 | 19 | The license is the same as the FreeImage license available at the link above 20 | -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_01_dither.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_01_dither.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_01_threshold.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_01_threshold.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_04.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_04.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_04_gs_minisblack.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_04_gs_minisblack.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_04_gs_unordered.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_04_gs_unordered.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_08.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_08.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_08_gs_minisblack.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_08_gs_minisblack.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_08_gs_unordered.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_08_gs_unordered.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_16_555.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_16_555.bmp -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_16_565.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_16_565.bmp -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_24.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_24.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Even/Image_32.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Even/Image_32.tif -------------------------------------------------------------------------------- /UnitTestData/Images/JPEG/Image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/JPEG/Image.jpg -------------------------------------------------------------------------------- /UnitTestData/Images/Metadata/exif.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Metadata/exif.jpg -------------------------------------------------------------------------------- /UnitTestData/Images/MultiPaged/Image.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/MultiPaged/Image.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_01_dither.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_01_dither.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_01_threshold.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_01_threshold.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_04.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_04.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_04_gs_minisblack.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_04_gs_minisblack.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_04_gs_unordered.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_04_gs_unordered.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_08.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_08.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_08_gs_minisblack.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_08_gs_minisblack.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_08_gs_unordered.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_08_gs_unordered.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_16_555.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_16_555.bmp -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_16_565.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_16_565.bmp -------------------------------------------------------------------------------- /UnitTestData/Images/Odd/Image_24.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Odd/Image_24.tif -------------------------------------------------------------------------------- /UnitTestData/Images/Original_Even.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Original_Even.bmp -------------------------------------------------------------------------------- /UnitTestData/Images/Original_Odd.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/UnitTestData/Images/Original_Odd.bmp -------------------------------------------------------------------------------- /license-gplv3.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/license-gplv3.txt -------------------------------------------------------------------------------- /runtimes/osx.10.10-x64/native/libfreeimage.3.17.0.dylib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/runtimes/osx.10.10-x64/native/libfreeimage.3.17.0.dylib -------------------------------------------------------------------------------- /runtimes/ubuntu.16.04-x64/native/libfreeimage-3.17.0.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/runtimes/ubuntu.16.04-x64/native/libfreeimage-3.17.0.so -------------------------------------------------------------------------------- /runtimes/win7-x64/native/FreeImage.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/runtimes/win7-x64/native/FreeImage.dll -------------------------------------------------------------------------------- /runtimes/win7-x86/native/FreeImage.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/runtimes/win7-x86/native/FreeImage.dll -------------------------------------------------------------------------------- /src/Doc/3.11.0/FreeImage.NET.shfbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | Debug 7 | AnyCPU 8 | 2.0 9 | {d68736d0-a80d-453c-a921-6ada865504b5} 10 | 1.8.0.0 11 | 13 | Documentation 14 | Documentation 15 | Documentation 16 | 17 | .\Out\ 18 | FreeImage.NET 19 | HtmlHelp1x 20 | False 21 | FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29. 22 | FreeImage .NET Documentation 23 | HashedMemberName 24 | Msdn 25 | AutoDocumentCtors 26 | InheritedMembers, Protected 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/Doc/3.12.0/FreeImage.NET.shfbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | Debug 7 | AnyCPU 8 | 2.0 9 | {d68736d0-a80d-453c-a921-6ada865504b5} 10 | 1.8.0.0 11 | 13 | Documentation 14 | Documentation 15 | Documentation 16 | 17 | .\Out\ 18 | FreeImage.NET 19 | HtmlHelp1x 20 | False 21 | FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29. 22 | FreeImage .NET Documentation 23 | HashedMemberName 24 | Msdn 25 | AutoDocumentCtors 26 | InheritedMembers, Protected 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/Doc/3.13.0/FreeImage.NET.shfbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | Debug 7 | AnyCPU 8 | 2.0 9 | {d68736d0-a80d-453c-a921-6ada865504b5} 10 | 1.8.0.0 11 | 13 | Documentation 14 | Documentation 15 | Documentation 16 | 17 | .\Out\ 18 | FreeImage.NET 19 | HtmlHelp1x 20 | False 21 | FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29. 22 | FreeImage .NET Documentation 23 | HashedMemberName 24 | Msdn 25 | AutoDocumentCtors 26 | InheritedMembers, Protected 27 | 28 | 29 | 30 | 31 | 32 | 33 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/Doc/FreeImage.NET.shfbproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 6 | Debug 7 | AnyCPU 8 | 2.0 9 | {d68736d0-a80d-453c-a921-6ada865504b5} 10 | 1.8.0.0 11 | 13 | Documentation 14 | Documentation 15 | Documentation 16 | 17 | .\Out\ 18 | FreeImage.NET 19 | HtmlHelp1x 20 | False 21 | FreeImage - The productivity booster. FreeImage is licensed under the GNU General Public License %28GPL%29 and the FreeImage Public License %28FIPL%29. 22 | FreeImage .NET Documentation 23 | HashedMemberName 24 | Msdn 25 | AutoDocumentCtors 26 | InheritedMembers, Protected 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/Doc/SHFB.txt: -------------------------------------------------------------------------------- 1 | Eric Woodruff's Sandcastle Help File Builder 1.6.x.x (SHFB) is needed for FreeImage.NET wrapper 2 | help file creation. It can be downloaded from http://www.codeplex.com/SHFB 3 | 4 | As of FreeImage.NET version 1.08, version 1.8.01 of Sandcastle Help File Builder is used by FreeImage.NET 5 | and thus needed for FreeImage.NET wrapper help file creation. It can still be downloaded 6 | from http://www.codeplex.com/SHFB 7 | 8 | Microsoft's Sandcaste is also needed for SHFB to run correctly. It can be downloaded from 9 | http://www.microsoft.com/downloads/details.aspx?FamilyId=E82EA71D-DA89-42EE-A715-696E3A4873B2&displaylang=en 10 | -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Classes/FreeImageEngine.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace FreeImageAPI 5 | { 6 | /// 7 | /// Class handling non-bitmap related functions. 8 | /// 9 | public static class FreeImageEngine 10 | { 11 | // TODO: ideally FreeImage would provide this... either way, it should probably be cleared before any call to the API... 12 | [ThreadStatic] 13 | public static string LastErrorMessage; 14 | 15 | #region Callback 16 | 17 | [DebuggerBrowsable(DebuggerBrowsableState.Never)] 18 | private static readonly object outputMessageFunctionLock; 19 | 20 | [DebuggerBrowsable(DebuggerBrowsableState.Never)] 21 | private static OutputMessageFunction outputMessageFunction; 22 | 23 | private static event OutputMessageFunction message; 24 | 25 | static FreeImageEngine() 26 | { 27 | outputMessageFunctionLock = new object(); 28 | 29 | try 30 | { 31 | InitializeMessage(); 32 | } 33 | catch 34 | { 35 | } 36 | } 37 | 38 | /// 39 | /// Internal errors in FreeImage generate a logstring that can be 40 | /// captured by this event. 41 | /// 42 | public static event OutputMessageFunction Message 43 | { 44 | add 45 | { 46 | InitializeMessage(); 47 | message += value; 48 | } 49 | remove 50 | { 51 | InitializeMessage(); 52 | message -= value; 53 | } 54 | } 55 | 56 | private static void InitializeMessage() 57 | { 58 | if (null == outputMessageFunction) 59 | { 60 | lock (outputMessageFunctionLock) 61 | { 62 | if (null == outputMessageFunction) 63 | { 64 | FreeImage.ValidateAvailability(); 65 | 66 | try 67 | { 68 | // Create a delegate (function pointer) to 'OnMessage' 69 | outputMessageFunction = 70 | delegate (FREE_IMAGE_FORMAT fif, string message) 71 | { 72 | LastErrorMessage = message; 73 | 74 | // Get a local copy of the multicast-delegate 75 | OutputMessageFunction m = FreeImageEngine.message; 76 | 77 | // Check the local copy instead of the static instance 78 | // to prevent a second thread from setting the delegate 79 | // to null, which would cause a nullreference exception 80 | if (m != null) 81 | { 82 | // Invoke the multicast-delegate 83 | m.Invoke(fif, message); 84 | } 85 | }; 86 | 87 | // Set the callback 88 | FreeImage.SetOutputMessage(outputMessageFunction); 89 | } 90 | catch 91 | { 92 | outputMessageFunction = null; 93 | throw; 94 | } 95 | } 96 | } 97 | } 98 | } 99 | 100 | #endregion 101 | 102 | /// 103 | /// Gets a string containing the current version of the library. 104 | /// 105 | public static string Version 106 | { 107 | get 108 | { 109 | return FreeImage.GetVersion(); 110 | } 111 | } 112 | 113 | /// 114 | /// Gets a string containing a standard copyright message. 115 | /// 116 | public static string CopyrightMessage 117 | { 118 | get 119 | { 120 | return FreeImage.GetCopyrightMessage(); 121 | } 122 | } 123 | 124 | /// 125 | /// Gets whether the platform is using Little Endian. 126 | /// 127 | public static bool IsLittleEndian 128 | { 129 | get 130 | { 131 | return FreeImage.IsLittleEndian(); 132 | } 133 | } 134 | } 135 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Classes/MetadataModels.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/FreeImage-dotnet-core/Classes/MetadataModels.cs -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Classes/Scanline.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Runtime.InteropServices; 5 | 6 | namespace FreeImageAPI 7 | { 8 | /// 9 | /// Provides methods for working with generic bitmap scanlines. 10 | /// 11 | /// Type of the bitmaps' scanlines. 12 | public sealed class Scanline : MemoryArray where T : struct 13 | { 14 | /// 15 | /// Initializes a new instance based on the specified FreeImage bitmap. 16 | /// 17 | /// Handle to a FreeImage bitmap. 18 | public Scanline(FIBITMAP dib) 19 | : this(dib, 0) 20 | { 21 | } 22 | 23 | /// 24 | /// Initializes a new instance based on the specified FreeImage bitmap. 25 | /// 26 | /// Handle to a FreeImage bitmap. 27 | /// Index of the zero based scanline. 28 | public Scanline(FIBITMAP dib, int scanline) 29 | : this(dib, scanline, (int)(typeof(T) == typeof(FI1BIT) ? 30 | FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib) : 31 | typeof(T) == typeof(FI4BIT) ? 32 | FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib) / 4 : 33 | (FreeImage.GetBPP(dib) * FreeImage.GetWidth(dib)) / (Marshal.SizeOf(typeof(T)) * 8))) 34 | { 35 | } 36 | 37 | internal Scanline(FIBITMAP dib, int scanline, int length) 38 | : base(FreeImage.GetScanLine(dib, scanline), length) 39 | { 40 | if (dib.IsNull) 41 | { 42 | throw new ArgumentNullException("dib"); 43 | } 44 | if ((scanline < 0) || (scanline >= FreeImage.GetHeight(dib))) 45 | { 46 | throw new ArgumentOutOfRangeException("scanline"); 47 | } 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/DisposalMethodType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace FreeImageAPI.Metadata 6 | { 7 | /// 8 | /// Specifies how a single frame will be handled after being displayed. 9 | /// 10 | public enum DisposalMethodType : byte 11 | { 12 | /// 13 | /// Same behavior as but should not be used. 14 | /// 15 | Unspecified, 16 | 17 | /// 18 | /// The image is left in place and will be overdrawn by the next image. 19 | /// 20 | Leave, 21 | 22 | /// 23 | /// The area of the image will be blanked out by its background. 24 | /// 25 | Background, 26 | 27 | /// 28 | /// Restores the the area of the image to the state it was before it 29 | /// has been dawn. 30 | /// 31 | Previous, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_COLOR_CHANNEL.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:40 $ 33 | // $Id: FREE_IMAGE_COLOR_CHANNEL.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Color channels. Constants used in color manipulation routines. 40 | /// 41 | public enum FREE_IMAGE_COLOR_CHANNEL 42 | { 43 | /// 44 | /// Use red, green and blue channels 45 | /// 46 | FICC_RGB = 0, 47 | /// 48 | /// Use red channel 49 | /// 50 | FICC_RED = 1, 51 | /// 52 | /// Use green channel 53 | /// 54 | FICC_GREEN = 2, 55 | /// 56 | /// Use blue channel 57 | /// 58 | FICC_BLUE = 3, 59 | /// 60 | /// Use alpha channel 61 | /// 62 | FICC_ALPHA = 4, 63 | /// 64 | /// Use black channel 65 | /// 66 | FICC_BLACK = 5, 67 | /// 68 | /// Complex images: use real part 69 | /// 70 | FICC_REAL = 6, 71 | /// 72 | /// Complex images: use imaginary part 73 | /// 74 | FICC_IMAG = 7, 75 | /// 76 | /// Complex images: use magnitude 77 | /// 78 | FICC_MAG = 8, 79 | /// 80 | /// Complex images: use phase 81 | /// 82 | FICC_PHASE = 9 83 | } 84 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_COLOR_DEPTH.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:39 $ 33 | // $Id: FREE_IMAGE_COLOR_DEPTH.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Enumeration used for color conversions. 40 | /// FREE_IMAGE_COLOR_DEPTH contains several colors to convert to. 41 | /// The default value 'FICD_AUTO'. 42 | /// 43 | [System.Flags] 44 | public enum FREE_IMAGE_COLOR_DEPTH 45 | { 46 | /// 47 | /// Unknown. 48 | /// 49 | FICD_UNKNOWN = 0, 50 | /// 51 | /// Auto selected by the used algorithm. 52 | /// 53 | FICD_AUTO = FICD_UNKNOWN, 54 | /// 55 | /// 1-bit. 56 | /// 57 | FICD_01_BPP = 1, 58 | /// 59 | /// 1-bit using dithering. 60 | /// 61 | FICD_01_BPP_DITHER = FICD_01_BPP, 62 | /// 63 | /// 1-bit using threshold. 64 | /// 65 | FICD_01_BPP_THRESHOLD = FICD_01_BPP | 2, 66 | /// 67 | /// 4-bit. 68 | /// 69 | FICD_04_BPP = 4, 70 | /// 71 | /// 8-bit. 72 | /// 73 | FICD_08_BPP = 8, 74 | /// 75 | /// 16-bit 555 (1 bit remains unused). 76 | /// 77 | FICD_16_BPP_555 = FICD_16_BPP | 2, 78 | /// 79 | /// 16-bit 565 (all bits are used). 80 | /// 81 | FICD_16_BPP = 16, 82 | /// 83 | /// 24-bit. 84 | /// 85 | FICD_24_BPP = 24, 86 | /// 87 | /// 32-bit. 88 | /// 89 | FICD_32_BPP = 32, 90 | /// 91 | /// Reorder palette (make it linear). Only affects 1-, 4- and 8-bit images. 92 | /// The palette is only reordered in case the image is greyscale 93 | /// (all palette entries have the same red, green and blue value). 94 | /// 95 | FICD_REORDER_PALETTE = 1024, 96 | /// 97 | /// Converts the image to greyscale. 98 | /// 99 | FICD_FORCE_GREYSCALE = 2048, 100 | /// 101 | /// Flag to mask out all non color depth flags. 102 | /// 103 | FICD_COLOR_MASK = FICD_01_BPP | FICD_04_BPP | FICD_08_BPP | FICD_16_BPP | FICD_24_BPP | FICD_32_BPP 104 | } 105 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_COLOR_OPTIONS.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2009/09/15 11:44:24 $ 33 | // $Id: FREE_IMAGE_COLOR_OPTIONS.cs,v 1.1 2009/09/15 11:44:24 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Constants used in color filling routines. 40 | /// 41 | public enum FREE_IMAGE_COLOR_OPTIONS 42 | { 43 | /// 44 | /// Default value. 45 | /// 46 | FICO_DEFAULT = 0x0, 47 | /// 48 | /// color is RGB color (contains no valid alpha channel). 49 | /// 50 | FICO_RGB = 0x0, 51 | /// 52 | /// color is RGBA color (contains a valid alpha channel). 53 | /// 54 | FICO_RGBA = 0x1, 55 | /// 56 | /// Lookup nearest RGB color from palette. 57 | /// 58 | FICO_NEAREST_COLOR = 0x0, 59 | /// 60 | /// Lookup equal RGB color from palette. 61 | /// 62 | FICO_EQUAL_COLOR = 0x2, 63 | /// 64 | /// contains the palette index to be used. 65 | /// 66 | FICO_ALPHA_IS_INDEX = 0x4, 67 | } 68 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_COLOR_TYPE.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:40 $ 33 | // $Id: FREE_IMAGE_COLOR_TYPE.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Image color types used in FreeImage. 40 | /// 41 | public enum FREE_IMAGE_COLOR_TYPE 42 | { 43 | /// 44 | /// min value is white 45 | /// 46 | FIC_MINISWHITE = 0, 47 | /// 48 | /// min value is black 49 | /// 50 | FIC_MINISBLACK = 1, 51 | /// 52 | /// RGB color model 53 | /// 54 | FIC_RGB = 2, 55 | /// 56 | /// color map indexed 57 | /// 58 | FIC_PALETTE = 3, 59 | /// 60 | /// RGB color model with alpha channel 61 | /// 62 | FIC_RGBALPHA = 4, 63 | /// 64 | /// CMYK color model 65 | /// 66 | FIC_CMYK = 5 67 | } 68 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_COMPARE_FLAGS.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:40 $ 33 | // $Id: FREE_IMAGE_COMPARE_FLAGS.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// List of combinable compare modes. 40 | /// 41 | [System.Flags] 42 | public enum FREE_IMAGE_COMPARE_FLAGS 43 | { 44 | /// 45 | /// Compare headers. 46 | /// 47 | HEADER = 0x1, 48 | /// 49 | /// Compare palettes. 50 | /// 51 | PALETTE = 0x2, 52 | /// 53 | /// Compare pixel data. 54 | /// 55 | DATA = 0x4, 56 | /// 57 | /// Compare meta data. 58 | /// 59 | METADATA = 0x8, 60 | /// 61 | /// Compare everything. 62 | /// 63 | COMPLETE = (HEADER | PALETTE | DATA | METADATA) 64 | } 65 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_DITHER.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:40 $ 33 | // $Id: FREE_IMAGE_DITHER.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Dithering algorithms. 40 | /// Constants used in FreeImage_Dither. 41 | /// 42 | public enum FREE_IMAGE_DITHER 43 | { 44 | /// 45 | /// Floyd and Steinberg error diffusion 46 | /// 47 | FID_FS = 0, 48 | /// 49 | /// Bayer ordered dispersed dot dithering (order 2 dithering matrix) 50 | /// 51 | FID_BAYER4x4 = 1, 52 | /// 53 | /// Bayer ordered dispersed dot dithering (order 3 dithering matrix) 54 | /// 55 | FID_BAYER8x8 = 2, 56 | /// 57 | /// Ordered clustered dot dithering (order 3 - 6x6 matrix) 58 | /// 59 | FID_CLUSTER6x6 = 3, 60 | /// 61 | /// Ordered clustered dot dithering (order 4 - 8x8 matrix) 62 | /// 63 | FID_CLUSTER8x8 = 4, 64 | /// 65 | /// Ordered clustered dot dithering (order 8 - 16x16 matrix) 66 | /// 67 | FID_CLUSTER16x16 = 5, 68 | /// 69 | /// Bayer ordered dispersed dot dithering (order 4 dithering matrix) 70 | /// 71 | FID_BAYER16x16 = 6 72 | } 73 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_FILTER.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:39 $ 33 | // $Id: FREE_IMAGE_FILTER.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Upsampling / downsampling filters. Constants used in FreeImage_Rescale. 40 | /// 41 | public enum FREE_IMAGE_FILTER 42 | { 43 | /// 44 | /// Box, pulse, Fourier window, 1st order (constant) b-spline 45 | /// 46 | FILTER_BOX = 0, 47 | /// 48 | /// Mitchell and Netravali's two-param cubic filter 49 | /// 50 | FILTER_BICUBIC = 1, 51 | /// 52 | /// Bilinear filter 53 | /// 54 | FILTER_BILINEAR = 2, 55 | /// 56 | /// 4th order (cubic) b-spline 57 | /// 58 | FILTER_BSPLINE = 3, 59 | /// 60 | /// Catmull-Rom spline, Overhauser spline 61 | /// 62 | FILTER_CATMULLROM = 4, 63 | /// 64 | /// Lanczos3 filter 65 | /// 66 | FILTER_LANCZOS3 = 5 67 | } 68 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_JPEG_OPERATION.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:38 $ 33 | // $Id: FREE_IMAGE_JPEG_OPERATION.cs,v 1.1 2007/11/28 15:33:38 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Lossless JPEG transformations constants used in FreeImage_JPEGTransform. 40 | /// 41 | public enum FREE_IMAGE_JPEG_OPERATION 42 | { 43 | /// 44 | /// no transformation 45 | /// 46 | FIJPEG_OP_NONE = 0, 47 | /// 48 | /// horizontal flip 49 | /// 50 | FIJPEG_OP_FLIP_H = 1, 51 | /// 52 | /// vertical flip 53 | /// 54 | FIJPEG_OP_FLIP_V = 2, 55 | /// 56 | /// transpose across UL-to-LR axis 57 | /// 58 | FIJPEG_OP_TRANSPOSE = 3, 59 | /// 60 | /// transpose across UR-to-LL axis 61 | /// 62 | FIJPEG_OP_TRANSVERSE = 4, 63 | /// 64 | /// 90-degree clockwise rotation 65 | /// 66 | FIJPEG_OP_ROTATE_90 = 5, 67 | /// 68 | /// 180-degree rotation 69 | /// 70 | FIJPEG_OP_ROTATE_180 = 6, 71 | /// 72 | /// 270-degree clockwise (or 90 ccw) 73 | /// 74 | FIJPEG_OP_ROTATE_270 = 7 75 | } 76 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_LOAD_FLAGS.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.2 $ 32 | // $Date: 2009/09/15 11:45:16 $ 33 | // $Id: FREE_IMAGE_LOAD_FLAGS.cs,v 1.2 2009/09/15 11:45:16 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Flags used in load functions. 40 | /// 41 | [System.Flags] 42 | public enum FREE_IMAGE_LOAD_FLAGS 43 | { 44 | /// 45 | /// Default option for all types. 46 | /// 47 | DEFAULT = 0, 48 | /// 49 | /// Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color. 50 | /// 51 | GIF_LOAD256 = 1, 52 | /// 53 | /// 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading. 54 | /// 55 | GIF_PLAYBACK = 2, 56 | /// 57 | /// Convert to 32bpp and create an alpha channel from the AND-mask when loading. 58 | /// 59 | ICO_MAKEALPHA = 1, 60 | /// 61 | /// Load the file as fast as possible, sacrificing some quality. 62 | /// 63 | JPEG_FAST = 0x0001, 64 | /// 65 | /// Load the file with the best quality, sacrificing some speed. 66 | /// 67 | JPEG_ACCURATE = 0x0002, 68 | /// 69 | /// Load separated CMYK "as is" (use | to combine with other load flags). 70 | /// 71 | JPEG_CMYK = 0x0004, 72 | /// 73 | /// Load and rotate according to Exif 'Orientation' tag if available. 74 | /// 75 | JPEG_EXIFROTATE = 0x0008, 76 | /// 77 | /// Load the bitmap sized 768 x 512. 78 | /// 79 | PCD_BASE = 1, 80 | /// 81 | /// Load the bitmap sized 384 x 256. 82 | /// 83 | PCD_BASEDIV4 = 2, 84 | /// 85 | /// Load the bitmap sized 192 x 128. 86 | /// 87 | PCD_BASEDIV16 = 3, 88 | /// 89 | /// Avoid gamma correction. 90 | /// 91 | PNG_IGNOREGAMMA = 1, 92 | /// 93 | /// If set the loader converts RGB555 and ARGB8888 -> RGB888. 94 | /// 95 | TARGA_LOAD_RGB888 = 1, 96 | /// 97 | /// Reads tags for separated CMYK. 98 | /// 99 | TIFF_CMYK = 0x0001, 100 | /// 101 | /// Tries to load the JPEG preview image, embedded in 102 | /// Exif Metadata or load the image as RGB 24-bit if no 103 | /// preview image is available. 104 | /// 105 | RAW_PREVIEW = 0x1, 106 | /// 107 | /// Loads the image as RGB 24-bit. 108 | /// 109 | RAW_DISPLAY = 0x2, 110 | } 111 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_MDMODEL.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:39 $ 33 | // $Id: FREE_IMAGE_MDMODEL.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Metadata models supported by FreeImage. 40 | /// 41 | public enum FREE_IMAGE_MDMODEL 42 | { 43 | /// 44 | /// No data 45 | /// 46 | FIMD_NODATA = -1, 47 | /// 48 | /// single comment or keywords 49 | /// 50 | FIMD_COMMENTS = 0, 51 | /// 52 | /// Exif-TIFF metadata 53 | /// 54 | FIMD_EXIF_MAIN = 1, 55 | /// 56 | /// Exif-specific metadata 57 | /// 58 | FIMD_EXIF_EXIF = 2, 59 | /// 60 | /// Exif GPS metadata 61 | /// 62 | FIMD_EXIF_GPS = 3, 63 | /// 64 | /// Exif maker note metadata 65 | /// 66 | FIMD_EXIF_MAKERNOTE = 4, 67 | /// 68 | /// Exif interoperability metadata 69 | /// 70 | FIMD_EXIF_INTEROP = 5, 71 | /// 72 | /// IPTC/NAA metadata 73 | /// 74 | FIMD_IPTC = 6, 75 | /// 76 | /// Abobe XMP metadata 77 | /// 78 | FIMD_XMP = 7, 79 | /// 80 | /// GeoTIFF metadata 81 | /// 82 | FIMD_GEOTIFF = 8, 83 | /// 84 | /// Animation metadata 85 | /// 86 | FIMD_ANIMATION = 9, 87 | /// 88 | /// Used to attach other metadata types to a dib 89 | /// 90 | FIMD_CUSTOM = 10 91 | } 92 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_MDTYPE.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:39 $ 33 | // $Id: FREE_IMAGE_MDTYPE.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Tag data type information (based on TIFF specifications) 40 | /// Note: RATIONALs are the ratio of two 32-bit integer values. 41 | /// 42 | public enum FREE_IMAGE_MDTYPE 43 | { 44 | /// 45 | /// placeholder 46 | /// 47 | FIDT_NOTYPE = 0, 48 | /// 49 | /// 8-bit unsigned integer 50 | /// 51 | FIDT_BYTE = 1, 52 | /// 53 | /// 8-bit bytes w/ last byte null 54 | /// 55 | FIDT_ASCII = 2, 56 | /// 57 | /// 16-bit unsigned integer 58 | /// 59 | FIDT_SHORT = 3, 60 | /// 61 | /// 32-bit unsigned integer 62 | /// 63 | FIDT_LONG = 4, 64 | /// 65 | /// 64-bit unsigned fraction 66 | /// 67 | FIDT_RATIONAL = 5, 68 | /// 69 | /// 8-bit signed integer 70 | /// 71 | FIDT_SBYTE = 6, 72 | /// 73 | /// 8-bit untyped data 74 | /// 75 | FIDT_UNDEFINED = 7, 76 | /// 77 | /// 16-bit signed integer 78 | /// 79 | FIDT_SSHORT = 8, 80 | /// 81 | /// 32-bit signed integer 82 | /// 83 | FIDT_SLONG = 9, 84 | /// 85 | /// 64-bit signed fraction 86 | /// 87 | FIDT_SRATIONAL = 10, 88 | /// 89 | /// 32-bit IEEE floating point 90 | /// 91 | FIDT_FLOAT = 11, 92 | /// 93 | /// 64-bit IEEE floating point 94 | /// 95 | FIDT_DOUBLE = 12, 96 | /// 97 | /// 32-bit unsigned integer (offset) 98 | /// 99 | FIDT_IFD = 13, 100 | /// 101 | /// 32-bit RGBQUAD 102 | /// 103 | FIDT_PALETTE = 14 104 | } 105 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_METADATA_COPY.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:39 $ 33 | // $Id: FREE_IMAGE_METADATA_COPY.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Flags for copying data from a bitmap to another. 40 | /// 41 | public enum FREE_IMAGE_METADATA_COPY 42 | { 43 | /// 44 | /// Exisiting metadata will remain unchanged. 45 | /// 46 | KEEP_EXISITNG = 0x0, 47 | /// 48 | /// Existing metadata will be cleared. 49 | /// 50 | CLEAR_EXISTING = 0x1, 51 | /// 52 | /// Existing metadata will be overwritten. 53 | /// 54 | REPLACE_EXISTING = 0x2 55 | } 56 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_QUANTIZE.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:39 $ 33 | // $Id: FREE_IMAGE_QUANTIZE.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Color quantization algorithms. 40 | /// Constants used in FreeImage_ColorQuantize. 41 | /// 42 | public enum FREE_IMAGE_QUANTIZE 43 | { 44 | /// 45 | /// Xiaolin Wu color quantization algorithm 46 | /// 47 | FIQ_WUQUANT = 0, 48 | /// 49 | /// NeuQuant neural-net quantization algorithm by Anthony Dekker 50 | /// 51 | FIQ_NNQUANT = 1 52 | } 53 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_TMO.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:39 $ 33 | // $Id: FREE_IMAGE_TMO.cs,v 1.1 2007/11/28 15:33:39 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Tone mapping operators. Constants used in FreeImage_ToneMapping. 40 | /// 41 | public enum FREE_IMAGE_TMO 42 | { 43 | /// 44 | /// Adaptive logarithmic mapping (F. Drago, 2003) 45 | /// 46 | FITMO_DRAGO03 = 0, 47 | /// 48 | /// Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) 49 | /// 50 | FITMO_REINHARD05 = 1, 51 | /// 52 | /// Gradient domain high dynamic range compression (R. Fattal, 2002) 53 | /// 54 | FITMO_FATTAL02 55 | } 56 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/FREE_IMAGE_TYPE.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:40 $ 33 | // $Id: FREE_IMAGE_TYPE.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Image types used in FreeImage. 40 | /// 41 | public enum FREE_IMAGE_TYPE 42 | { 43 | /// 44 | /// unknown type 45 | /// 46 | FIT_UNKNOWN = 0, 47 | /// 48 | /// standard image : 1-, 4-, 8-, 16-, 24-, 32-bit 49 | /// 50 | FIT_BITMAP = 1, 51 | /// 52 | /// array of unsigned short : unsigned 16-bit 53 | /// 54 | FIT_UINT16 = 2, 55 | /// 56 | /// array of short : signed 16-bit 57 | /// 58 | FIT_INT16 = 3, 59 | /// 60 | /// array of unsigned long : unsigned 32-bit 61 | /// 62 | FIT_UINT32 = 4, 63 | /// 64 | /// array of long : signed 32-bit 65 | /// 66 | FIT_INT32 = 5, 67 | /// 68 | /// array of float : 32-bit IEEE floating point 69 | /// 70 | FIT_FLOAT = 6, 71 | /// 72 | /// array of double : 64-bit IEEE floating point 73 | /// 74 | FIT_DOUBLE = 7, 75 | /// 76 | /// array of FICOMPLEX : 2 x 64-bit IEEE floating point 77 | /// 78 | FIT_COMPLEX = 8, 79 | /// 80 | /// 48-bit RGB image : 3 x 16-bit 81 | /// 82 | FIT_RGB16 = 9, 83 | /// 84 | /// 64-bit RGBA image : 4 x 16-bit 85 | /// 86 | FIT_RGBA16 = 10, 87 | /// 88 | /// 96-bit RGB float image : 3 x 32-bit IEEE floating point 89 | /// 90 | FIT_RGBF = 11, 91 | /// 92 | /// 128-bit RGBA float image : 4 x 32-bit IEEE floating point 93 | /// 94 | FIT_RGBAF = 12 95 | } 96 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/ICC_FLAGS.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:38 $ 33 | // $Id: ICC_FLAGS.cs,v 1.1 2007/11/28 15:33:38 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// Flags for ICC profiles. 40 | /// 41 | [System.Flags] 42 | public enum ICC_FLAGS : ushort 43 | { 44 | /// 45 | /// Default value. 46 | /// 47 | FIICC_DEFAULT = 0x00, 48 | /// 49 | /// The color is CMYK. 50 | /// 51 | FIICC_COLOR_IS_CMYK = 0x01 52 | } 53 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Enumerations/MD_SEARCH_FLAGS.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.1 $ 32 | // $Date: 2007/11/28 15:33:40 $ 33 | // $Id: MD_SEARCH_FLAGS.cs,v 1.1 2007/11/28 15:33:40 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | namespace FreeImageAPI 37 | { 38 | /// 39 | /// List different search modes. 40 | /// 41 | [System.Flags] 42 | public enum MD_SEARCH_FLAGS 43 | { 44 | /// 45 | /// The key of the metadata. 46 | /// 47 | KEY = 0x1, 48 | /// 49 | /// The description of the metadata 50 | /// 51 | DESCRIPTION = 0x2, 52 | /// 53 | /// The ToString value of the metadata 54 | /// 55 | TOSTRING = 0x4, 56 | } 57 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/FreeImageException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace FreeImageAPI 4 | { 5 | public class FreeImageException : Exception 6 | { 7 | public FreeImageException() 8 | : this(FreeImageEngine.LastErrorMessage) 9 | { 10 | } 11 | 12 | public FreeImageException(string message) 13 | : this(message, null) 14 | { 15 | } 16 | 17 | public FreeImageException(string message, Exception innerException) 18 | : base(message, innerException) 19 | { 20 | } 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/FreeImageStaticImports.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/FreeImage-dotnet-core/FreeImageStaticImports.cs -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/FreeImageWrapper.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/FreeImage-dotnet-core/FreeImageWrapper.cs -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/PackageTargets/FreeImage-dotnet-core.targets: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("UnitTest")] 4 | -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Structs/BITMAP.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.2 $ 32 | // $Date: 2008/06/16 15:15:36 $ 33 | // $Id: BITMAP.cs,v 1.2 2008/06/16 15:15:36 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | using System; 37 | using System.Runtime.InteropServices; 38 | 39 | namespace FreeImageAPI 40 | { 41 | /// 42 | /// The BITMAP structure defines the type, width, height, color format, and bit values of a bitmap. 43 | /// 44 | /// 45 | /// The bitmap formats currently used are monochrome and color. The monochrome bitmap uses a one-bit, 46 | /// one-plane format. Each scan is a multiple of 32 bits. 47 | /// 48 | /// Scans are organized as follows for a monochrome bitmap of height n: 49 | /// 50 | /// 51 | /// Scan 0 52 | /// Scan 1 53 | /// . 54 | /// . 55 | /// . 56 | /// Scan n-2 57 | /// Scan n-1 58 | /// 59 | /// 60 | /// The pixels on a monochrome device are either black or white. If the corresponding bit in the 61 | /// bitmap is 1, the pixel is set to the foreground color; if the corresponding bit in the bitmap 62 | /// is zero, the pixel is set to the background color. 63 | /// 64 | /// All devices that have the RC_BITBLT device capability support bitmaps. For more information, 65 | /// see GetDeviceCaps. 66 | /// 67 | /// Each device has a unique color format. To transfer a bitmap from one device to another, 68 | /// use the GetDIBits and SetDIBits functions. 69 | /// 70 | #if NET462 || NET461 || NET46 || NET452 || NET451 || NET45 || NET40 || NET35 || NET20 71 | [Serializable, StructLayout(LayoutKind.Sequential)] 72 | #else 73 | [StructLayout(LayoutKind.Sequential)] 74 | #endif 75 | public struct BITMAP 76 | { 77 | /// 78 | /// Specifies the bitmap type. This member must be zero. 79 | /// 80 | public int bmType; 81 | /// 82 | /// Specifies the width, in pixels, of the bitmap. The width must be greater than zero. 83 | /// 84 | public int bmWidth; 85 | /// 86 | /// Specifies the height, in pixels, of the bitmap. The height must be greater than zero. 87 | /// 88 | public int bmHeight; 89 | /// 90 | /// Specifies the number of bytes in each scan line. This value must be divisible by 2, 91 | /// because the system assumes that the bit values of a bitmap form an array that is word aligned. 92 | /// 93 | public int bmWidthBytes; 94 | /// 95 | /// Specifies the count of color planes. 96 | /// 97 | public ushort bmPlanes; 98 | /// 99 | /// Specifies the number of bits required to indicate the color of a pixel. 100 | /// 101 | public ushort bmBitsPixel; 102 | /// 103 | /// Pointer to the location of the bit values for the bitmap. 104 | /// The bmBits member must be a long pointer to an array of character (1-byte) values. 105 | /// 106 | public IntPtr bmBits; 107 | } 108 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Structs/FI1BIT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Diagnostics; 5 | 6 | namespace FreeImageAPI 7 | { 8 | /// 9 | /// The FI1BIT structure represents a single bit. 10 | /// It's value can be 0 or 1. 11 | /// 12 | #if NET462 || NET461 || NET46 || NET452 || NET451 || NET45 || NET40 || NET35 || NET20 13 | [DebuggerDisplay("{value}"), 14 | Serializable] 15 | #else 16 | [DebuggerDisplay("{value}")] 17 | #endif 18 | public struct FI1BIT 19 | { 20 | /// 21 | /// Represents the largest possible value of . This field is constant. 22 | /// 23 | public const byte MaxValue = 0x01; 24 | 25 | /// 26 | /// Represents the smallest possible value of . This field is constant. 27 | /// 28 | public const byte MinValue = 0x00; 29 | 30 | /// 31 | /// The value of the structure. 32 | /// 33 | private byte value; 34 | 35 | /// 36 | /// Initializes a new instance based on the specified value. 37 | /// 38 | /// The value to initialize with. 39 | private FI1BIT(byte value) 40 | { 41 | this.value = (byte)(value & MaxValue); 42 | } 43 | 44 | /// 45 | /// Converts the value of a structure to a structure. 46 | /// 47 | /// A structure. 48 | /// A new instance of initialized to . 49 | public static implicit operator byte(FI1BIT value) 50 | { 51 | return value.value; 52 | } 53 | 54 | /// 55 | /// Converts the value of a structure to a structure. 56 | /// 57 | /// A structure. 58 | /// A new instance of initialized to . 59 | public static implicit operator FI1BIT(byte value) 60 | { 61 | return new FI1BIT(value); 62 | } 63 | 64 | /// 65 | /// Converts the numeric value of the object 66 | /// to its equivalent string representation. 67 | /// 68 | /// The string representation of the value of this instance. 69 | public override string ToString() 70 | { 71 | return value.ToString(); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Structs/FI4BIT.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Diagnostics; 5 | 6 | namespace FreeImageAPI 7 | { 8 | /// 9 | /// The FI4BIT structure represents the half of a . 10 | /// It's valuerange is between 0 and 15. 11 | /// 12 | #if NET462 || NET461 || NET46 || NET452 || NET451 || NET45 || NET40 || NET35 || NET20 13 | [DebuggerDisplay("{value}"), 14 | Serializable] 15 | #else 16 | [DebuggerDisplay("{value}")] 17 | #endif 18 | public struct FI4BIT 19 | { 20 | /// 21 | /// Represents the largest possible value of . This field is constant. 22 | /// 23 | public const byte MaxValue = 0x0F; 24 | 25 | /// 26 | /// Represents the smallest possible value of . This field is constant. 27 | /// 28 | public const byte MinValue = 0x00; 29 | 30 | /// 31 | /// The value of the structure. 32 | /// 33 | private byte value; 34 | 35 | /// 36 | /// Initializes a new instance based on the specified value. 37 | /// 38 | /// The value to initialize with. 39 | private FI4BIT(byte value) 40 | { 41 | this.value = (byte)(value & MaxValue); 42 | } 43 | 44 | /// 45 | /// Converts the value of a structure to a structure. 46 | /// 47 | /// A structure. 48 | /// A new instance of initialized to . 49 | public static implicit operator byte(FI4BIT value) 50 | { 51 | return value.value; 52 | } 53 | 54 | /// 55 | /// Converts the value of a structure to a structure. 56 | /// 57 | /// A structure. 58 | /// A new instance of initialized to . 59 | public static implicit operator FI4BIT(byte value) 60 | { 61 | return new FI4BIT(value); 62 | } 63 | 64 | /// 65 | /// Converts the numeric value of the object 66 | /// to its equivalent string representation. 67 | /// 68 | /// The string representation of the value of this instance. 69 | public override string ToString() 70 | { 71 | return value.ToString(); 72 | } 73 | } 74 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Structs/FIICCPROFILE.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.5 $ 32 | // $Date: 2008/11/05 13:19:06 $ 33 | // $Id: FIICCPROFILE.cs,v 1.5 2008/11/05 13:19:06 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | using System; 37 | using System.Runtime.InteropServices; 38 | 39 | namespace FreeImageAPI 40 | { 41 | /// 42 | /// This Structure contains ICC-Profile data. 43 | /// 44 | #if NET462 || NET461 || NET46 || NET452 || NET451 || NET45 || NET40 || NET35 || NET20 45 | [Serializable, StructLayout(LayoutKind.Sequential)] 46 | #else 47 | [StructLayout(LayoutKind.Sequential)] 48 | #endif 49 | public struct FIICCPROFILE 50 | { 51 | private ICC_FLAGS flags; 52 | private uint size; 53 | private IntPtr data; 54 | 55 | /// 56 | /// Creates a new ICC-Profile for . 57 | /// 58 | /// Handle to a FreeImage bitmap. 59 | /// The ICC-Profile data. 60 | /// 61 | /// is null. 62 | public FIICCPROFILE(FIBITMAP dib, byte[] data) 63 | : this(dib, data, (int)data.Length) 64 | { 65 | } 66 | 67 | /// 68 | /// Creates a new ICC-Profile for . 69 | /// 70 | /// Handle to a FreeImage bitmap. 71 | /// The ICC-Profile data. 72 | /// Number of bytes to use from data. 73 | /// 74 | /// is null. 75 | public unsafe FIICCPROFILE(FIBITMAP dib, byte[] data, int size) 76 | { 77 | if (dib.IsNull) 78 | { 79 | throw new ArgumentNullException("dib"); 80 | } 81 | FIICCPROFILE prof; 82 | size = Math.Min(size, (int)data.Length); 83 | prof = *(FIICCPROFILE*)FreeImage.CreateICCProfile(dib, data, size); 84 | this.flags = prof.flags; 85 | this.size = prof.size; 86 | this.data = prof.data; 87 | } 88 | 89 | /// 90 | /// Info flag of the profile. 91 | /// 92 | public ICC_FLAGS Flags 93 | { 94 | get { return flags; } 95 | } 96 | 97 | /// 98 | /// Profile's size measured in bytes. 99 | /// 100 | public uint Size 101 | { 102 | get { return size; } 103 | } 104 | 105 | /// 106 | /// Points to a block of contiguous memory containing the profile. 107 | /// 108 | public IntPtr DataPointer 109 | { 110 | get { return data; } 111 | } 112 | 113 | /// 114 | /// Copy of the ICC-Profiles data. 115 | /// 116 | public unsafe byte[] Data 117 | { 118 | get 119 | { 120 | byte[] result; 121 | FreeImage.CopyMemory(result = new byte[size], data.ToPointer(), size); 122 | return result; 123 | } 124 | } 125 | 126 | /// 127 | /// Indicates whether the profile is CMYK. 128 | /// 129 | public bool IsCMYK 130 | { 131 | get 132 | { 133 | return ((flags & ICC_FLAGS.FIICC_COLOR_IS_CMYK) != 0); 134 | } 135 | } 136 | } 137 | } -------------------------------------------------------------------------------- /src/FreeImage-dotnet-core/Structs/FreeImageIO.cs: -------------------------------------------------------------------------------- 1 | // ========================================================== 2 | // FreeImage 3 .NET wrapper 3 | // Original FreeImage 3 functions and .NET compatible derived functions 4 | // 5 | // Design and implementation by 6 | // - Jean-Philippe Goerke (jpgoerke@users.sourceforge.net) 7 | // - Carsten Klein (cklein05@users.sourceforge.net) 8 | // 9 | // Contributors: 10 | // - David Boland (davidboland@vodafone.ie) 11 | // 12 | // Main reference : MSDN Knowlede Base 13 | // 14 | // This file is part of FreeImage 3 15 | // 16 | // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 17 | // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 18 | // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 19 | // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 20 | // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 21 | // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 22 | // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 23 | // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 24 | // THIS DISCLAIMER. 25 | // 26 | // Use at your own risk! 27 | // ========================================================== 28 | 29 | // ========================================================== 30 | // CVS 31 | // $Revision: 1.3 $ 32 | // $Date: 2008/06/17 13:49:23 $ 33 | // $Id: FreeImageIO.cs,v 1.3 2008/06/17 13:49:23 cklein05 Exp $ 34 | // ========================================================== 35 | 36 | using System.Runtime.InteropServices; 37 | 38 | namespace FreeImageAPI.IO 39 | { 40 | /// 41 | /// Structure for implementing access to custom handles. 42 | /// 43 | [StructLayout(LayoutKind.Sequential)] 44 | public struct FreeImageIO 45 | { 46 | /// 47 | /// Delegate to the C++ function fread. 48 | /// 49 | public ReadProc readProc; 50 | 51 | /// 52 | /// Delegate to the C++ function fwrite. 53 | /// 54 | public WriteProc writeProc; 55 | 56 | /// 57 | /// Delegate to the C++ function fseek. 58 | /// 59 | public SeekProc seekProc; 60 | 61 | /// 62 | /// Delegate to the C++ function ftell. 63 | /// 64 | public TellProc tellProc; 65 | } 66 | } -------------------------------------------------------------------------------- /src/Samples/Sample 01 - Loading and saving/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("ac0569fe-c021-4f40-bfe9-275baf0fd21a")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/Samples/Sample 01 - Loading and saving/Sample 01 - Loading and saving.2005.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {0D294AB6-FAD4-4364-AAB6-43C1796116A9} 8 | Exe 9 | Properties 10 | Sample01 11 | Sample01 12 | 13 | 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | false 24 | true 25 | 26 | 27 | none 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | false 34 | true 35 | 36 | 37 | true 38 | bin\Debug\ 39 | DEBUG;TRACE 40 | true 41 | full 42 | x86 43 | false 44 | prompt 45 | 46 | 47 | bin\Release\ 48 | TRACE 49 | true 50 | true 51 | 52 | 53 | x86 54 | false 55 | prompt 56 | 57 | 58 | true 59 | bin\Debug\ 60 | DEBUG;TRACE 61 | true 62 | full 63 | x64 64 | false 65 | prompt 66 | 67 | 68 | bin\Release\ 69 | TRACE 70 | true 71 | true 72 | 73 | 74 | x64 75 | false 76 | prompt 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | Always 89 | 90 | 91 | 92 | 93 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 94 | Library 95 | 96 | 97 | 98 | 105 | -------------------------------------------------------------------------------- /src/Samples/Sample 01 - Loading and saving/Sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/Samples/Sample 01 - Loading and saving/Sample.jpg -------------------------------------------------------------------------------- /src/Samples/Sample 02 - Multipaged bitmaps/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using FreeImageAPI; 4 | 5 | namespace Sample02 6 | { 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | // Check if FreeImage.dll is available (can be in %path%). 12 | if (!FreeImage.IsAvailable()) 13 | { 14 | Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); 15 | return; 16 | } 17 | 18 | Sample sample = new Sample(); 19 | sample.Example(); 20 | } 21 | } 22 | 23 | public class Sample 24 | { 25 | const string fileName = @"multipaged.tif"; 26 | FIMULTIBITMAP dib = new FIMULTIBITMAP(); 27 | Random rand = new Random(); 28 | 29 | public void Example() 30 | { 31 | if (!File.Exists(fileName)) 32 | { 33 | Console.WriteLine("File not found. Aborting."); 34 | return; 35 | } 36 | 37 | // Load the multipaged bitmap. 38 | // 'OpenMultiBitmapEx' tries to find the correct file format, loads the bitmap 39 | // with default options, with write support and does not use caching. 40 | dib = FreeImage.OpenMultiBitmapEx(fileName); 41 | 42 | // Check whether loading succeeded. 43 | if (dib.IsNull) 44 | { 45 | Console.WriteLine("File could not be loaded. Aborting."); 46 | return; 47 | } 48 | 49 | // Get the number of bitmaps the multipaged bitmap contains. 50 | int count = FreeImage.GetPageCount(dib); 51 | 52 | // Multipaged bitmaps consist of multiple single FIBITMAPs 53 | FIBITMAP page = new FIBITMAP(); 54 | 55 | // There are bitmaps we can work with. 56 | if (count > 0) 57 | { 58 | // Lock a random bitmap to work with. 59 | page = FreeImage.LockPage(dib, rand.Next(0, count)); 60 | } 61 | 62 | // Check whether locking succeeded. 63 | if (page.IsNull) 64 | { 65 | // Locking failed. Unload the bitmap and return. 66 | FreeImage.CloseMultiBitmapEx(ref dib); 67 | return; 68 | } 69 | 70 | // Get a list of locked pages. This can be usefull to check whether a page has already been locked. 71 | int[] lockedPages = FreeImage.GetLockedPages(dib); 72 | 73 | // Lets modify the page. 74 | if (FreeImage.AdjustGamma(page, 2d)) 75 | { 76 | Console.WriteLine("Successfully changed gamma of page {0}.", lockedPages[0]); 77 | } 78 | else 79 | { 80 | Console.WriteLine("Failed to adjust gamma ..."); 81 | } 82 | 83 | // Print out the list of locked pages 84 | foreach (int i in lockedPages) 85 | Console.WriteLine("Page {0} is locked.", i); 86 | 87 | // Use 'UnlockPage' instead of 'Unload' to free the page. Set the third parameter to 'true' 88 | // so that FreeImage can store the changed page within the multipaged bitmap. 89 | FreeImage.UnlockPage(dib, page, true); 90 | 91 | // Retieve the list again to see whether unlocking succeeded. 92 | lockedPages = FreeImage.GetLockedPages(dib); 93 | 94 | // No output should be produced here. 95 | foreach (int i in lockedPages) 96 | Console.WriteLine("Page {0} is still locked.", i); 97 | 98 | // If there are more than one page we can swap them 99 | if (count > 1) 100 | { 101 | if (!FreeImage.MovePage(dib, 1, 0)) 102 | { 103 | Console.WriteLine("Swapping pages failed."); 104 | } 105 | } 106 | 107 | if (count > 2) 108 | { 109 | // Lock page 2 110 | page = FreeImage.LockPage(dib, 2); 111 | if (!page.IsNull) 112 | { 113 | // Clone the page for later appending 114 | FIBITMAP temp = FreeImage.Clone(page); 115 | 116 | // Unlock the page again 117 | FreeImage.UnlockPage(dib, page, false); 118 | 119 | // Delete the page form the multipaged bitmap 120 | FreeImage.DeletePage(dib, 2); 121 | 122 | // Append the clone again 123 | FreeImage.AppendPage(dib, temp); 124 | 125 | // Check whether the number of pages is still the same 126 | Console.WriteLine("Pages before: {0}. Pages after: {1}", count, FreeImage.GetPageCount(dib)); 127 | 128 | // Unload clone to prevent memory leak 129 | FreeImage.UnloadEx(ref temp); 130 | } 131 | } 132 | 133 | // We are done and close the multipaged bitmap. 134 | if (!FreeImage.CloseMultiBitmapEx(ref dib)) 135 | { 136 | Console.WriteLine("Closing bitmap failed!"); 137 | } 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /src/Samples/Sample 02 - Multipaged bitmaps/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("35960522-c01a-40d2-a86b-37b9839b131c")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.2005.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B} 8 | Exe 9 | Properties 10 | Sample02 11 | Sample02 12 | 13 | 14 | true 15 | full 16 | false 17 | bin\Debug\ 18 | DEBUG;TRACE 19 | prompt 20 | 4 21 | false 22 | 23 | 24 | none 25 | true 26 | bin\Release\ 27 | TRACE 28 | prompt 29 | 4 30 | false 31 | 32 | 33 | true 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | full 37 | x86 38 | false 39 | prompt 40 | 41 | 42 | bin\Release\ 43 | TRACE 44 | true 45 | 46 | 47 | x86 48 | false 49 | prompt 50 | 51 | 52 | true 53 | bin\Debug\ 54 | DEBUG;TRACE 55 | full 56 | x64 57 | false 58 | prompt 59 | 60 | 61 | bin\Release\ 62 | TRACE 63 | true 64 | 65 | 66 | x64 67 | false 68 | prompt 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Always 81 | 82 | 83 | 84 | 85 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 86 | Library 87 | 88 | 89 | 90 | 97 | -------------------------------------------------------------------------------- /src/Samples/Sample 02 - Multipaged bitmaps/Sample 02 - Multipaged bitmaps.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {AF8B72BD-1A8B-4E6B-A0F1-0BD57497777B} 8 | Exe 9 | Properties 10 | Sample02 11 | Sample02 12 | 13 | 14 | 2.0 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | none 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | true 39 | bin\Debug\ 40 | DEBUG;TRACE 41 | full 42 | x86 43 | false 44 | prompt 45 | 46 | 47 | bin\Release\ 48 | TRACE 49 | true 50 | 51 | 52 | x86 53 | false 54 | prompt 55 | 56 | 57 | true 58 | bin\Debug\ 59 | DEBUG;TRACE 60 | full 61 | x64 62 | false 63 | prompt 64 | 65 | 66 | bin\Release\ 67 | TRACE 68 | true 69 | 70 | 71 | x64 72 | false 73 | prompt 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | Always 86 | 87 | 88 | 89 | 90 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 91 | Library 92 | 93 | 94 | 95 | 102 | -------------------------------------------------------------------------------- /src/Samples/Sample 02 - Multipaged bitmaps/multipaged.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/Samples/Sample 02 - Multipaged bitmaps/multipaged.tif -------------------------------------------------------------------------------- /src/Samples/Sample 03 - Allocating/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using FreeImageAPI; 4 | 5 | namespace Sample03 6 | { 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | // Check if FreeImage.dll is available (can be in %path%). 12 | if (!FreeImage.IsAvailable()) 13 | { 14 | Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); 15 | return; 16 | } 17 | 18 | // Add this class to the message event 19 | FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); 20 | 21 | Sample sample = new Sample(); 22 | sample.Example(); 23 | 24 | // Remove this class from the message event 25 | FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); 26 | } 27 | 28 | static void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) 29 | { 30 | Console.WriteLine("Error for {0}: {1}", fif.ToString(), message); 31 | } 32 | } 33 | 34 | public class Sample 35 | { 36 | FIBITMAP dib = new FIBITMAP(); 37 | 38 | public void Example() 39 | { 40 | // Allocating a new bitmap with 99x99 pixels, 16-bit color depth and an allocation of 5 bits for each color. 41 | dib = FreeImage.Allocate(99, 99, 16, FreeImage.FI16_555_RED_MASK, FreeImage.FI16_555_GREEN_MASK, FreeImage.FI16_555_BLUE_MASK); 42 | 43 | // Saving bitmap. 44 | if (!FreeImage.SaveEx(ref dib, "example01.bmp", true)) 45 | { 46 | Console.WriteLine("Saving 'example.bmp' failed."); 47 | FreeImage.UnloadEx(ref dib); 48 | } 49 | 50 | // Allocation a new bitmap with 71x33 pixels, 4-bit color depth. Bitmaps below 16-bit have paletts. 51 | // Each pixel references an index within the palette wich contains the true color. 52 | // Therefor no bit-masks are needed and can be set to 0. 53 | dib = FreeImage.Allocate(71, 33, 4, 0, 0, 0); 54 | 55 | // Saving bitmap. 56 | if (!FreeImage.SaveEx(ref dib, "example02.tif", true)) 57 | { 58 | Console.WriteLine("Saving 'example02.tif' failed."); 59 | FreeImage.UnloadEx(ref dib); 60 | } 61 | 62 | // Allocation a new bitmap. This time 'AllocateT' is used because 'Allocate' can only create standard bitmaps. 63 | // In this case a RGBF bitmap is created. Red, green and blue are represented by a float-value so no bit-masks are needed. 64 | dib = FreeImage.AllocateT(FREE_IMAGE_TYPE.FIT_RGBF, 50, 75, 9, 0, 0, 0); 65 | 66 | // Saving bitmap. 67 | if (!FreeImage.SaveEx(ref dib, "example03.hdr", true)) 68 | { 69 | Console.WriteLine("Saving 'example03.hdr' failed."); 70 | FreeImage.UnloadEx(ref dib); 71 | } 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/Samples/Sample 03 - Allocating/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("7139f1dc-3312-4c76-aeb3-891f869409b3")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/Samples/Sample 03 - Allocating/Sample 03 - Allocating.2005.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9} 8 | Exe 9 | Properties 10 | Sample03 11 | Sample03 12 | 13 | 14 | true 15 | full 16 | false 17 | bin\Debug\ 18 | DEBUG;TRACE 19 | prompt 20 | 4 21 | false 22 | 23 | 24 | none 25 | true 26 | bin\Release\ 27 | TRACE 28 | prompt 29 | 4 30 | false 31 | 32 | 33 | true 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | full 37 | x86 38 | false 39 | prompt 40 | 41 | 42 | bin\Release\ 43 | TRACE 44 | true 45 | 46 | 47 | x86 48 | false 49 | prompt 50 | 51 | 52 | true 53 | bin\Debug\ 54 | DEBUG;TRACE 55 | full 56 | x64 57 | false 58 | prompt 59 | 60 | 61 | bin\Release\ 62 | TRACE 63 | true 64 | 65 | 66 | x64 67 | false 68 | prompt 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 80 | Library 81 | 82 | 83 | 84 | 91 | -------------------------------------------------------------------------------- /src/Samples/Sample 03 - Allocating/Sample 03 - Allocating.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {A7E452A1-1A43-47C4-8BF3-DA28E1402FB9} 8 | Exe 9 | Properties 10 | Sample03 11 | Sample03 12 | 13 | 14 | 2.0 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | none 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | true 39 | bin\Debug\ 40 | DEBUG;TRACE 41 | full 42 | x86 43 | false 44 | prompt 45 | 46 | 47 | bin\Release\ 48 | TRACE 49 | true 50 | 51 | 52 | x86 53 | false 54 | prompt 55 | 56 | 57 | true 58 | bin\Debug\ 59 | DEBUG;TRACE 60 | full 61 | x64 62 | false 63 | prompt 64 | 65 | 66 | bin\Release\ 67 | TRACE 68 | true 69 | 70 | 71 | x64 72 | false 73 | prompt 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 85 | Library 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /src/Samples/Sample 04 - Getting bitmap informations/MainForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using FreeImageAPI; 4 | 5 | namespace Sample04 6 | { 7 | public partial class MainForm : Form 8 | { 9 | string message = null; 10 | 11 | [STAThread] 12 | static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new MainForm()); 17 | } 18 | 19 | public MainForm() 20 | { 21 | InitializeComponent(); 22 | FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); 23 | } 24 | 25 | ~MainForm() 26 | { 27 | FreeImageEngine.Message -= new OutputMessageFunction(FreeImage_Message); 28 | } 29 | 30 | void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) 31 | { 32 | if (this.message == null) 33 | { 34 | this.message = message; 35 | } 36 | else 37 | { 38 | this.message += "\n" + message; 39 | } 40 | } 41 | 42 | private void bOpenFile_Click(object sender, EventArgs e) 43 | { 44 | // Resetting filename 45 | ofd.FileName = ""; 46 | 47 | // Was a file selected 48 | if (ofd.ShowDialog() == DialogResult.OK) 49 | { 50 | // Format is stored in 'format' on successfull load. 51 | FREE_IMAGE_FORMAT format = FREE_IMAGE_FORMAT.FIF_UNKNOWN; 52 | 53 | // Try loading the file 54 | FIBITMAP dib = FreeImage.LoadEx(ofd.FileName, ref format); 55 | 56 | try 57 | { 58 | // Error handling 59 | if (dib.IsNull) 60 | { 61 | // Chech whether FreeImage generated an error messe 62 | if (message != null) 63 | { 64 | MessageBox.Show("File could not be loaded!\nError:{0}", message); 65 | } 66 | else 67 | { 68 | MessageBox.Show("File could not be loaded!", message); 69 | } 70 | return; 71 | } 72 | 73 | // Read width 74 | lWidth.Text = String.Format("Width: {0}", FreeImage.GetWidth(dib)); 75 | 76 | // Read height 77 | lHeight.Text = String.Format("Height: {0}", FreeImage.GetHeight(dib)); 78 | 79 | // Read color depth 80 | lBPP.Text = String.Format("Color Depth: {0}", FreeImage.GetBPP(dib)); 81 | 82 | // Read red bitmask (16 - 32 bpp) 83 | lRedMask.Text = String.Format("Red Mask: 0x{0:X8}", FreeImage.GetRedMask(dib)); 84 | 85 | // Read green bitmask (16 - 32 bpp) 86 | lBlueMask.Text = String.Format("Green Mask: 0x{0:X8}", FreeImage.GetGreenMask(dib)); 87 | 88 | // Read blue bitmask (16 - 32 bpp) 89 | lGreenMask.Text = String.Format("Blue Mask: 0x{0:X8}", FreeImage.GetBlueMask(dib)); 90 | 91 | // Read image type (FI_BITMAP, FIT_RGB16, FIT_COMPLEX ect) 92 | lImageType.Text = String.Format("Image Type: {0}", FreeImage.GetImageType(dib)); 93 | 94 | // Read x-axis dpi 95 | lDPIX.Text = String.Format("DPI X: {0}", FreeImage.GetResolutionX(dib)); 96 | 97 | // Read y-axis dpi 98 | lDPIY.Text = String.Format("DPI Y: {0}", FreeImage.GetResolutionY(dib)); 99 | 100 | // Read file format 101 | lFormat.Text = String.Format("File Format: {0}", FreeImage.GetFormatFromFIF(format)); 102 | } 103 | catch 104 | { 105 | } 106 | 107 | // Always unload bitmap 108 | FreeImage.UnloadEx(ref dib); 109 | 110 | // Reset the error massage buffer 111 | message = null; 112 | } 113 | // No file was selected 114 | else 115 | { 116 | MessageBox.Show("No file loaded.", "Error"); 117 | } 118 | } 119 | } 120 | } -------------------------------------------------------------------------------- /src/Samples/Sample 04 - Getting bitmap informations/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("7c8fdc9a-a8f9-4996-99c8-9df47513edeb")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/Samples/Sample 04 - Getting bitmap informations/Sample 04 - Getting bitmap informations.2005.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {1F4BCDD7-5BD9-4237-8B14-C52B2A9FF52A} 8 | WinExe 9 | Properties 10 | Sample04 11 | Sample04 12 | 13 | 14 | true 15 | full 16 | false 17 | bin\Debug\ 18 | DEBUG;TRACE 19 | prompt 20 | 4 21 | false 22 | 23 | 24 | none 25 | true 26 | bin\Release\ 27 | TRACE 28 | prompt 29 | 4 30 | false 31 | 32 | 33 | true 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | full 37 | x86 38 | false 39 | prompt 40 | 41 | 42 | bin\Release\ 43 | TRACE 44 | true 45 | 46 | 47 | x86 48 | false 49 | prompt 50 | 51 | 52 | true 53 | bin\Debug\ 54 | DEBUG;TRACE 55 | full 56 | x64 57 | false 58 | prompt 59 | 60 | 61 | bin\Release\ 62 | TRACE 63 | true 64 | 65 | 66 | x64 67 | false 68 | prompt 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | Form 78 | 79 | 80 | MainForm.cs 81 | 82 | 83 | 84 | 85 | 86 | Designer 87 | MainForm.cs 88 | 89 | 90 | 91 | 92 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 93 | Library 94 | 95 | 96 | 97 | 104 | -------------------------------------------------------------------------------- /src/Samples/Sample 05 - Working with pixels/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("fd43331d-5ea4-40f8-86d5-8f820d606912")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.2005.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {A501F134-8FB6-460B-AFE9-884A696C1C07} 8 | Exe 9 | Properties 10 | Sample05 11 | Sample05 12 | 13 | 14 | true 15 | full 16 | false 17 | bin\Debug\ 18 | DEBUG;TRACE 19 | prompt 20 | 4 21 | false 22 | 23 | 24 | none 25 | true 26 | bin\Release\ 27 | TRACE 28 | prompt 29 | 4 30 | false 31 | 32 | 33 | true 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | full 37 | x86 38 | false 39 | prompt 40 | 41 | 42 | bin\Release\ 43 | TRACE 44 | true 45 | 46 | 47 | x86 48 | false 49 | prompt 50 | 51 | 52 | true 53 | bin\Debug\ 54 | DEBUG;TRACE 55 | full 56 | x64 57 | false 58 | prompt 59 | 60 | 61 | bin\Release\ 62 | TRACE 63 | true 64 | 65 | 66 | x64 67 | false 68 | prompt 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | Always 81 | 82 | 83 | Always 84 | 85 | 86 | 87 | 88 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 89 | Library 90 | 91 | 92 | 93 | 100 | -------------------------------------------------------------------------------- /src/Samples/Sample 05 - Working with pixels/Sample 05 - Working with pixels.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {A501F134-8FB6-460B-AFE9-884A696C1C07} 8 | Exe 9 | Properties 10 | Sample05 11 | Sample05 12 | 13 | 14 | 2.0 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | none 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | true 39 | bin\Debug\ 40 | DEBUG;TRACE 41 | full 42 | x86 43 | false 44 | prompt 45 | 46 | 47 | bin\Release\ 48 | TRACE 49 | true 50 | 51 | 52 | x86 53 | false 54 | prompt 55 | 56 | 57 | true 58 | bin\Debug\ 59 | DEBUG;TRACE 60 | full 61 | x64 62 | false 63 | prompt 64 | 65 | 66 | bin\Release\ 67 | TRACE 68 | true 69 | 70 | 71 | x64 72 | false 73 | prompt 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | Always 86 | 87 | 88 | Always 89 | 90 | 91 | 92 | 93 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 94 | Library 95 | 96 | 97 | 98 | 105 | -------------------------------------------------------------------------------- /src/Samples/Sample 05 - Working with pixels/Sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/Samples/Sample 05 - Working with pixels/Sample.jpg -------------------------------------------------------------------------------- /src/Samples/Sample 05 - Working with pixels/Sample.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/Samples/Sample 05 - Working with pixels/Sample.tif -------------------------------------------------------------------------------- /src/Samples/Sample 06 - Converting/MainForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Drawing; 3 | using System.Windows.Forms; 4 | using FreeImageAPI; 5 | using System.Drawing.Imaging; 6 | 7 | namespace Sample06 8 | { 9 | public partial class MainForm : Form 10 | { 11 | [STAThread] 12 | static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new MainForm()); 17 | } 18 | 19 | public MainForm() 20 | { 21 | InitializeComponent(); 22 | } 23 | 24 | private void bExample01_Click(object sender, EventArgs e) 25 | { 26 | // Load bitmap 27 | FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); 28 | 29 | // Check success 30 | if (dib.IsNull) 31 | { 32 | MessageBox.Show("Could not load Sample.jpg", "Error"); 33 | return; 34 | } 35 | 36 | // Check whether bitmap is 24-bit 37 | if (FreeImage.GetBPP(dib) != 24) 38 | { 39 | MessageBox.Show("Sample.jpg is not 24-bit.", "Error"); 40 | FreeImage.UnloadEx(ref dib); 41 | return; 42 | } 43 | 44 | // Convert the 24-bit bitmap to 8-bit and forcing the result will be greyscale 45 | dib = FreeImage.ConvertColorDepth(dib, FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP | FREE_IMAGE_COLOR_DEPTH.FICD_FORCE_GREYSCALE, true); 46 | 47 | if (FreeImage.GetBPP(dib) == 8) 48 | { 49 | // Convert the FreeImage-Bitmap into a .NET bitmap 50 | Bitmap bitmap = FreeImage.GetBitmap(dib); 51 | 52 | // Dispose the bitmap of the pictureBox 53 | if (picBox.Image != null) 54 | { 55 | picBox.Image.Dispose(); 56 | } 57 | 58 | // Assign the bitmap to the picturebox 59 | picBox.Image = bitmap; 60 | } 61 | 62 | // Unload source bitmap 63 | FreeImage.UnloadEx(ref dib); 64 | } 65 | 66 | private void bOriginal_Click(object sender, EventArgs e) 67 | { 68 | // Load bitmap 69 | FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); 70 | 71 | // Check success 72 | if (dib.IsNull) 73 | { 74 | MessageBox.Show("Could not load Sample.jpg", "Error"); 75 | return; 76 | } 77 | 78 | // Convert the FreeImage-Bitmap into a .NET bitmap 79 | Bitmap bitmap = FreeImage.GetBitmap(dib); 80 | 81 | // Check success 82 | if (bitmap != null) 83 | { 84 | // Dispose old bitmap 85 | if (picBox.Image != null) 86 | { 87 | picBox.Image.Dispose(); 88 | } 89 | 90 | // Assign new bitmap 91 | picBox.Image = bitmap; 92 | } 93 | 94 | // Unload bitmap 95 | FreeImage.UnloadEx(ref dib); 96 | } 97 | 98 | private void bExample02_Click(object sender, EventArgs e) 99 | { 100 | FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); 101 | 102 | // Check success 103 | if (dib.IsNull) 104 | { 105 | MessageBox.Show("Could not load Sample.jpg", "Error"); 106 | return; 107 | } 108 | 109 | // Convert bitmap to 8 bit 110 | dib = FreeImage.ConvertColorDepth(dib, FREE_IMAGE_COLOR_DEPTH.FICD_08_BPP, true); 111 | 112 | // Check whether conversion succeeded 113 | if (FreeImage.GetBPP(dib) != 8) 114 | { 115 | MessageBox.Show("Converting Sample.jpg to 8-bit failed.", "Error"); 116 | FreeImage.UnloadEx(ref dib); 117 | return; 118 | } 119 | 120 | // Convert the FreeImage-Bitmap into a .NET bitmap 121 | Bitmap bitmap = FreeImage.GetBitmap(dib); 122 | 123 | // Dispose old bitmap 124 | if (picBox.Image != null) 125 | { 126 | picBox.Image.Dispose(); 127 | } 128 | 129 | // Assign new bitmap 130 | picBox.Image = bitmap; 131 | 132 | // Unload bitmap 133 | FreeImage.UnloadEx(ref dib); 134 | } 135 | 136 | private void bExample03_Click(object sender, EventArgs e) 137 | { 138 | // Load bitmap 139 | Bitmap bitmap = (Bitmap)Bitmap.FromFile("Sample.jpg"); 140 | 141 | // Convert the .NET bitmap into a FreeImage-Bitmap 142 | FIBITMAP dib = FreeImage.CreateFromBitmap(bitmap); 143 | 144 | // Unload bitmap 145 | bitmap.Dispose(); 146 | 147 | // Rescale the bitmap 148 | FIBITMAP temp = FreeImage.Rescale(dib, 300, 300, FREE_IMAGE_FILTER.FILTER_BICUBIC); 149 | 150 | // Unload bitmap 151 | FreeImage.UnloadEx(ref dib); 152 | 153 | Random rand = new Random(); 154 | 155 | // Rotate the bitmap 156 | dib = FreeImage.Rotate(temp, rand.NextDouble() * 360d); 157 | 158 | // Unload bitmap 159 | FreeImage.UnloadEx(ref temp); 160 | 161 | // Convert the FreeImage-Bitmap into a .NET bitmap 162 | bitmap = FreeImage.GetBitmap(dib); 163 | 164 | // Unload bitmap 165 | FreeImage.UnloadEx(ref dib); 166 | 167 | // Unload bitmap 168 | if (picBox.Image != null) 169 | { 170 | picBox.Image.Dispose(); 171 | } 172 | 173 | // Assign new bitmap 174 | picBox.Image = bitmap; 175 | } 176 | } 177 | } -------------------------------------------------------------------------------- /src/Samples/Sample 06 - Converting/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("69a8cbdd-43da-49e3-8d0b-2680c4ca2851")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/Samples/Sample 06 - Converting/Sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/Samples/Sample 06 - Converting/Sample.jpg -------------------------------------------------------------------------------- /src/Samples/Sample 07 - ICC Profiles/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using FreeImageAPI; 4 | 5 | namespace Sample07 6 | { 7 | class Program 8 | { 9 | static void Main(string[] args) 10 | { 11 | // Check if FreeImage.dll is available (can be in %path%). 12 | if (!FreeImage.IsAvailable()) 13 | { 14 | Console.WriteLine("FreeImage.dll seems to be missing. Aborting."); 15 | return; 16 | } 17 | 18 | Sample sample = new Sample(); 19 | // This example shows how to work with ICC-Profiles. 20 | sample.Example(); 21 | } 22 | } 23 | 24 | public class Sample 25 | { 26 | public void Example() 27 | { 28 | // Load the sample bitmap. 29 | FIBITMAP dib = FreeImage.LoadEx("Sample.jpg"); 30 | 31 | // Check success 32 | if (dib.IsNull) 33 | { 34 | Console.WriteLine("Sample.jpg could not be loaded. Aborting."); 35 | return; 36 | } 37 | 38 | // Get the bitmaps ICC-Profile. 39 | FIICCPROFILE icc = FreeImage.GetICCProfileEx(dib); 40 | 41 | // Print the profiles address. 42 | Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); 43 | 44 | // Print the profiles size 45 | Console.WriteLine("The profiles size is : {0} bytes", icc.Size); 46 | 47 | // Create data for a new profile. 48 | byte[] data = new byte[256]; 49 | for (int i = 0; i < data.Length; i++) 50 | data[i] = (byte)i; 51 | 52 | // Create the new profile 53 | icc = new FIICCPROFILE(dib, data); 54 | 55 | Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); 56 | Console.WriteLine("The profiles size is : {0} bytes", icc.Size); 57 | 58 | // Create the new profile but only use the first 64 bytes 59 | icc = new FIICCPROFILE(dib, data, 64); 60 | 61 | Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); 62 | Console.WriteLine("The profiles size is : {0} bytes", icc.Size); 63 | 64 | // CreateICCProfileEx(...) does the same as above 65 | icc = FreeImage.CreateICCProfileEx(dib, data, 16); 66 | 67 | Console.WriteLine("The profiles memory-address is : 0x{0}", icc.DataPointer.ToString("X")); 68 | Console.WriteLine("The profiles size is : {0} bytes", icc.Size); 69 | 70 | FreeImage.UnloadEx(ref dib); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/Samples/Sample 07 - ICC Profiles/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("c9991d1d-684a-4736-b088-369a216b35b6")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.2005.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {3B1BB976-64A7-41FD-B7E2-59104161AF7E} 8 | Exe 9 | Properties 10 | Sample07 11 | Sample07 12 | 13 | 14 | true 15 | full 16 | false 17 | bin\Debug\ 18 | DEBUG;TRACE 19 | prompt 20 | 4 21 | false 22 | 23 | 24 | none 25 | true 26 | bin\Release\ 27 | TRACE 28 | prompt 29 | 4 30 | false 31 | 32 | 33 | true 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | full 37 | x86 38 | false 39 | prompt 40 | 41 | 42 | bin\Release\ 43 | TRACE 44 | true 45 | 46 | 47 | x86 48 | false 49 | prompt 50 | 51 | 52 | true 53 | bin\Debug\ 54 | DEBUG;TRACE 55 | full 56 | x64 57 | false 58 | prompt 59 | 60 | 61 | bin\Release\ 62 | TRACE 63 | true 64 | 65 | 66 | x64 67 | false 68 | prompt 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Always 80 | 81 | 82 | 83 | 84 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 85 | Library 86 | 87 | 88 | 89 | 96 | -------------------------------------------------------------------------------- /src/Samples/Sample 07 - ICC Profiles/Sample 07 - ICC Profiles.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {3B1BB976-64A7-41FD-B7E2-59104161AF7E} 8 | Exe 9 | Properties 10 | Sample07 11 | Sample07 12 | 13 | 14 | 2.0 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | none 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | false 36 | 37 | 38 | true 39 | bin\Debug\ 40 | DEBUG;TRACE 41 | full 42 | x86 43 | false 44 | prompt 45 | 46 | 47 | bin\Release\ 48 | TRACE 49 | true 50 | 51 | 52 | x86 53 | false 54 | prompt 55 | 56 | 57 | true 58 | bin\Debug\ 59 | DEBUG;TRACE 60 | full 61 | x64 62 | false 63 | prompt 64 | 65 | 66 | bin\Release\ 67 | TRACE 68 | true 69 | 70 | 71 | x64 72 | false 73 | prompt 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | Always 85 | 86 | 87 | 88 | 89 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 90 | Library 91 | 92 | 93 | 94 | 101 | -------------------------------------------------------------------------------- /src/Samples/Sample 07 - ICC Profiles/Sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/Samples/Sample 07 - ICC Profiles/Sample.jpg -------------------------------------------------------------------------------- /src/Samples/Sample 08 - Creating a plugin/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("dc891ffc-ab5c-451f-97da-2c0d5d90edcc")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/Samples/Sample 08 - Creating a plugin/Sample.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/Samples/Sample 08 - Creating a plugin/Sample.jpg -------------------------------------------------------------------------------- /src/Samples/Sample 09 - Working with streams/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("7f29fbaa-d2b3-4011-b34f-5a109bc282af")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/Samples/Sample 09 - Working with streams/Sample 09 - Working with streams.2005.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {92A454B2-67EF-4B70-99C9-F22B83B6FBFF} 8 | WinExe 9 | Properties 10 | Sample09 11 | Sample09 12 | 13 | 14 | true 15 | full 16 | false 17 | bin\Debug\ 18 | DEBUG;TRACE 19 | prompt 20 | 4 21 | false 22 | 23 | 24 | none 25 | true 26 | bin\Release\ 27 | TRACE 28 | prompt 29 | 4 30 | false 31 | 32 | 33 | true 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | full 37 | x86 38 | false 39 | prompt 40 | 41 | 42 | bin\Release\ 43 | TRACE 44 | true 45 | 46 | 47 | x86 48 | false 49 | prompt 50 | 51 | 52 | true 53 | bin\Debug\ 54 | DEBUG;TRACE 55 | full 56 | x64 57 | false 58 | prompt 59 | 60 | 61 | bin\Release\ 62 | TRACE 63 | true 64 | 65 | 66 | x64 67 | false 68 | prompt 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | Form 80 | 81 | 82 | SampleForm.cs 83 | 84 | 85 | 86 | 87 | Designer 88 | SampleForm.cs 89 | 90 | 91 | 92 | 93 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 94 | Library 95 | 96 | 97 | 98 | 105 | -------------------------------------------------------------------------------- /src/Samples/Sample 09 - Working with streams/SampleForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Sample09 2 | { 3 | partial class SampleForm 4 | { 5 | /// 6 | /// Erforderliche Designervariable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Verwendete Ressourcen bereinigen. 12 | /// 13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Vom Windows Form-Designer generierter Code 24 | 25 | /// 26 | /// Erforderliche Methode für die Designerunterstützung. 27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.picBox = new System.Windows.Forms.PictureBox(); 32 | this.tbURL = new System.Windows.Forms.TextBox(); 33 | this.lUrl = new System.Windows.Forms.Label(); 34 | this.bLoadUrl = new System.Windows.Forms.Button(); 35 | this.bSave = new System.Windows.Forms.Button(); 36 | ((System.ComponentModel.ISupportInitialize)(this.picBox)).BeginInit(); 37 | this.SuspendLayout(); 38 | // 39 | // picBox 40 | // 41 | this.picBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 42 | this.picBox.Location = new System.Drawing.Point(12, 12); 43 | this.picBox.Name = "picBox"; 44 | this.picBox.Size = new System.Drawing.Size(536, 299); 45 | this.picBox.TabIndex = 0; 46 | this.picBox.TabStop = false; 47 | // 48 | // tbURL 49 | // 50 | this.tbURL.Location = new System.Drawing.Point(155, 317); 51 | this.tbURL.Name = "tbURL"; 52 | this.tbURL.Size = new System.Drawing.Size(393, 20); 53 | this.tbURL.TabIndex = 1; 54 | this.tbURL.Text = "http://freeimage.sourceforge.net/images/logo.jpg"; 55 | // 56 | // lUrl 57 | // 58 | this.lUrl.AutoSize = true; 59 | this.lUrl.Location = new System.Drawing.Point(9, 320); 60 | this.lUrl.Name = "lUrl"; 61 | this.lUrl.Size = new System.Drawing.Size(137, 13); 62 | this.lUrl.TabIndex = 2; 63 | this.lUrl.Text = "Enter the URL of an Image:"; 64 | // 65 | // bLoadUrl 66 | // 67 | this.bLoadUrl.Location = new System.Drawing.Point(12, 344); 68 | this.bLoadUrl.Name = "bLoadUrl"; 69 | this.bLoadUrl.Size = new System.Drawing.Size(75, 23); 70 | this.bLoadUrl.TabIndex = 3; 71 | this.bLoadUrl.Text = "Load URL"; 72 | this.bLoadUrl.UseVisualStyleBackColor = true; 73 | this.bLoadUrl.Click += new System.EventHandler(this.bLoadUrl_Click); 74 | // 75 | // bSave 76 | // 77 | this.bSave.Location = new System.Drawing.Point(93, 344); 78 | this.bSave.Name = "bSave"; 79 | this.bSave.Size = new System.Drawing.Size(75, 23); 80 | this.bSave.TabIndex = 4; 81 | this.bSave.Text = "Save to disk"; 82 | this.bSave.UseVisualStyleBackColor = true; 83 | this.bSave.Click += new System.EventHandler(this.bSave_Click); 84 | // 85 | // SampleForm 86 | // 87 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 88 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 89 | this.ClientSize = new System.Drawing.Size(560, 379); 90 | this.Controls.Add(this.bSave); 91 | this.Controls.Add(this.bLoadUrl); 92 | this.Controls.Add(this.lUrl); 93 | this.Controls.Add(this.tbURL); 94 | this.Controls.Add(this.picBox); 95 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 96 | this.MaximizeBox = false; 97 | this.MinimizeBox = false; 98 | this.Name = "SampleForm"; 99 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 100 | this.Text = "Sample09"; 101 | ((System.ComponentModel.ISupportInitialize)(this.picBox)).EndInit(); 102 | this.ResumeLayout(false); 103 | this.PerformLayout(); 104 | 105 | } 106 | 107 | #endregion 108 | 109 | private System.Windows.Forms.PictureBox picBox; 110 | private System.Windows.Forms.TextBox tbURL; 111 | private System.Windows.Forms.Label lUrl; 112 | private System.Windows.Forms.Button bLoadUrl; 113 | private System.Windows.Forms.Button bSave; 114 | } 115 | } -------------------------------------------------------------------------------- /src/Samples/Sample 09 - Working with streams/SampleForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Text; 7 | using System.Windows.Forms; 8 | using FreeImageAPI; 9 | using System.Net; 10 | using System.IO; 11 | 12 | namespace Sample09 13 | { 14 | public partial class SampleForm : Form 15 | { 16 | [STAThread] 17 | static void Main() 18 | { 19 | // Check if FreeImage is available 20 | if (!FreeImage.IsAvailable()) 21 | { 22 | throw new Exception("FreeImage is not available!"); 23 | } 24 | 25 | Application.EnableVisualStyles(); 26 | Application.SetCompatibleTextRenderingDefault(false); 27 | Application.Run(new SampleForm()); 28 | } 29 | 30 | public SampleForm() 31 | { 32 | InitializeComponent(); 33 | } 34 | 35 | private void bLoadUrl_Click(object sender, EventArgs e) 36 | { 37 | // Verify url 38 | if (String.IsNullOrEmpty(tbURL.Text)) 39 | { 40 | MessageBox.Show("Please enter a valid URL.", "Error"); 41 | return; 42 | } 43 | FIBITMAP dib = new FIBITMAP(); 44 | Stream sourceStream = null; 45 | try 46 | { 47 | // Build a stream to read from 48 | WebRequest request = (WebRequest)HttpWebRequest.Create(tbURL.Text); 49 | WebResponse response = request.GetResponse(); 50 | sourceStream = response.GetResponseStream(); 51 | if (sourceStream == null) 52 | { 53 | throw new Exception(); 54 | } 55 | // Load the image from stream 56 | dib = FreeImage.LoadFromStream(sourceStream); 57 | // Check success 58 | if (dib.IsNull) 59 | { 60 | throw new Exception(); 61 | } 62 | // Convert the bitmap into a .NET bitmap 63 | Bitmap bitmap = FreeImage.GetBitmap(dib); 64 | if (bitmap == null) 65 | { 66 | throw new Exception(); 67 | } 68 | // Show the bitmap 69 | if (picBox.Image != null) 70 | { 71 | picBox.Image.Dispose(); 72 | } 73 | picBox.Image = bitmap; 74 | } 75 | catch 76 | { 77 | // Error handling 78 | MessageBox.Show("Error loading URL.", "Error"); 79 | } 80 | finally 81 | { 82 | // Clean up memory 83 | FreeImage.UnloadEx(ref dib); 84 | if (sourceStream != null) sourceStream.Dispose(); 85 | } 86 | } 87 | 88 | private void bSave_Click(object sender, EventArgs e) 89 | { 90 | // Check if there is a loaded bitmap 91 | if (picBox.Image == null) 92 | { 93 | MessageBox.Show("No image loaded.", "Error"); 94 | return; 95 | } 96 | SaveFileDialog sfd = null; 97 | FileStream fStream = null; 98 | FIBITMAP dib = new FIBITMAP(); 99 | try 100 | { 101 | sfd = new SaveFileDialog(); 102 | sfd.CreatePrompt = false; 103 | sfd.FileName = ""; 104 | sfd.Filter = "TIF (*tif)|*.tif"; 105 | sfd.OverwritePrompt = true; 106 | sfd.RestoreDirectory = true; 107 | if (sfd.ShowDialog() == DialogResult.OK) 108 | { 109 | // Convert the .NET bitmap into a FreeImage-Bitmap 110 | dib = FreeImage.CreateFromBitmap((Bitmap)picBox.Image); 111 | if (dib.IsNull) 112 | { 113 | throw new Exception(); 114 | } 115 | // Create a filestream to write to 116 | fStream = new FileStream(sfd.FileName, FileMode.Create); 117 | if (!FreeImage.SaveToStream( 118 | ref dib, 119 | fStream, 120 | FREE_IMAGE_FORMAT.FIF_TIFF, 121 | FREE_IMAGE_SAVE_FLAGS.TIFF_LZW, 122 | FREE_IMAGE_COLOR_DEPTH.FICD_AUTO, 123 | false)) 124 | { 125 | throw new Exception(); 126 | } 127 | MessageBox.Show("Image saved successfully.", "Success"); 128 | } 129 | else 130 | { 131 | MessageBox.Show("Operation aborted.", "Aborted"); 132 | } 133 | } 134 | catch 135 | { 136 | MessageBox.Show("Error saving image.", "Error"); 137 | } 138 | finally 139 | { 140 | // Clean up 141 | if (sfd != null) sfd.Dispose(); 142 | if (fStream != null) fStream.Dispose(); 143 | FreeImage.UnloadEx(ref dib); 144 | } 145 | } 146 | } 147 | } -------------------------------------------------------------------------------- /src/Samples/Sample 10 - Metadata/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Sample10 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// Erforderliche Designervariable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Verwendete Ressourcen bereinigen. 12 | /// 13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Vom Windows Form-Designer generierter Code 24 | 25 | /// 26 | /// Erforderliche Methode für die Designerunterstützung. 27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.bLoad = new System.Windows.Forms.Button(); 32 | this.bQuit = new System.Windows.Forms.Button(); 33 | this.tvMetadata = new System.Windows.Forms.TreeView(); 34 | this.SuspendLayout(); 35 | // 36 | // bLoad 37 | // 38 | this.bLoad.Location = new System.Drawing.Point(12, 336); 39 | this.bLoad.Name = "bLoad"; 40 | this.bLoad.Size = new System.Drawing.Size(75, 23); 41 | this.bLoad.TabIndex = 0; 42 | this.bLoad.Text = "Load Image"; 43 | this.bLoad.UseVisualStyleBackColor = true; 44 | this.bLoad.Click += new System.EventHandler(this.bLoad_Click); 45 | // 46 | // bQuit 47 | // 48 | this.bQuit.Location = new System.Drawing.Point(328, 336); 49 | this.bQuit.Name = "bQuit"; 50 | this.bQuit.Size = new System.Drawing.Size(75, 23); 51 | this.bQuit.TabIndex = 1; 52 | this.bQuit.Text = "Quit"; 53 | this.bQuit.UseVisualStyleBackColor = true; 54 | this.bQuit.Click += new System.EventHandler(this.bQuit_Click); 55 | // 56 | // tvMetadata 57 | // 58 | this.tvMetadata.Location = new System.Drawing.Point(12, 12); 59 | this.tvMetadata.Name = "tvMetadata"; 60 | this.tvMetadata.Size = new System.Drawing.Size(389, 318); 61 | this.tvMetadata.TabIndex = 2; 62 | // 63 | // MainForm 64 | // 65 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 66 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 67 | this.ClientSize = new System.Drawing.Size(415, 371); 68 | this.Controls.Add(this.tvMetadata); 69 | this.Controls.Add(this.bQuit); 70 | this.Controls.Add(this.bLoad); 71 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 72 | this.MaximizeBox = false; 73 | this.MinimizeBox = false; 74 | this.Name = "MainForm"; 75 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; 76 | this.Text = "MainForm"; 77 | this.ResumeLayout(false); 78 | 79 | } 80 | 81 | #endregion 82 | 83 | private System.Windows.Forms.Button bLoad; 84 | private System.Windows.Forms.Button bQuit; 85 | private System.Windows.Forms.TreeView tvMetadata; 86 | } 87 | } -------------------------------------------------------------------------------- /src/Samples/Sample 10 - Metadata/MainForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Windows.Forms; 5 | using FreeImageAPI; 6 | using FreeImageAPI.Metadata; 7 | 8 | namespace Sample10 9 | { 10 | public partial class MainForm : Form 11 | { 12 | [STAThread] 13 | static void Main() 14 | { 15 | // Check if FreeImage.dll is available 16 | if (!FreeImage.IsAvailable()) 17 | { 18 | MessageBox.Show("FreeImage is not available. Aborting.", "Error"); 19 | } 20 | 21 | // Add this class to the FreeImage-Message-Callback 22 | FreeImageEngine.Message += new OutputMessageFunction(FreeImage_Message); 23 | 24 | Application.EnableVisualStyles(); 25 | Application.SetCompatibleTextRenderingDefault(false); 26 | Application.Run(new MainForm()); 27 | } 28 | 29 | static void FreeImage_Message(FREE_IMAGE_FORMAT fif, string message) 30 | { 31 | // Display the data 32 | MessageBox.Show( 33 | String.Format("FreeImage-Message:\n{1}\nFormat:{0}", fif.ToString(), message), 34 | "FreeImage-Message"); 35 | } 36 | 37 | public MainForm() 38 | { 39 | InitializeComponent(); 40 | } 41 | 42 | private void bQuit_Click(object sender, EventArgs e) 43 | { 44 | Application.Exit(); 45 | } 46 | 47 | private void bLoad_Click(object sender, EventArgs e) 48 | { 49 | // Create variables 50 | OpenFileDialog ofd = new OpenFileDialog(); 51 | FIBITMAP dib = new FIBITMAP(); 52 | try 53 | { 54 | // Apply settings 55 | ofd.CheckFileExists = true; 56 | ofd.CheckPathExists = true; 57 | ofd.FileName = ""; 58 | ofd.Filter = "All files (*.*)|*.*"; 59 | ofd.Multiselect = false; 60 | ofd.RestoreDirectory = true; 61 | // Get image filename 62 | if (ofd.ShowDialog() == DialogResult.OK) 63 | { 64 | // Load the image 65 | dib = FreeImage.LoadEx(ofd.FileName); 66 | // Check if image was loaded successfully 67 | if (dib.IsNull) throw new Exception("Failed to load image."); 68 | // Clear the treeview 69 | tvMetadata.Nodes.Clear(); 70 | // Create a wrapper for all metadata the image contains 71 | ImageMetadata iMetadata = new ImageMetadata(dib); 72 | // Get each metadata model 73 | foreach (MetadataModel metadataModel in iMetadata) 74 | { 75 | // Create a new node for each model 76 | TreeNode modelNode = tvMetadata.Nodes.Add(metadataModel.ToString()); 77 | 78 | // Get each metadata tag and create a subnode for it 79 | foreach (MetadataTag metadataTag in metadataModel) 80 | { 81 | modelNode.Nodes.Add(metadataTag.Key + ": " + metadataTag.ToString()); 82 | } 83 | } 84 | } 85 | else 86 | { 87 | MessageBox.Show("Operation aborted.", "Aborted"); 88 | } 89 | } 90 | // Display error message 91 | catch (Exception ex) 92 | { 93 | while (ex.InnerException != null) 94 | ex = ex.InnerException; 95 | MessageBox.Show(ex.ToString(), "Exception caught"); 96 | } 97 | // Clean up 98 | finally 99 | { 100 | ofd.Dispose(); 101 | FreeImage.UnloadEx(ref dib); 102 | } 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /src/Samples/Sample 10 - Metadata/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("e8da4fa8-cc15-4b0e-8c57-d55ceb771559")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/Samples/Sample 10 - Metadata/Sample 10 - Metadata.2005.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {55DCC37A-E56C-44D9-9C44-8DAB10CD3003} 8 | WinExe 9 | Properties 10 | Sample10 11 | Sample10 12 | 13 | 14 | true 15 | full 16 | false 17 | bin\Debug\ 18 | DEBUG;TRACE 19 | prompt 20 | 4 21 | false 22 | 23 | 24 | none 25 | true 26 | bin\Release\ 27 | TRACE 28 | prompt 29 | 4 30 | 31 | 32 | true 33 | bin\Debug\ 34 | DEBUG;TRACE 35 | full 36 | x86 37 | false 38 | prompt 39 | 40 | 41 | bin\Release\ 42 | TRACE 43 | true 44 | 45 | 46 | x86 47 | prompt 48 | 49 | 50 | true 51 | bin\Debug\ 52 | DEBUG;TRACE 53 | full 54 | x64 55 | false 56 | prompt 57 | 58 | 59 | bin\Release\ 60 | TRACE 61 | true 62 | 63 | 64 | x64 65 | prompt 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | Form 77 | 78 | 79 | MainForm.cs 80 | 81 | 82 | 83 | 84 | 85 | Designer 86 | MainForm.cs 87 | 88 | 89 | 90 | 91 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 92 | Library 93 | 94 | 95 | 96 | 103 | -------------------------------------------------------------------------------- /src/Samples/Sample 10 - Metadata/Sample 10 - Metadata.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {55DCC37A-E56C-44D9-9C44-8DAB10CD3003} 8 | WinExe 9 | Properties 10 | Sample10 11 | Sample10 12 | 13 | 14 | 2.0 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | false 27 | 28 | 29 | none 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | true 38 | bin\Debug\ 39 | DEBUG;TRACE 40 | full 41 | x86 42 | false 43 | prompt 44 | 45 | 46 | bin\Release\ 47 | TRACE 48 | true 49 | 50 | 51 | x86 52 | prompt 53 | 54 | 55 | true 56 | bin\Debug\ 57 | DEBUG;TRACE 58 | full 59 | x64 60 | false 61 | prompt 62 | 63 | 64 | bin\Release\ 65 | TRACE 66 | true 67 | 68 | 69 | x64 70 | prompt 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | Form 82 | 83 | 84 | MainForm.cs 85 | 86 | 87 | 88 | 89 | 90 | Designer 91 | MainForm.cs 92 | 93 | 94 | 95 | 96 | {6598A7CD-8F27-4D3F-A675-5AE63113A7C3} 97 | Library 98 | 99 | 100 | 101 | 108 | -------------------------------------------------------------------------------- /src/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace Sample11 2 | { 3 | partial class MetaDataFrame 4 | { 5 | /// 6 | /// Erforderliche Designervariable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Verwendete Ressourcen bereinigen. 12 | /// 13 | /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Vom Windows Form-Designer generierter Code 24 | 25 | /// 26 | /// Erforderliche Methode für die Designerunterstützung. 27 | /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.tvMetadata = new System.Windows.Forms.TreeView(); 32 | this.SuspendLayout(); 33 | // 34 | // tvMetadata 35 | // 36 | this.tvMetadata.Location = new System.Drawing.Point(12, 12); 37 | this.tvMetadata.Name = "tvMetadata"; 38 | this.tvMetadata.Size = new System.Drawing.Size(389, 318); 39 | this.tvMetadata.TabIndex = 3; 40 | // 41 | // MetaDataFrame 42 | // 43 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 44 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 45 | this.ClientSize = new System.Drawing.Size(417, 349); 46 | this.Controls.Add(this.tvMetadata); 47 | this.DoubleBuffered = true; 48 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 49 | this.MaximizeBox = false; 50 | this.MinimizeBox = false; 51 | this.Name = "MetaDataFrame"; 52 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 53 | this.Text = "Metadata"; 54 | this.Load += new System.EventHandler(this.MetaDataFrame_Load); 55 | this.ResumeLayout(false); 56 | 57 | } 58 | 59 | #endregion 60 | 61 | private System.Windows.Forms.TreeView tvMetadata; 62 | } 63 | } -------------------------------------------------------------------------------- /src/Samples/Sample 11 - Using the FreeImageBitmap class/MetaDataFrame.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows.Forms; 4 | using FreeImageAPI; 5 | using FreeImageAPI.Metadata; 6 | 7 | namespace Sample11 8 | { 9 | public partial class MetaDataFrame : Form 10 | { 11 | public MetaDataFrame() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | private void MetaDataFrame_Load(object sender, EventArgs e) 17 | { 18 | ImageMetadata iMetadata = this.Tag as ImageMetadata; 19 | if (iMetadata != null) 20 | { 21 | bool backup = iMetadata.HideEmptyModels; 22 | iMetadata.HideEmptyModels = false; 23 | try 24 | { 25 | // Get each metadata model 26 | foreach (MetadataModel metadataModel in iMetadata) 27 | { 28 | // Create a new node for each model 29 | TreeNode modelNode = tvMetadata.Nodes.Add(metadataModel.ToString()); 30 | 31 | // Get each metadata tag and create a subnode for it 32 | foreach (MetadataTag metadataTag in metadataModel) 33 | { 34 | modelNode.Nodes.Add(metadataTag.Key + ": " + metadataTag.ToString()); 35 | } 36 | } 37 | } 38 | // Display error message 39 | catch (Exception ex) 40 | { 41 | while (ex.InnerException != null) 42 | ex = ex.InnerException; 43 | MessageBox.Show(ex.ToString(), "Exception caught"); 44 | } 45 | iMetadata.HideEmptyModels = backup; 46 | } 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /src/Samples/Sample 11 - Using the FreeImageBitmap class/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("219019e1-9a57-46c7-b9d7-3928a9277fd6")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/SourceFileManager/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace FreeImageNET_SFM 8 | { 9 | class Program 10 | { 11 | static private Regex searchPattern = new Regex("#include[ \\t]*\"(.*)\"", RegexOptions.Compiled); 12 | static private FileStream fStream = null; 13 | static private TextWriter textOut = null; 14 | private const string baseFolder = @"..\..\..\Library\"; 15 | private const string templateName = @"FreeImage.cs.template"; 16 | 17 | static int Main(string[] args) 18 | { 19 | try 20 | { 21 | if (!File.Exists(templateName)) 22 | { 23 | Console.WriteLine(templateName + " not found."); return 1; 24 | } 25 | 26 | try 27 | { 28 | fStream = new FileStream(@"FreeImage.cs", FileMode.Create); 29 | } 30 | catch 31 | { 32 | Console.WriteLine("Unable to create output file."); return 2; 33 | } 34 | 35 | textOut = new StreamWriter(fStream); 36 | 37 | string[] content = File.ReadAllLines(templateName); 38 | 39 | for (int lineNumber = 0; lineNumber < content.Length; lineNumber++) 40 | { 41 | string line = content[lineNumber].Trim(); 42 | Match match = searchPattern.Match(line); 43 | 44 | if (match.Success && match.Groups.Count == 2 && match.Groups[1].Value != null) 45 | { 46 | if (!File.Exists(baseFolder + match.Groups[1].Value)) 47 | { 48 | throw new FileNotFoundException(baseFolder + match.Groups[1].Value + " does not exist."); 49 | } 50 | 51 | ParseFile(baseFolder + match.Groups[1].Value); 52 | } 53 | else 54 | { 55 | textOut.WriteLine(content[lineNumber]); 56 | } 57 | } 58 | 59 | return 0; 60 | } 61 | catch (Exception ex) 62 | { 63 | Console.WriteLine(ex.ToString()); 64 | //Console.WriteLine("Error while parsing."); 65 | return 3; 66 | } 67 | finally 68 | { 69 | if (textOut != null) 70 | { 71 | textOut.Flush(); 72 | textOut.Close(); 73 | } 74 | } 75 | } 76 | 77 | private static void ParseFile(string fileName) 78 | { 79 | int lineNumber = 0; 80 | string line; 81 | Match match; 82 | string[] content = File.ReadAllLines(fileName); 83 | 84 | if (fileName.Contains("AssemblyInfo.cs")) 85 | { 86 | while (content[lineNumber].Trim().StartsWith("using") && lineNumber < content.Length) 87 | { 88 | lineNumber++; 89 | } 90 | lineNumber++; 91 | } 92 | else 93 | { 94 | while (!(content[lineNumber].Trim().StartsWith("namespace")) && lineNumber < content.Length) 95 | { 96 | lineNumber++; 97 | } 98 | //lineNumber += 2; 99 | } 100 | 101 | for (; lineNumber < content.Length; lineNumber++) 102 | { 103 | line = content[lineNumber].Trim(); 104 | match = searchPattern.Match(line); 105 | 106 | if (match.Success && match.Groups.Count == 2 && match.Groups[1].Value != null) 107 | { 108 | if (!File.Exists(baseFolder + match.Groups[1].Value)) 109 | { 110 | throw new FileNotFoundException(baseFolder + match.Groups[1].Value + " does not exist."); 111 | } 112 | 113 | ParseFile(baseFolder + match.Groups[1].Value); 114 | } 115 | else 116 | { 117 | textOut.WriteLine(content[lineNumber]); 118 | } 119 | } 120 | } 121 | } 122 | } -------------------------------------------------------------------------------- /src/SourceFileManager/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("")] 6 | [assembly: AssemblyDescription("")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany("")] 9 | [assembly: AssemblyProduct("")] 10 | [assembly: AssemblyCopyright("")] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | [assembly: ComVisible(false)] 14 | [assembly: Guid("4fcae9f3-1b12-4137-9c5b-047124da37e9")] 15 | [assembly: AssemblyVersion("1.0.0.0")] 16 | [assembly: AssemblyFileVersion("1.0.0.0")] 17 | -------------------------------------------------------------------------------- /src/SourceFileManager/SourceFileMerger.2005.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1} 8 | Exe 9 | Properties 10 | FreeImageNET_SFM 11 | sourcefilemerger 12 | 13 | 14 | true 15 | full 16 | false 17 | bin\Debug\ 18 | DEBUG;TRACE 19 | none 20 | 4 21 | false 22 | 512 23 | 24 | 25 | none 26 | true 27 | bin\Release\ 28 | TRACE 29 | none 30 | 4 31 | false 32 | 33 | 34 | true 35 | bin\Debug\ 36 | DEBUG;TRACE 37 | 512 38 | full 39 | x86 40 | false 41 | none 42 | 43 | 44 | bin\Release\ 45 | TRACE 46 | true 47 | 48 | 49 | x86 50 | false 51 | none 52 | 53 | 54 | true 55 | bin\Debug\ 56 | DEBUG;TRACE 57 | 512 58 | full 59 | x64 60 | false 61 | none 62 | 63 | 64 | bin\Release\ 65 | TRACE 66 | true 67 | 68 | 69 | x64 70 | false 71 | none 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | Always 83 | 84 | 85 | 86 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /src/SourceFileManager/SourceFileMerger.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug 4 | AnyCPU 5 | 8.0.50727 6 | 2.0 7 | {2AD35641-C1EA-492C-B081-F4AA5AAE8FA1} 8 | Exe 9 | Properties 10 | FreeImageNET_SFM 11 | sourcefilemerger 12 | 13 | 14 | 2.0 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | none 25 | 4 26 | false 27 | 512 28 | 29 | 30 | none 31 | true 32 | bin\Release\ 33 | TRACE 34 | none 35 | 4 36 | false 37 | 38 | 39 | true 40 | bin\Debug\ 41 | DEBUG;TRACE 42 | 512 43 | full 44 | x86 45 | false 46 | none 47 | 48 | 49 | bin\Release\ 50 | TRACE 51 | true 52 | 53 | 54 | x86 55 | false 56 | none 57 | 58 | 59 | true 60 | bin\Debug\ 61 | DEBUG;TRACE 62 | 512 63 | full 64 | x64 65 | false 66 | none 67 | 68 | 69 | bin\Release\ 70 | TRACE 71 | true 72 | 73 | 74 | x64 75 | false 76 | none 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | Always 88 | 89 | 90 | 91 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /src/UnitTest/NUnit.txt: -------------------------------------------------------------------------------- 1 | The tests can be run by invoking "dotnet test" from the UnitTest project folder 2 | 3 | Alternatively, the test explorer can be used in Visual Studio 4 | 5 | If either of these don't work, please open an issue! -------------------------------------------------------------------------------- /src/UnitTest/SetUpFixture.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | using System; 3 | using System.IO; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace FreeImageNETUnitTest 8 | { 9 | [SetUpFixture] 10 | public class SetUpFixture 11 | { 12 | 13 | [OneTimeSetUp] 14 | public void Init() 15 | { 16 | string dir = Path.GetDirectoryName(typeof(SetUpFixture).GetTypeInfo().Assembly.Location); 17 | Directory.SetCurrentDirectory(dir); 18 | 19 | CopyFreeImageNativeDll(); 20 | } 21 | 22 | [OneTimeTearDown] 23 | public void DeInit() 24 | { 25 | } 26 | 27 | private static void CopyFreeImageNativeDll() 28 | { 29 | string solutionFolder = Utility.GetSolutionFolder(); 30 | string runtimesFolder = Path.Combine(solutionFolder, "runtimes"); 31 | 32 | const string freeImageLibraryName = "FreeImage"; 33 | 34 | string libraryPath = GetPlatformLibraryPath(runtimesFolder, freeImageLibraryName); 35 | string libraryFileExtension = Path.GetExtension(libraryPath); 36 | 37 | if (false == File.Exists(libraryPath)) 38 | { 39 | throw new FileNotFoundException(libraryPath); 40 | } 41 | 42 | string executingFolder = Utility.GetExecutingFolder(); 43 | string targetLibraryPath = Path.Combine(executingFolder, $"{freeImageLibraryName}{libraryFileExtension}"); 44 | 45 | if (File.Exists(targetLibraryPath)) 46 | { 47 | File.Delete(targetLibraryPath); 48 | } 49 | 50 | File.Copy(libraryPath, targetLibraryPath, false); 51 | } 52 | 53 | private static string GetPlatformLibraryPath(string runtimesFolder, string libraryName) 54 | { 55 | string runtimeFolderName; 56 | string libraryFileName; 57 | 58 | #if NET461 59 | runtimeFolderName = GetWindowsRuntimeFolder(); 60 | libraryFileName = $"{libraryName}.dll"; 61 | #else 62 | if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) 63 | { 64 | runtimeFolderName = GetWindowsRuntimeFolder(); 65 | libraryFileName = $"{libraryName}.dll"; 66 | } 67 | 68 | else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) 69 | { 70 | runtimeFolderName = "osx.10.10-x64"; 71 | libraryFileName = "libfreeimage.3.17.0.dylib"; 72 | } 73 | 74 | else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) 75 | { 76 | runtimeFolderName = "ubuntu.16.04-x64"; 77 | libraryFileName = "libfreeimage-3.17.0.so"; 78 | } 79 | else 80 | { 81 | throw new Exception($"Unsupported platform"); 82 | } 83 | #endif 84 | 85 | return Path.Combine(runtimesFolder, runtimeFolderName, "native", libraryFileName); 86 | } 87 | 88 | private static string GetWindowsRuntimeFolder() 89 | { 90 | int ptrSize = Marshal.SizeOf(); 91 | return (ptrSize == 4) ? "win7-x86" : "win7-x64"; 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /src/UnitTest/TestFixtures/WrapperFunctionsTest.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/matgr1/FreeImage-dotnet-core/f9ede8251be907ebf3c469995fe1c6a0f7ccb534/src/UnitTest/TestFixtures/WrapperFunctionsTest.cs -------------------------------------------------------------------------------- /src/UnitTest/UnitTest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp1.1;net461 5 | true 6 | UnitTest 7 | $(PackageTargetFallback);dnxcore50 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/UnitTest/Utility.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Reflection; 3 | 4 | namespace FreeImageNETUnitTest 5 | { 6 | public static class Utility 7 | { 8 | public static string GetExecutingFolder() 9 | { 10 | return Path.GetDirectoryName(typeof(Utility).GetTypeInfo().Assembly.Locati‌​on); 11 | } 12 | 13 | public static string GetSolutionFolder() 14 | { 15 | // TODO: this is pretty hokie... 16 | string executingFolder = GetExecutingFolder(); 17 | return Path.GetFullPath(Path.Combine(executingFolder, "..", "..", "..", "..", "..")); 18 | } 19 | } 20 | } 21 | --------------------------------------------------------------------------------