~cosme/ubuntu/precise/freeimage/freeimage-3.15.1

« back to all changes in this revision

Viewing changes to Wrapper/FreeImage.NET/src/FreeImage.cs

  • Committer: Stefano Rivera
  • Date: 2010-07-24 15:35:51 UTC
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: stefanor@ubuntu.com-20100724153551-6s3fth1653huk31a
Tags: upstream-3.13.1
ImportĀ upstreamĀ versionĀ 3.31.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// ==========================================================
2
 
// FreeImage.NET 3
3
 
//
4
 
// Design and implementation by
5
 
// - David Boland (davidboland@vodafone.ie)
6
 
//
7
 
// Contributors:
8
 
// - Andrew S. Townley
9
 
// - Hervļæ½ Drolon
10
 
//
11
 
// This file is part of FreeImage 3
12
 
//
13
 
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
14
 
// WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
15
 
// INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS
16
 
// FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR
17
 
// NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE
18
 
// OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE
19
 
// DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY
20
 
// OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING,
21
 
// REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN
22
 
// ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS
23
 
// AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
24
 
//
25
 
// Use at your own risk!
26
 
//
27
 
// ==========================================================
28
 
 
29
 
using System;
30
 
using System.IO;
31
 
using System.Runtime.InteropServices;
32
 
 
33
 
namespace FreeImageAPI
34
 
{
35
 
        /**
36
 
        Handle to a bitmap
37
 
        */
38
 
        using FIBITMAP = UInt32;
39
 
        /**
40
 
        Handle to a multipage file
41
 
        */
42
 
        using FIMULTIBITMAP = UInt32;
43
 
        /**
44
 
        Handle to a memory I/O stream
45
 
        */
46
 
        using FIMEMORY = UInt32;
47
 
        /**
48
 
          Handle to a metadata model
49
 
        */
50
 
        using FIMETADATA = UInt32;
51
 
        /** 
52
 
        Handle to a FreeImage tag
53
 
        */
54
 
        using FITAG = UInt32;
55
 
 
56
 
        /*      [StructLayout(LayoutKind.Sequential)]
57
 
                public class FreeImageIO
58
 
                {
59
 
                        public FI_ReadProc readProc;
60
 
                        public FI_WriteProc writeProc;
61
 
                        public FI_SeekProc seekProc;
62
 
                        public FI_TellProc tellProc;
63
 
                }
64
 
        
65
 
                [StructLayout(LayoutKind.Sequential)]
66
 
                public class FI_Handle
67
 
                {
68
 
                        public FileStream stream;
69
 
                }
70
 
                public delegate void FI_ReadProc(IntPtr buffer, uint size, uint count, IntPtr handle);
71
 
                public delegate void FI_WriteProc(IntPtr buffer, uint size, uint count, IntPtr handle);
72
 
                public delegate int FI_SeekProc(IntPtr handle, long offset, int origin);
73
 
                public delegate int FI_TellProc(IntPtr handle);
74
 
                */
75
 
 
76
 
        // Types used in the library (directly copied from Windows) -----------------
77
 
 
78
 
        [StructLayout(LayoutKind.Sequential)]
79
 
        public class RGBQUAD { 
80
 
                public byte rgbBlue;
81
 
                public byte rgbGreen;
82
 
                public byte rgbRed;
83
 
                public byte rgbReserved;
84
 
        }
85
 
        
86
 
        [StructLayout(LayoutKind.Sequential)]
87
 
        public class RGBTRIPLE { 
88
 
                public byte rgbtBlue;
89
 
                public byte rgbtGreen;
90
 
                public byte rgbtRed;
91
 
        }
92
 
 
93
 
        /*
94
 
        These structures should not be used by a wrapper
95
 
        [StructLayout(LayoutKind.Sequential)]
96
 
        public class BITMAPINFOHEADER {
97
 
                public uint size;
98
 
                public int width; 
99
 
                public int height; 
100
 
                public ushort biPlanes; 
101
 
                public ushort biBitCount;
102
 
                public uint biCompression; 
103
 
                public uint biSizeImage; 
104
 
                public int biXPelsPerMeter; 
105
 
                public int biYPelsPerMeter; 
106
 
                public uint biClrUsed; 
107
 
                public uint biClrImportant;
108
 
        }
109
 
 
110
 
        [StructLayout(LayoutKind.Sequential)]
111
 
        public class BITMAPINFO {
112
 
          public BITMAPINFOHEADER bmiHeader; 
113
 
          public RGBQUAD bmiColors;
114
 
        }
115
 
        */
116
 
 
117
 
        // Types used in the library (specific to FreeImage) ------------------------
118
 
        /** 48-bit RGB 
119
 
        */
120
 
        [StructLayout(LayoutKind.Sequential)]
121
 
        public class FIRGB16 {
122
 
                public ushort red;
123
 
                public ushort green;
124
 
                public ushort blue;
125
 
        }
126
 
 
127
 
        /** 64-bit RGBA
128
 
        */
129
 
        [StructLayout(LayoutKind.Sequential)]
130
 
        public class FIRGBA16 {
131
 
                public ushort red;
132
 
                public ushort green;
133
 
                public ushort blue;
134
 
                public ushort alpha;
135
 
        }
136
 
 
137
 
        /** 96-bit RGB Float
138
 
        */
139
 
        [StructLayout(LayoutKind.Sequential)]
140
 
        public class FIRGBF {
141
 
                public float red;
142
 
                public float green;
143
 
                public float blue;
144
 
        }
145
 
 
146
 
        /** 128-bit RGBA Float
147
 
        */
148
 
        [StructLayout(LayoutKind.Sequential)]
149
 
        public class FIRGBAF {
150
 
                public float red;
151
 
                public float green;
152
 
                public float blue;
153
 
                public float alpha;
154
 
        }
155
 
 
156
 
        /** Data structure for COMPLEX type (complex number)
157
 
        */
158
 
        [StructLayout(LayoutKind.Sequential)]
159
 
        public class FICOMPLEX {
160
 
                // real part
161
 
                public double r;
162
 
                // imaginary part
163
 
                public double i;
164
 
        }
165
 
 
166
 
        // ICC profile support ------------------------------------------------------
167
 
 
168
 
        public enum ICCFlags {
169
 
                FIICC_DEFAULT           = 0x00,
170
 
                FIICC_COLOR_IS_CMYK     = 0x01
171
 
        }
172
 
 
173
 
        [StructLayout(LayoutKind.Sequential)]
174
 
        public class FIICCPROFILE {
175
 
                public ushort flags;    // info flag
176
 
                public uint size;               // profile's size measured in bytes
177
 
                public IntPtr data;             // points to a block of contiguous memory containing the profile
178
 
        }
179
 
 
180
 
        // Important enums ----------------------------------------------------------
181
 
 
182
 
        public enum LoadSaveFlags {
183
 
                BMP_DEFAULT                     = 0,
184
 
                BMP_SAVE_RLE            = 1,
185
 
                CUT_DEFAULT                     = 0,
186
 
                DDS_DEFAULT                     = 0,
187
 
                EXR_DEFAULT                     = 0,            // save data as half with piz-based wavelet compression
188
 
                EXR_FLOAT                       = 0x0001,       // save data as float instead of as half (not recommended)
189
 
                EXR_NONE                        = 0x0002,       // save with no compression
190
 
                EXR_ZIP                         = 0x0004,       // save with zlib compression, in blocks of 16 scan lines
191
 
                EXR_PIZ                         = 0x0008,       // save with piz-based wavelet compression
192
 
                EXR_PXR24                       = 0x0010,       // save with lossy 24-bit float compression
193
 
                EXR_B44                         = 0x0020,       // save with lossy 44% float compression - goes to 22% when combined with EXR_LC
194
 
                EXR_LC                          = 0x0040,       // save images with one luminance and two chroma channels, rather than as RGB (lossy compression)
195
 
                FAXG3_DEFAULT           = 0,
196
 
                GIF_DEFAULT                     = 0,
197
 
                GIF_LOAD256                     = 1,            // Load the     image as a 256 color image with ununsed palette entries, if     it's 16 or 2 color
198
 
                GIF_PLAYBACK            = 2,            // 'Play' the GIF to generate each frame (as 32bpp)     instead of returning raw frame data     when loading
199
 
                HDR_DEFAULT                     = 0,
200
 
                ICO_DEFAULT                     = 0,
201
 
                ICO_MAKEALPHA           = 1,            // convert to 32bpp     and     create an alpha channel from the AND-mask when loading
202
 
                IFF_DEFAULT                     = 0,
203
 
                J2K_DEFAULT                     = 0,            // save with a 16:1 rate
204
 
                JP2_DEFAULT                     = 0,            // save with a 16:1 rate
205
 
                JPEG_DEFAULT            = 0,
206
 
                JPEG_FAST                       = 1,
207
 
                JPEG_ACCURATE           = 2,
208
 
                JPEG_QUALITYSUPERB      = 0x80,
209
 
                JPEG_QUALITYGOOD        = 0x100,
210
 
                JPEG_QUALITYNORMAL      = 0x200,
211
 
                JPEG_QUALITYAVERAGE     = 0x400,
212
 
                JPEG_QUALITYBAD         = 0x800,
213
 
                JPEG_CMYK                       = 0x1000,       // load separated CMYK "as is" (use     | to combine with other flags)
214
 
                KOALA_DEFAULT           = 0,
215
 
                LBM_DEFAULT                     = 0,
216
 
                MNG_DEFAULT                     = 0,
217
 
                PCD_DEFAULT                     = 0,
218
 
                PCD_BASE                        = 1,            // load the     bitmap sized 768 x 512
219
 
                PCD_BASEDIV4            = 2,            // load the     bitmap sized 384 x 256
220
 
                PCD_BASEDIV16           = 3,            // load the     bitmap sized 192 x 128
221
 
                PCX_DEFAULT                     = 0,
222
 
                PNG_DEFAULT                     = 0,
223
 
                PNG_IGNOREGAMMA         = 1,            // avoid gamma correction
224
 
                PNM_DEFAULT                     = 0,
225
 
                PNM_SAVE_RAW            = 0,            //      If set the writer saves in RAW format (i.e.     P4,     P5 or P6)
226
 
                PNM_SAVE_ASCII          = 1,            // If   set     the     writer saves in ASCII format (i.e. P1, P2 or P3)
227
 
                PSD_DEFAULT                     = 0,
228
 
                RAS_DEFAULT                     = 0,
229
 
                TARGA_DEFAULT           = 0,
230
 
                TARGA_LOAD_RGB888       = 1,            //      If set the loader converts RGB555 and ARGB8888 -> RGB888.
231
 
                TIFF_DEFAULT            = 0,
232
 
                TIFF_CMYK                       = 0x0001,       // reads/stores tags for separated CMYK (use | to combine with compression flags)
233
 
                TIFF_PACKBITS           = 0x0100,       // save using   PACKBITS compression
234
 
                TIFF_DEFLATE            = 0x0200,       // save using   DEFLATE compression     (a.k.a. ZLIB compression)
235
 
                TIFF_ADOBE_DEFLATE      = 0x0400,       // save using   ADOBE DEFLATE compression
236
 
                TIFF_NONE                       = 0x0800,       // save without any compression
237
 
                TIFF_CCITTFAX3          = 0x1000,       //      save using CCITT Group 3 fax encoding
238
 
                TIFF_CCITTFAX4          = 0x2000,       //      save using CCITT Group 4 fax encoding
239
 
                TIFF_LZW                        = 0x4000,       // save using LZW compression
240
 
                TIFF_JPEG                       = 0x8000,       // save using JPEG compression
241
 
                WBMP_DEFAULT            = 0,
242
 
                XBM_DEFAULT                     = 0,
243
 
                XPM_DEFAULT                     = 0,
244
 
        }
245
 
 
246
 
        /** I/O image format identifiers.
247
 
        */
248
 
        public enum FREE_IMAGE_FORMAT {
249
 
                FIF_UNKNOWN = -1,
250
 
                FIF_BMP         = 0,
251
 
                FIF_ICO         = 1,
252
 
                FIF_JPEG        = 2,
253
 
                FIF_JNG         = 3,
254
 
                FIF_KOALA       = 4,
255
 
                FIF_LBM         = 5,
256
 
                FIF_IFF = FIF_LBM,
257
 
                FIF_MNG         = 6,
258
 
                FIF_PBM         = 7,
259
 
                FIF_PBMRAW      = 8,
260
 
                FIF_PCD         = 9,
261
 
                FIF_PCX         = 10,
262
 
                FIF_PGM         = 11,
263
 
                FIF_PGMRAW      = 12,
264
 
                FIF_PNG         = 13,
265
 
                FIF_PPM         = 14,
266
 
                FIF_PPMRAW      = 15,
267
 
                FIF_RAS         = 16,
268
 
                FIF_TARGA       = 17,
269
 
                FIF_TIFF        = 18,
270
 
                FIF_WBMP        = 19,
271
 
                FIF_PSD         = 20,
272
 
                FIF_CUT         = 21,
273
 
                FIF_XBM         = 22,
274
 
                FIF_XPM         = 23,
275
 
                FIF_DDS     = 24,
276
 
                FIF_GIF     = 25,
277
 
                FIF_HDR         = 26,
278
 
                FIF_FAXG3       = 27,
279
 
                FIF_SGI         = 28,
280
 
                FIF_EXR         = 29,
281
 
                FIF_J2K         = 30,
282
 
                FIF_JP2         = 31            
283
 
        }
284
 
 
285
 
        /** Image type used in FreeImage.
286
 
        */
287
 
        public enum FREE_IMAGE_TYPE {
288
 
                FIT_UNKNOWN = 0,        // unknown type
289
 
                FIT_BITMAP  = 1,        // standard image                       : 1-, 4-, 8-, 16-, 24-, 32-bit
290
 
                FIT_UINT16      = 2,    // array of unsigned short      : unsigned 16-bit
291
 
                FIT_INT16       = 3,    // array of short                       : signed 16-bit
292
 
                FIT_UINT32      = 4,    // array of unsigned long       : unsigned 32-bit
293
 
                FIT_INT32       = 5,    // array of long                        : signed 32-bit
294
 
                FIT_FLOAT       = 6,    // array of float                       : 32-bit IEEE floating point
295
 
                FIT_DOUBLE      = 7,    // array of double                      : 64-bit IEEE floating point
296
 
                FIT_COMPLEX     = 8,    // array of FICOMPLEX           : 2 x 64-bit IEEE floating point
297
 
                FIT_RGB16       = 9,    // 48-bit RGB image                     : 3 x 16-bit
298
 
                FIT_RGBA16      = 10,   // 64-bit RGBA image            : 4 x 16-bit
299
 
                FIT_RGBF        = 11,   // 96-bit RGB float image       : 3 x 32-bit IEEE floating point
300
 
                FIT_RGBAF       = 12    // 128-bit RGBA float image     : 4 x 32-bit IEEE floating point
301
 
        }
302
 
 
303
 
        /** Image color type used in FreeImage.
304
 
        */
305
 
        public enum     FREE_IMAGE_COLOR_TYPE {
306
 
                FIC_MINISWHITE = 0,             // min value is white
307
 
                FIC_MINISBLACK = 1,             // min value is black
308
 
                FIC_RGB        = 2,             // RGB color model
309
 
                FIC_PALETTE    = 3,             // color map indexed
310
 
                FIC_RGBALPHA   = 4,             // RGB color model with alpha channel
311
 
                FIC_CMYK       = 5              // CMYK color model
312
 
        };
313
 
 
314
 
        /** Color quantization algorithms.
315
 
        Constants used in FreeImage_ColorQuantize.
316
 
        */
317
 
        public enum FREE_IMAGE_QUANTIZE {
318
 
                FIQ_WUQUANT = 0,                // Xiaolin Wu color quantization algorithm
319
 
                FIQ_NNQUANT = 1                 // NeuQuant neural-net quantization algorithm by Anthony Dekker
320
 
        }
321
 
 
322
 
        /** Dithering algorithms.
323
 
        Constants used in FreeImage_Dither.
324
 
        */      
325
 
        public enum FREE_IMAGE_DITHER {
326
 
                FID_FS                  = 0,    // Floyd & Steinberg error diffusion
327
 
                FID_BAYER4x4    = 1,    // Bayer ordered dispersed dot dithering (order 2 dithering matrix)
328
 
                FID_BAYER8x8    = 2,    // Bayer ordered dispersed dot dithering (order 3 dithering matrix)
329
 
                FID_CLUSTER6x6  = 3,    // Ordered clustered dot dithering (order 3 - 6x6 matrix)
330
 
                FID_CLUSTER8x8  = 4,    // Ordered clustered dot dithering (order 4 - 8x8 matrix)
331
 
                FID_CLUSTER16x16= 5,    // Ordered clustered dot dithering (order 8 - 16x16 matrix)
332
 
                FID_BAYER16x16  = 6             // Bayer ordered dispersed dot dithering (order 4 dithering matrix)
333
 
        }
334
 
        /** Lossless JPEG transformations
335
 
        Constants used in FreeImage_JPEGTransform
336
 
        */
337
 
        public enum FREE_IMAGE_JPEG_OPERATION {
338
 
                FIJPEG_OP_NONE                  = 0,    // no transformation
339
 
                FIJPEG_OP_FLIP_H                = 1,    // horizontal flip
340
 
                FIJPEG_OP_FLIP_V                = 2,    // vertical flip
341
 
                FIJPEG_OP_TRANSPOSE             = 3,    // transpose across UL-to-LR axis
342
 
                FIJPEG_OP_TRANSVERSE    = 4,    // transpose across UR-to-LL axis
343
 
                FIJPEG_OP_ROTATE_90             = 5,    // 90-degree clockwise rotation
344
 
                FIJPEG_OP_ROTATE_180    = 6,    // 180-degree rotation
345
 
                FIJPEG_OP_ROTATE_270    = 7             // 270-degree clockwise (or 90 ccw)
346
 
        };      
347
 
 
348
 
        /** Tone mapping operators.
349
 
        Constants used in FreeImage_ToneMapping.
350
 
        */
351
 
        public enum FREE_IMAGE_TMO {
352
 
                FITMO_DRAGO03    = 0,   // Adaptive logarithmic mapping (F. Drago, 2003)
353
 
                FITMO_REINHARD05 = 1,   // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005)
354
 
                FITMO_FATTAL02   = 2    // Gradient domain high dynamic range compression (R. Fattal, 2002)
355
 
        };
356
 
 
357
 
        /** Upsampling / downsampling filters. 
358
 
        Constants used in FreeImage_Rescale.
359
 
        */
360
 
        public enum FREE_IMAGE_FILTER {
361
 
                FILTER_BOX                = 0,  // Box, pulse, Fourier window, 1st order (constant) b-spline
362
 
                FILTER_BICUBIC    = 1,  // Mitchell & Netravali's two-param cubic filter
363
 
                FILTER_BILINEAR   = 2,  // Bilinear filter
364
 
                FILTER_BSPLINE    = 3,  // 4th order (cubic) b-spline
365
 
                FILTER_CATMULLROM = 4,  // Catmull-Rom spline, Overhauser spline
366
 
                FILTER_LANCZOS3   = 5   // Lanczos3 filter
367
 
        }
368
 
 
369
 
        /** Color channels.
370
 
        Constants used in color manipulation routines.
371
 
        */
372
 
        public enum FREE_IMAGE_COLOR_CHANNEL {
373
 
                FICC_RGB        = 0,    // Use red, green and blue channels
374
 
                FICC_RED        = 1,    // Use red channel
375
 
                FICC_GREEN      = 2,    // Use green channel
376
 
                FICC_BLUE       = 3,    // Use blue channel
377
 
                FICC_ALPHA      = 4,    // Use alpha channel
378
 
                FICC_BLACK      = 5,    // Use black channel
379
 
                FICC_REAL       = 6,    // Complex images: use real part
380
 
                FICC_IMAG       = 7,    // Complex images: use imaginary part
381
 
                FICC_MAG        = 8,    // Complex images: use magnitude
382
 
                FICC_PHASE      = 9             // Complex images: use phase
383
 
        }
384
 
 
385
 
        // Metadata support ---------------------------------------------------------
386
 
        
387
 
        /**
388
 
          Tag data type information (based on TIFF specifications)
389
 
        
390
 
          Note: RATIONALs are the ratio of two 32-bit integer values.
391
 
        */
392
 
        public enum FREE_IMAGE_MDTYPE {
393
 
                FIDT_NOTYPE             = 0,    // placeholder 
394
 
                FIDT_BYTE               = 1,    // 8-bit unsigned integer 
395
 
                FIDT_ASCII              = 2,    // 8-bit bytes w/ last byte null 
396
 
                FIDT_SHORT              = 3,    // 16-bit unsigned integer 
397
 
                FIDT_LONG               = 4,    // 32-bit unsigned integer 
398
 
                FIDT_RATIONAL   = 5,    // 64-bit unsigned fraction 
399
 
                FIDT_SBYTE              = 6,    // 8-bit signed integer 
400
 
                FIDT_UNDEFINED  = 7,    // 8-bit untyped data 
401
 
                FIDT_SSHORT             = 8,    // 16-bit signed integer 
402
 
                FIDT_SLONG              = 9,    // 32-bit signed integer 
403
 
                FIDT_SRATIONAL  = 10,   // 64-bit signed fraction 
404
 
                FIDT_FLOAT              = 11,   // 32-bit IEEE floating point 
405
 
                FIDT_DOUBLE             = 12,   // 64-bit IEEE floating point 
406
 
                FIDT_IFD                = 13,   // 32-bit unsigned integer (offset) 
407
 
                FIDT_PALETTE    = 14    // 32-bit RGBQUAD 
408
 
        };
409
 
 
410
 
        /**
411
 
          Metadata models supported by FreeImage
412
 
        */
413
 
        public enum FREE_IMAGE_MDMODEL {
414
 
                FIMD_NODATA                     = -1,
415
 
                FIMD_COMMENTS           = 0,    // single comment or keywords
416
 
                FIMD_EXIF_MAIN          = 1,    // Exif-TIFF metadata
417
 
                FIMD_EXIF_EXIF          = 2,    // Exif-specific metadata
418
 
                FIMD_EXIF_GPS           = 3,    // Exif GPS metadata
419
 
                FIMD_EXIF_MAKERNOTE = 4,        // Exif maker note metadata
420
 
                FIMD_EXIF_INTEROP       = 5,    // Exif interoperability metadata
421
 
                FIMD_IPTC                       = 6,    // IPTC/NAA metadata
422
 
                FIMD_XMP                        = 7,    // Abobe XMP metadata
423
 
                FIMD_GEOTIFF            = 8,    // GeoTIFF metadata
424
 
                FIMD_ANIMATION          = 9,    // Animation metadata
425
 
                FIMD_CUSTOM                     = 10    // Used to attach other metadata types to a dib
426
 
        };
427
 
 
428
 
 
429
 
        // Message output function --------------------------------------------------
430
 
 
431
 
        public delegate void FreeImage_OutputMessageFunction(FREE_IMAGE_FORMAT format, string msg);
432
 
        
433
 
        /**
434
 
          FreeImage API
435
 
          See the FreeImage PDF documentation for a definition of each function. 
436
 
        */
437
 
        public class FreeImage {
438
 
#if (DEBUG)
439
 
                private const string dllName = "FreeImaged.dll";
440
 
#else
441
 
                private const string dllName = "FreeImage.dll";
442
 
#endif
443
 
 
444
 
                // Init/Error routines ----------------------------------------
445
 
 
446
 
                [DllImport(dllName, EntryPoint="FreeImage_Initialise")]
447
 
                public static extern void Initialise(bool loadLocalPluginsOnly);
448
 
                
449
 
                // alias for Americans :)               
450
 
                [DllImport(dllName, EntryPoint="FreeImage_Initialise")]
451
 
                public static extern void Initialize(bool loadLocalPluginsOnly);
452
 
                
453
 
                [DllImport(dllName, EntryPoint="FreeImage_DeInitialise")]
454
 
                public static extern void DeInitialise();
455
 
                
456
 
                // alias for Americians :)
457
 
                [DllImport(dllName, EntryPoint="FreeImage_DeInitialise")]
458
 
                public static extern void DeInitialize();
459
 
                
460
 
                // Version routines -------------------------------------------
461
 
 
462
 
                [DllImport(dllName, EntryPoint="FreeImage_GetVersion")]
463
 
                public static extern string GetVersion();
464
 
                
465
 
                [DllImport(dllName, EntryPoint="FreeImage_GetCopyrightMessage")]
466
 
                public static extern string GetCopyrightMessage();
467
 
        
468
 
                // Message Output routines ------------------------------------
469
 
                
470
 
                [DllImport(dllName, EntryPoint="FreeImage_SetOutputMessage")]
471
 
                public static extern void SetOutputMessage(FreeImage_OutputMessageFunction omf);
472
 
                
473
 
                // Allocate / Clone / Unload routines ---------------------------------------
474
 
 
475
 
                [DllImport(dllName, EntryPoint="FreeImage_Allocate")]
476
 
                public static extern FIBITMAP Allocate(int width, int height, 
477
 
                                int bpp, uint red_mask, uint green_mask, uint blue_mask);
478
 
                
479
 
                [DllImport(dllName, EntryPoint="FreeImage_AllocateT")]
480
 
                public static extern FIBITMAP AllocateT(FREE_IMAGE_TYPE ftype, int width, 
481
 
                                int height, int bpp, uint red_mask, uint green_mask, uint blue_mask);
482
 
                
483
 
                [DllImport(dllName, EntryPoint="FreeImage_Clone")]
484
 
                public static extern FIBITMAP Clone(FIBITMAP dib);
485
 
                
486
 
                [DllImport(dllName, EntryPoint="FreeImage_Unload")]
487
 
                public static extern void Unload(FIBITMAP dib);
488
 
                
489
 
                // Load / Save routines -----------------------------------------------------
490
 
 
491
 
                [DllImport(dllName, EntryPoint="FreeImage_Load")]
492
 
                public static extern FIBITMAP Load(FREE_IMAGE_FORMAT format, string filename, int flags);
493
 
        
494
 
                // missing FIBITMAP FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif,
495
 
                //                              FreeImageIO *io, fi_handle handle, int flags);
496
 
 
497
 
                [DllImport(dllName, EntryPoint="FreeImage_Save")]
498
 
                public static extern bool Save(FREE_IMAGE_FORMAT format, FIBITMAP dib, string filename, int flags);
499
 
                
500
 
                // missing BOOL FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib,
501
 
                //                              FreeImageIO *io, fi_handle handle, int flags);
502
 
                
503
 
                // Memory I/O stream routines -----------------------------------------------
504
 
 
505
 
                [DllImport(dllName, EntryPoint="FreeImage_OpenMemory")] 
506
 
                public static extern FIMEMORY OpenMemory(IntPtr bits, Int32 size_in_bytes);  
507
 
 
508
 
                [DllImport(dllName, EntryPoint="FreeImage_CloseMemory")] 
509
 
                public static extern void CloseMemory(FIMEMORY stream); 
510
 
 
511
 
                [DllImport(dllName, EntryPoint="FreeImage_LoadFromMemory")] 
512
 
                public static extern FIBITMAP LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY stream, int flags); 
513
 
 
514
 
                [DllImport(dllName, EntryPoint="FreeImage_SaveToMemory")] 
515
 
                public static extern bool SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP dib, FIMEMORY stream, int flags); 
516
 
 
517
 
                [DllImport(dllName, EntryPoint="FreeImage_TellMemory")] 
518
 
                public static extern long TellMemory(FIMEMORY stream, int flags); 
519
 
 
520
 
                [DllImport(dllName, EntryPoint="FreeImage_SeekMemory")] 
521
 
                public static extern bool SeekMemory(FIMEMORY stream, long offset, int origin); 
522
 
 
523
 
                [DllImport(dllName, EntryPoint="FreeImage_AcquireMemory")] 
524
 
                public static extern long AcquireMemory(FIMEMORY stream, ref IntPtr data, ref int size_in_bytes); 
525
 
 
526
 
 
527
 
                // Plugin interface -------------------------------------------
528
 
 
529
 
                // missing FREE_IMAGE_FORMAT FreeImage_RegisterLocalPlugin(FI_InitProc proc_address, 
530
 
                //                              const char *format, const char *description, 
531
 
                //                              const char *extension, const char *regexpr);
532
 
                //
533
 
                // missing FREE_IMAGE_FORMAT FreeImage_RegisterExternalPlugin(const char *path,
534
 
                //                              const char *format, const char *description,
535
 
                //                              const char *extension, const char *regexpr);
536
 
                
537
 
                [DllImport(dllName, EntryPoint="FreeImage_GetFIFCount")]
538
 
                public static extern int GetFIFCount();
539
 
                
540
 
                [DllImport(dllName, EntryPoint="FreeImage_SetPluginEnabled")]
541
 
                public static extern int SetPluginEnabled(FREE_IMAGE_FORMAT format, bool enabled);
542
 
                
543
 
                [DllImport(dllName, EntryPoint="FreeImage_IsPluginEnabled")]
544
 
                public static extern int IsPluginEnabled(FREE_IMAGE_FORMAT format);
545
 
                
546
 
                [DllImport(dllName, EntryPoint="FreeImage_GetFIFFromFormat")]
547
 
                public static extern FREE_IMAGE_FORMAT GetFIFFromFormat(string format);
548
 
                
549
 
                [DllImport(dllName, EntryPoint="FreeImage_GetFIFFromMime")]
550
 
                public static extern FREE_IMAGE_FORMAT GetFIFFromMime(string mime);
551
 
                
552
 
                [DllImport(dllName, EntryPoint="FreeImage_GetFormatFromFIF")]
553
 
                public static extern string GetFormatFromFIF(FREE_IMAGE_FORMAT format);
554
 
                
555
 
                [DllImport(dllName, EntryPoint="FreeImage_GetFIFExtensionList")]
556
 
                public static extern string GetFIFExtensionList(FREE_IMAGE_FORMAT format);
557
 
                
558
 
                [DllImport(dllName, EntryPoint="FreeImage_GetFIFDescription")]
559
 
                public static extern string GetFIFDescription(FREE_IMAGE_FORMAT format);
560
 
                
561
 
                [DllImport(dllName, EntryPoint="FreeImage_GetFIFRegExpr")]
562
 
                public static extern string GetFIFRegExpr(FREE_IMAGE_FORMAT format);
563
 
                
564
 
                [DllImport(dllName, EntryPoint="FreeImage_GetFIFFromFilename")]
565
 
                public static extern FREE_IMAGE_FORMAT GetFIFFromFilename(string filename);
566
 
                
567
 
                [DllImport(dllName, EntryPoint="FreeImage_FIFSupportsReading")]
568
 
                public static extern bool FIFSupportsReading(FREE_IMAGE_FORMAT format);
569
 
                
570
 
                [DllImport(dllName, EntryPoint="FreeImage_FIFSupportsWriting")]
571
 
                public static extern bool FIFSupportsWriting(FREE_IMAGE_FORMAT format);
572
 
                
573
 
                [DllImport(dllName, EntryPoint="FreeImage_FIFSupportsExportBPP")]
574
 
                public static extern bool FIFSupportsExportBPP(FREE_IMAGE_FORMAT format, int bpp);
575
 
                
576
 
                [DllImport(dllName, EntryPoint="FreeImage_FIFSupportsExportType")]
577
 
                public static extern bool FIFSupportsExportType(FREE_IMAGE_FORMAT format, FREE_IMAGE_TYPE ftype);
578
 
                
579
 
                [DllImport(dllName, EntryPoint="FreeImage_FIFSupportsICCProfiles")]
580
 
                public static extern bool FIFSupportsICCProfiles(FREE_IMAGE_FORMAT format, FREE_IMAGE_TYPE ftype);
581
 
 
582
 
                // Multipage interface ----------------------------------------
583
 
 
584
 
                [DllImport(dllName, EntryPoint="FreeImage_OpenMultiBitmap")]
585
 
                public static extern FIMULTIBITMAP OpenMultiBitmap(
586
 
                        FREE_IMAGE_FORMAT format, string filename, bool createNew, bool readOnly, bool keepCacheInMemory, int flags);
587
 
                
588
 
                [DllImport(dllName, EntryPoint="FreeImage_CloseMultiBitmap")]
589
 
                public static extern long CloseMultiBitmap(FIMULTIBITMAP bitmap, int flags);
590
 
                
591
 
                [DllImport(dllName, EntryPoint="FreeImage_GetPageCount")]
592
 
                public static extern int GetPageCount(FIMULTIBITMAP bitmap);
593
 
                
594
 
                [DllImport(dllName, EntryPoint="FreeImage_AppendPage")]
595
 
                public static extern void AppendPage(FIMULTIBITMAP bitmap, FIBITMAP data);
596
 
                
597
 
                [DllImport(dllName, EntryPoint="FreeImage_InsertPage")]
598
 
                public static extern void InsertPage(FIMULTIBITMAP bitmap, int page, FIBITMAP data);
599
 
                
600
 
                [DllImport(dllName, EntryPoint="FreeImage_DeletePage")]
601
 
                public static extern void DeletePage(FIMULTIBITMAP bitmap, int page);
602
 
                
603
 
                [DllImport(dllName, EntryPoint="FreeImage_LockPage")]
604
 
                public static extern FIBITMAP LockPage(FIMULTIBITMAP bitmap, int page);
605
 
                
606
 
                [DllImport(dllName, EntryPoint="FreeImage_UnlockPage")]
607
 
                public static extern void UnlockPage(FIMULTIBITMAP bitmap, FIBITMAP data, bool changed);
608
 
                
609
 
                [DllImport(dllName, EntryPoint="FreeImage_MovePage")]
610
 
                public static extern bool MovePage(FIMULTIBITMAP bitmap, int target, int source);
611
 
                
612
 
                [DllImport(dllName, EntryPoint="FreeImage_GetLockedPageNumbers")]
613
 
                public static extern bool GetLockedPageNumbers(FIMULTIBITMAP bitmap, IntPtr pages, IntPtr count);
614
 
                
615
 
                // File type request routines ---------------------------------
616
 
 
617
 
                [DllImport(dllName, EntryPoint="FreeImage_GetFileType")]
618
 
                public static extern FREE_IMAGE_FORMAT GetFileType(string filename, int size);
619
 
 
620
 
                // missing FREE_IMAGE_FORMAT FreeImage_GetFileTypeFromHandle(FreeImageIO *io,
621
 
                //                      fi_handle handle, int size);
622
 
 
623
 
                [DllImport(dllName, EntryPoint="FreeImage_GetFileTypeFromMemory")]
624
 
                public static extern FREE_IMAGE_FORMAT GetFileTypeFromMemory(FIMEMORY stream, int size);
625
 
 
626
 
                // Image type request routines --------------------------------
627
 
 
628
 
                [DllImport(dllName, EntryPoint="FreeImage_GetImageType")]
629
 
                public static extern FREE_IMAGE_TYPE GetImageType(FIBITMAP dib);
630
 
                
631
 
                // FreeImage helper routines ------------------------------------------------
632
 
 
633
 
                [DllImport(dllName, EntryPoint="FreeImage_IsLittleEndian")]
634
 
                public static extern bool IsLittleEndian();
635
 
                
636
 
                [DllImport(dllName, EntryPoint="FreeImage_LookupX11Color")]
637
 
                public static extern bool LookupX11Color(string szColor, ref int red, ref int green, ref int blue);
638
 
 
639
 
                [DllImport(dllName, EntryPoint="FreeImage_LookupSVGColor")]
640
 
                public static extern bool LookupSVGColor(string szColor, ref int red, ref int green, ref int blue);
641
 
 
642
 
                // Pixel access functions -------------------------------------
643
 
 
644
 
                [DllImport(dllName, EntryPoint="FreeImage_GetBits")]
645
 
                public static extern IntPtr GetBits(FIBITMAP dib);
646
 
                
647
 
                [DllImport(dllName, EntryPoint="FreeImage_GetScanLine")]
648
 
                public static extern IntPtr GetScanLine(FIBITMAP dib, int scanline);
649
 
                
650
 
                [DllImport(dllName, EntryPoint="FreeImage_GetPixelIndex")]
651
 
                public static extern bool GetPixelIndex(FIBITMAP dib, uint x, uint y, ref byte value);
652
 
                
653
 
                [DllImport(dllName, EntryPoint="FreeImage_GetPixelColor")]
654
 
                public static extern bool GetPixelColor(FIBITMAP dib, uint x, uint y, 
655
 
                        [Out, MarshalAs(UnmanagedType.LPStruct)]RGBQUAD value);
656
 
                
657
 
                [DllImport(dllName, EntryPoint="FreeImage_SetPixelIndex")]
658
 
                public static extern bool SetPixelIndex(FIBITMAP dib, uint x, uint y, ref byte value);
659
 
 
660
 
                [DllImport(dllName, EntryPoint="FreeImage_SetPixelColor")]
661
 
                public static extern bool SetPixelColor(FIBITMAP dib, uint x, uint y, 
662
 
                        [In, MarshalAs(UnmanagedType.LPStruct)] RGBQUAD value);
663
 
 
664
 
                // DIB info routines --------------------------------------------------------
665
 
                
666
 
                [DllImport(dllName, EntryPoint="FreeImage_GetColorsUsed")]
667
 
                public static extern uint GetColorsUsed(FIBITMAP dib);
668
 
                
669
 
                [DllImport(dllName, EntryPoint="FreeImage_GetBPP")]
670
 
                public static extern uint GetBPP(FIBITMAP dib);
671
 
                
672
 
                [DllImport(dllName, EntryPoint="FreeImage_GetWidth")]
673
 
                public static extern uint GetWidth(FIBITMAP dib);
674
 
                
675
 
                [DllImport(dllName, EntryPoint="FreeImage_GetHeight")]
676
 
                public static extern uint GetHeight(FIBITMAP dib);
677
 
                
678
 
                [DllImport(dllName, EntryPoint="FreeImage_GetLine")]
679
 
                public static extern uint GetLine(FIBITMAP dib);
680
 
                
681
 
                [DllImport(dllName, EntryPoint="FreeImage_GetPitch")]
682
 
                public static extern uint GetPitch(FIBITMAP dib);
683
 
                
684
 
                [DllImport(dllName, EntryPoint="FreeImage_GetDIBSize")]
685
 
                public static extern uint GetDIBSize(FIBITMAP dib);
686
 
                
687
 
                /**
688
 
                Returns a pointer to the bitmapļæ½s palette. If the bitmap doesnļæ½t have a palette 
689
 
                (i.e. when the pixel bit depth is greater than 8), this function returns NULL. 
690
 
                @param dib Bitmap to get the palette for.
691
 
                @return Pointer to the start of the palette data.
692
 
                */
693
 
                [DllImport(dllName, EntryPoint="FreeImage_GetPalette")] 
694
 
                private static extern UIntPtr GetRawPalette(FIBITMAP dib);
695
 
 
696
 
                /**
697
 
                Get a deep copy of the image palette.
698
 
                @param bitmap Pointer to a loaded image.
699
 
                @return Array or RGBQUAD values representing the image palette.
700
 
                */
701
 
                public static unsafe RGBQUAD [] GetPaletteCopy(FIBITMAP dib) {  
702
 
                        RGBQUAD [] paletteCopy = new FreeImageAPI.RGBQUAD[256];  
703
 
 
704
 
                        // Only interested in indexed images. 
705
 
                        if (GetBPP(dib) <= 8) { 
706
 
                                UIntPtr palette = GetRawPalette(dib);  
707
 
                                byte * ptr = (byte *)(void*)palette; 
708
 
                                for (int q = 0; q < 256; q++) { 
709
 
                                        paletteCopy[q] = new FreeImageAPI.RGBQUAD(); 
710
 
                                        paletteCopy[q].rgbBlue = (byte)*ptr; 
711
 
                                        ptr += 1;  
712
 
                                        paletteCopy[q].rgbGreen = (byte)*ptr; 
713
 
                                        ptr += 1;  
714
 
                                        paletteCopy[q].rgbRed = (byte)*ptr; 
715
 
                                        ptr += 1;  
716
 
                                        paletteCopy[q].rgbReserved = (byte)*ptr; 
717
 
                                        ptr += 1;  
718
 
                                }  
719
 
                        } 
720
 
 
721
 
                        return paletteCopy; 
722
 
                } 
723
 
                
724
 
                [DllImport(dllName, EntryPoint="FreeImage_GetDotsPerMeterX")]
725
 
                public static extern uint GetDotsPerMeterX(FIBITMAP dib);
726
 
                
727
 
                [DllImport(dllName, EntryPoint="FreeImage_GetDotsPerMeterY")]
728
 
                public static extern uint GetDotsPerMeterY(FIBITMAP dib);
729
 
                
730
 
                [DllImport(dllName, EntryPoint="FreeImage_SetDotsPerMeterX")]
731
 
                public static extern void SetDotsPerMeterX(FIBITMAP dib, uint res);
732
 
                
733
 
                [DllImport(dllName, EntryPoint="FreeImage_SetDotsPerMeterY")]
734
 
                public static extern void SetDotsPerMeterY(FIBITMAP dib, uint res);
735
 
 
736
 
                [DllImport(dllName, EntryPoint = "FreeImage_GetInfoHeader")]
737
 
                public static extern IntPtr FreeImage_GetInfoHeader(FIBITMAP dib);
738
 
 
739
 
                [DllImport(dllName, EntryPoint = "FreeImage_GetInfo")]
740
 
                public static extern IntPtr FreeImage_GetInfo(FIBITMAP dib);
741
 
 
742
 
                [DllImport(dllName, EntryPoint="FreeImage_GetColorType")]
743
 
                public static extern FREE_IMAGE_COLOR_TYPE GetColorType(FIBITMAP dib);
744
 
                
745
 
                [DllImport(dllName, EntryPoint="FreeImage_GetRedMask")]
746
 
                public static extern uint GetRedMask(FIBITMAP dib);
747
 
                
748
 
                [DllImport(dllName, EntryPoint="FreeImage_GetGreenMask")]
749
 
                public static extern uint GetGreenMask(FIBITMAP dib);
750
 
                
751
 
                [DllImport(dllName, EntryPoint="FreeImage_GetBlueMask")]
752
 
                public static extern uint GetBlueMask(FIBITMAP dib);
753
 
                
754
 
                [DllImport(dllName, EntryPoint="FreeImage_GetTransparencyCount")]
755
 
                public static extern uint GetTransparencyCount(FIBITMAP dib);
756
 
                
757
 
                [DllImport(dllName, EntryPoint="FreeImage_GetTransparencyTable")]
758
 
                public static extern IntPtr GetTransparencyTable(FIBITMAP dib);
759
 
                
760
 
                [DllImport(dllName, EntryPoint="FreeImage_SetTransparent")]
761
 
                public static extern void SetTransparent(FIBITMAP dib, bool enabled);
762
 
                
763
 
                [DllImport(dllName, EntryPoint="FreeImage_SetTransparencyTable")]
764
 
                public static extern void SetTransparencyTable(FIBITMAP dib, IntPtr table, int count);
765
 
 
766
 
                [DllImport(dllName, EntryPoint="FreeImage_IsTransparent")]
767
 
                public static extern bool IsTransparent(FIBITMAP dib);
768
 
                
769
 
                [DllImport(dllName, EntryPoint="FreeImage_HasBackgroundColor")]
770
 
                public static extern bool HasBackgroundColor(FIBITMAP dib);
771
 
 
772
 
                [DllImport(dllName, EntryPoint="FreeImage_GetBackgroundColor")]
773
 
                public static extern bool GetBackgroundColor(FIBITMAP dib, 
774
 
                        [Out, MarshalAs(UnmanagedType.LPStruct)]RGBQUAD bkcolor);
775
 
 
776
 
                [DllImport(dllName, EntryPoint="FreeImage_SetBackgroundColor")]
777
 
                public static extern bool SetBackgroundColor(FIBITMAP dib, 
778
 
                        [In, MarshalAs(UnmanagedType.LPStruct)]RGBQUAD bkcolor);
779
 
 
780
 
                // ICC profile routines -----------------------------------------------------
781
 
 
782
 
                [DllImport(dllName,EntryPoint="FreeImage_DestroyICCProfile")]
783
 
                public static extern void DestroyICCProfile(FIBITMAP dib);
784
 
 
785
 
                [DllImport(dllName,EntryPoint="FreeImage_GetICCProfile")]
786
 
                public static extern FIICCPROFILE GetICCProfile(FIBITMAP dib);
787
 
                
788
 
                [DllImport(dllName,EntryPoint="FreeImage_CreateICCProfile")]
789
 
                public static extern FIICCPROFILE CreateICCProfile(FIBITMAP dib, IntPtr data, uint size);
790
 
 
791
 
                // Smart conversion routines ------------------------------------------------
792
 
 
793
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertTo4Bits")]
794
 
                public static extern FIBITMAP ConvertTo4Bits(FIBITMAP dib);
795
 
 
796
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertTo8Bits")]
797
 
                public static extern FIBITMAP ConvertTo8Bits(FIBITMAP dib);
798
 
 
799
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertTo16Bits555")]
800
 
                public static extern FIBITMAP ConvertTo16Bits555(FIBITMAP dib);
801
 
 
802
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertTo16Bits565")]
803
 
                public static extern FIBITMAP ConvertTo16Bits565(FIBITMAP dib);
804
 
 
805
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertTo24Bits")]
806
 
                public static extern FIBITMAP ConvertTo24Bits(FIBITMAP dib);
807
 
 
808
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertTo32Bits")]
809
 
                public static extern FIBITMAP ConvertTo32Bits(FIBITMAP dib);
810
 
 
811
 
                [DllImport(dllName, EntryPoint="FreeImage_ColorQuantize")]
812
 
                public static extern FIBITMAP ColorQuantize(FIBITMAP dib, FREE_IMAGE_QUANTIZE quantize);
813
 
 
814
 
                [DllImport(dllName, EntryPoint="FreeImage_Threshold")]
815
 
                public static extern FIBITMAP Threshold(FIBITMAP dib, uint T);
816
 
 
817
 
                [DllImport(dllName, EntryPoint="FreeImage_Dither")]
818
 
                public static extern FIBITMAP Dither(FIBITMAP dib, FREE_IMAGE_DITHER algorithm);
819
 
                
820
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertFromRawBits")]
821
 
                public static extern FIBITMAP ConvertFromRawBits(byte[] bits, int width, int height,
822
 
                        int pitch, uint bpp, uint redMask, uint greenMask, uint blueMask, bool topDown);
823
 
 
824
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertToRawBits")]
825
 
                public static extern void ConvertToRawBits(IntPtr bits, FIBITMAP dib, int pitch,
826
 
                        uint bpp, uint redMask, uint greenMask, uint blueMask, bool topDown);
827
 
 
828
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertToStandardType")]
829
 
                public static extern FIBITMAP ConvertToStandardType(FIBITMAP dib, FREE_IMAGE_TYPE dst_type, bool scale_linear);
830
 
 
831
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertToType")]
832
 
                public static extern FIBITMAP ConvertToType(FIBITMAP dib, FREE_IMAGE_TYPE dst_type, bool scale_linear);
833
 
 
834
 
                [DllImport(dllName, EntryPoint="FreeImage_ConvertToRGBF")]
835
 
                public static extern FIBITMAP ConvertToRGBF(FIBITMAP dib);
836
 
 
837
 
                [DllImport(dllName, EntryPoint="FreeImage_ToneMapping")]
838
 
                public static extern FIBITMAP ToneMapping(FIBITMAP dib, FREE_IMAGE_TMO tmo, double first_param, double second_param);
839
 
 
840
 
                [DllImport(dllName, EntryPoint="FreeImage_TmoDrago03")]
841
 
                public static extern FIBITMAP TmoDrago03(FIBITMAP dib, double gamma, double exposure);
842
 
 
843
 
                [DllImport(dllName, EntryPoint="FreeImage_TmoReinhard05")]
844
 
                public static extern FIBITMAP TmoReinhard05(FIBITMAP dib, double intensity, double contrast);
845
 
 
846
 
                // ZLib interface -----------------------------------------------------------
847
 
 
848
 
                [DllImport(dllName, EntryPoint="FreeImage_ZLibCompress")]
849
 
                public static extern Int32 ZLibCompress(IntPtr target, Int32 target_size, IntPtr source, Int32 source_size);
850
 
 
851
 
                [DllImport(dllName, EntryPoint="FreeImage_ZLibUncompress")]
852
 
                public static extern Int32 ZLibUncompress(IntPtr target, Int32 target_size, IntPtr source, Int32 source_size);
853
 
 
854
 
                [DllImport(dllName, EntryPoint="FreeImage_ZLibGZip")]
855
 
                public static extern Int32 ZLibGZip(IntPtr target, Int32 target_size, IntPtr source, Int32 source_size);
856
 
                
857
 
                [DllImport(dllName, EntryPoint="FreeImage_ZLibGUnzip")]
858
 
                public static extern Int32 ZLibGUnzip(IntPtr target, Int32 target_size, IntPtr source, Int32 source_size);
859
 
                
860
 
                [DllImport(dllName, EntryPoint="FreeImage_ZLibCRC32")]
861
 
                public static extern Int32 ZLibCRC32(Int32 crc, IntPtr source, Int32 source_size);
862
 
 
863
 
                // --------------------------------------------------------------------------
864
 
                // Image manipulation toolkit -----------------------------------------------
865
 
                // --------------------------------------------------------------------------
866
 
 
867
 
                // rotation and flipping
868
 
                
869
 
                [DllImport(dllName, EntryPoint="FreeImage_RotateClassic")]
870
 
                public static extern FIBITMAP RotateClassic(FIBITMAP dib, double angle);
871
 
                
872
 
                [DllImport(dllName, EntryPoint="FreeImage_RotateEx")]
873
 
                public static extern FIBITMAP RotateEx(
874
 
                        FIBITMAP dib, double angle, double xShift, double yShift, double xOrigin, double yOrigin, bool useMask);
875
 
                
876
 
                [DllImport(dllName, EntryPoint="FreeImage_FlipHorizontal")]
877
 
                public static extern bool FlipHorizontal(FIBITMAP dib);
878
 
                
879
 
                [DllImport(dllName, EntryPoint="FreeImage_FlipVertical")]
880
 
                public static extern bool FlipVertical(FIBITMAP dib);
881
 
 
882
 
                [DllImport(dllName, EntryPoint="FreeImage_JPEGTransform")]
883
 
                public static extern bool JPEGTransform(string src_file, string dst_file, FREE_IMAGE_JPEG_OPERATION operation, bool perfect);
884
 
 
885
 
                // upsampling / downsampling
886
 
                
887
 
                [DllImport(dllName, EntryPoint="FreeImage_Rescale")]
888
 
                public static extern FIBITMAP Rescale(FIBITMAP dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter);
889
 
                
890
 
                // color manipulation routines (point operations)               
891
 
                
892
 
                [DllImport(dllName, EntryPoint="FreeImage_AdjustCurve")]
893
 
                public static extern bool AdjustCurve(FIBITMAP dib, byte[] lut, FREE_IMAGE_COLOR_CHANNEL channel);
894
 
                
895
 
                [DllImport(dllName, EntryPoint="FreeImage_AdjustGamma")]
896
 
                public static extern bool AdjustGamma(FIBITMAP dib, double gamma);
897
 
                
898
 
                [DllImport(dllName, EntryPoint="FreeImage_AdjustBrightness")]
899
 
                public static extern bool AdjustBrightness(FIBITMAP dib, double percentage);
900
 
                
901
 
                [DllImport(dllName, EntryPoint="FreeImage_AdjustContrast")]
902
 
                public static extern bool AdjustContrast(FIBITMAP dib, double percentage);
903
 
                
904
 
                [DllImport(dllName, EntryPoint="FreeImage_Invert")]
905
 
                public static extern bool Invert(FIBITMAP dib);
906
 
                
907
 
                [DllImport(dllName, EntryPoint="FreeImage_GetHistogram")]
908
 
                public static extern bool GetHistogram(FIBITMAP dib, IntPtr histo, FREE_IMAGE_COLOR_CHANNEL channel);
909
 
                
910
 
                // channel processing routines
911
 
 
912
 
                [DllImport(dllName, EntryPoint="FreeImage_GetChannel")]
913
 
                public static extern FIBITMAP GetChannel(FIBITMAP dib, FREE_IMAGE_COLOR_CHANNEL channel);
914
 
                
915
 
                [DllImport(dllName, EntryPoint="FreeImage_SetChannel")]
916
 
                public static extern bool SetChannel(FIBITMAP dib, FIBITMAP dib8, FREE_IMAGE_COLOR_CHANNEL channel);
917
 
                
918
 
                // copy / paste / composite routines
919
 
                
920
 
                [DllImport(dllName, EntryPoint="FreeImage_Copy")]
921
 
                public static extern FIBITMAP Copy(FIBITMAP dib, int left, int top, int right, int bottom);
922
 
                
923
 
                [DllImport(dllName, EntryPoint="FreeImage_Paste")]
924
 
                public static extern bool Paste(FIBITMAP dst, FIBITMAP src, int left, int top, int alpha);
925
 
 
926
 
                [DllImport(dllName, EntryPoint="FreeImage_Composite")]
927
 
                public static extern FIBITMAP Composite(FIBITMAP fg, bool useFileBkg, 
928
 
                        [In, MarshalAs(UnmanagedType.LPStruct)] RGBQUAD appBkColor, FIBITMAP bg);
929
 
        }
930
 
}