~ubuntu-branches/ubuntu/jaunty/freeimage/jaunty

« back to all changes in this revision

Viewing changes to FreeImage/Wrapper/Delphi/src/FreeImage.pas

  • Committer: Bazaar Package Importer
  • Author(s): Federico Di Gregorio
  • Date: 2007-05-07 15:35:21 UTC
  • Revision ID: james.westby@ubuntu.com-20070507153521-m4lx765bzxxug9qf
Tags: upstream-3.9.3
ImportĀ upstreamĀ versionĀ 3.9.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
unit FreeImage;
 
2
 
 
3
// ==========================================================
 
4
// Delphi wrapper for FreeImage 3
 
5
//
 
6
// Design and implementation by
 
7
// - Simon Beavis
 
8
// - Peter Bystrļæ½m
 
9
// - Anatoliy Pulyaevskiy (xvel84@rambler.ru)
 
10
//
 
11
// This file is part of FreeImage 3
 
12
//
 
13
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
 
14
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
 
15
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
 
16
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
 
17
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
 
18
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
 
19
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
 
20
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
 
21
// THIS DISCLAIMER.
 
22
//
 
23
// Use at your own risk!
 
24
// ==========================================================
 
25
 
 
26
interface
 
27
 
 
28
uses Windows;
 
29
 
 
30
{$MINENUMSIZE 4} // Make sure enums are stored as an integer to be compatible with C/C++
 
31
 
 
32
const
 
33
  FIDLL = 'FreeImage.dll';
 
34
  
 
35
// --------------------------------------------------------------------------
 
36
// Bitmap types -------------------------------------------------------------
 
37
// --------------------------------------------------------------------------
 
38
 
 
39
type
 
40
  FIBITMAP = record
 
41
    data : Pointer;
 
42
  end;
 
43
  PFIBITMAP = ^FIBITMAP;
 
44
 
 
45
  FIMULTIBITMAP = record
 
46
    data : Pointer;
 
47
  end;
 
48
  PFIMULTIBITMAP = ^FIMULTIBITMAP;
 
49
 
 
50
// --------------------------------------------------------------------------
 
51
// Indexes for byte arrays, masks and shifts for treating pixels as words ---
 
52
// These coincide with the order of RGBQUAD and RGBTRIPLE -------------------
 
53
// Little Endian (x86 / MS Windows, Linux) : BGR(A) order -------------------
 
54
// --------------------------------------------------------------------------
 
55
 
 
56
const
 
57
  FI_RGBA_RED         = 2;
 
58
  FI_RGBA_GREEN       = 1;
 
59
  FI_RGBA_BLUE        = 0;
 
60
  FI_RGBA_ALPHA       = 3;
 
61
  FI_RGBA_RED_MASK    = $00FF0000;
 
62
  FI_RGBA_GREEN_MASK  = $0000FF00;
 
63
  FI_RGBA_BLUE_MASK   = $000000FF;
 
64
  FI_RGBA_ALPHA_MASK  = $FF000000;
 
65
  FI_RGBA_RED_SHIFT   = 16;
 
66
  FI_RGBA_GREEN_SHIFT = 8;
 
67
  FI_RGBA_BLUE_SHIFT  = 0;
 
68
  FI_RGBA_ALPHA_SHIFT = 24;
 
69
 
 
70
// --------------------------------------------------------------------------
 
71
// The 16bit macros only include masks and shifts, --------------------------
 
72
// since each color element is not byte aligned -----------------------------
 
73
// --------------------------------------------------------------------------
 
74
 
 
75
const
 
76
  FI16_555_RED_MASK              = $7C00;
 
77
  FI16_555_GREEN_MASK    = $03E0;
 
78
  FI16_555_BLUE_MASK     = $001F;
 
79
  FI16_555_RED_SHIFT     = 10;
 
80
  FI16_555_GREEN_SHIFT = 5;
 
81
  FI16_555_BLUE_SHIFT    = 0;
 
82
  FI16_565_RED_MASK              = $F800;
 
83
  FI16_565_GREEN_MASK    = $07E0;
 
84
  FI16_565_BLUE_MASK     = $001F;
 
85
  FI16_565_RED_SHIFT     = 11;
 
86
  FI16_565_GREEN_SHIFT = 5;
 
87
  FI16_565_BLUE_SHIFT    = 0;
 
88
 
 
89
// --------------------------------------------------------------------------
 
90
// ICC profile support ------------------------------------------------------
 
91
// --------------------------------------------------------------------------
 
92
 
 
93
const
 
94
  FIICC_DEFAULT = $0;
 
95
  FIICC_COLOR_IS_CMYK   = $1;
 
96
 
 
97
type
 
98
  FIICCPROFILE = record
 
99
    flags : WORD;   // info flag
 
100
    size : DWORD;   // profile's size measured in bytes
 
101
    data : Pointer; // points to a block of contiguous memory containing the profile
 
102
  end;
 
103
  PFIICCPROFILE = ^FIICCPROFILE;
 
104
 
 
105
// --------------------------------------------------------------------------
 
106
// Important enums ----------------------------------------------------------
 
107
// --------------------------------------------------------------------------
 
108
 
 
109
type
 
110
  FREE_IMAGE_FORMAT         = type Integer;
 
111
  FREE_IMAGE_TYPE           = type Integer;
 
112
  FREE_IMAGE_COLOR_TYPE     = type Integer;
 
113
  FREE_IMAGE_QUANTIZE       = type Integer;
 
114
  FREE_IMAGE_DITHER         = type Integer;
 
115
  FREE_IMAGE_FILTER         = type Integer;
 
116
  FREE_IMAGE_COLOR_CHANNEL  = type Integer;
 
117
  FREE_IMAGE_MDTYPE         = type Integer;
 
118
  FREE_IMAGE_MDMODEL        = type Integer;
 
119
  FREE_IMAGE_JPEG_OPERATION = type Integer;
 
120
  FREE_IMAGE_TMO            = type Integer;
 
121
 
 
122
const
 
123
  // I/O image format identifiers.
 
124
  FIF_UNKNOWN = FREE_IMAGE_FORMAT(-1);
 
125
  FIF_BMP     = FREE_IMAGE_FORMAT(0);
 
126
  FIF_ICO     = FREE_IMAGE_FORMAT(1);
 
127
  FIF_JPEG    = FREE_IMAGE_FORMAT(2);
 
128
  FIF_JNG     = FREE_IMAGE_FORMAT(3);
 
129
  FIF_KOALA   = FREE_IMAGE_FORMAT(4);
 
130
  FIF_LBM     = FREE_IMAGE_FORMAT(5);
 
131
  FIF_IFF     = FIF_LBM;
 
132
  FIF_MNG     = FREE_IMAGE_FORMAT(6);
 
133
  FIF_PBM     = FREE_IMAGE_FORMAT(7);
 
134
  FIF_PBMRAW  = FREE_IMAGE_FORMAT(8);
 
135
  FIF_PCD     = FREE_IMAGE_FORMAT(9);
 
136
  FIF_PCX     = FREE_IMAGE_FORMAT(10);
 
137
  FIF_PGM     = FREE_IMAGE_FORMAT(11);
 
138
  FIF_PGMRAW  = FREE_IMAGE_FORMAT(12);
 
139
  FIF_PNG     = FREE_IMAGE_FORMAT(13);
 
140
  FIF_PPM     = FREE_IMAGE_FORMAT(14);
 
141
  FIF_PPMRAW  = FREE_IMAGE_FORMAT(15);
 
142
  FIF_RAS     = FREE_IMAGE_FORMAT(16);
 
143
  FIF_TARGA   = FREE_IMAGE_FORMAT(17);
 
144
  FIF_TIFF    = FREE_IMAGE_FORMAT(18);
 
145
  FIF_WBMP    = FREE_IMAGE_FORMAT(19);
 
146
  FIF_PSD     = FREE_IMAGE_FORMAT(20);
 
147
  FIF_CUT     = FREE_IMAGE_FORMAT(21);
 
148
  FIF_XBM     = FREE_IMAGE_FORMAT(22);
 
149
  FIF_XPM     = FREE_IMAGE_FORMAT(23);
 
150
  FIF_DDS     = FREE_IMAGE_FORMAT(24);
 
151
  FIF_GIF     = FREE_IMAGE_FORMAT(25);
 
152
  FIF_HDR     = FREE_IMAGE_FORMAT(26);
 
153
  FIF_FAXG3   = FREE_IMAGE_FORMAT(27);
 
154
  FIF_SGI     = FREE_IMAGE_FORMAT(28);  
 
155
 
 
156
  // Image type used in FreeImage.
 
157
  FIT_UNKNOWN = FREE_IMAGE_TYPE(0);  // unknown type
 
158
  FIT_BITMAP  = FREE_IMAGE_TYPE(1);      // standard image: 1-, 4-, 8-, 16-, 24-, 32-bit
 
159
  FIT_UINT16  = FREE_IMAGE_TYPE(2);      // array of unsigned short: unsigned 16-bit
 
160
  FIT_INT16   = FREE_IMAGE_TYPE(3);  // array of short: signed 16-bit
 
161
  FIT_UINT32  = FREE_IMAGE_TYPE(4);      // array of unsigned long: unsigned 32-bit
 
162
  FIT_INT32   = FREE_IMAGE_TYPE(5);      // array of long: signed 32-bit
 
163
  FIT_FLOAT   = FREE_IMAGE_TYPE(6);      // array of float: 32-bit IEEE floating point
 
164
  FIT_DOUBLE  = FREE_IMAGE_TYPE(7);      // array of double: 64-bit IEEE floating point
 
165
  FIT_COMPLEX = FREE_IMAGE_TYPE(8);      // array of FICOMPLEX: 2 x 64-bit IEEE floating point
 
166
  FIT_RGB16       = FREE_IMAGE_TYPE(9);  // 48-bit RGB image: 3 x 16-bit
 
167
        FIT_RGBA16      = FREE_IMAGE_TYPE(10); // 64-bit RGBA image: 4 x 16-bit
 
168
        FIT_RGBF          = FREE_IMAGE_TYPE(11); // 96-bit RGB float image: 3 x 32-bit IEEE floating point
 
169
        FIT_RGBAF         = FREE_IMAGE_TYPE(12); // 128-bit RGBA float image: 4 x 32-bit IEEE floating point
 
170
 
 
171
  // Image color type used in FreeImage.
 
172
  FIC_MINISWHITE = FREE_IMAGE_COLOR_TYPE(0); // min value is white
 
173
  FIC_MINISBLACK = FREE_IMAGE_COLOR_TYPE(1); // min value is black
 
174
  FIC_RGB        = FREE_IMAGE_COLOR_TYPE(2); // RGB color model
 
175
  FIC_PALETTE    = FREE_IMAGE_COLOR_TYPE(3); // color map indexed
 
176
  FIC_RGBALPHA   = FREE_IMAGE_COLOR_TYPE(4); // RGB color model with alpha channel
 
177
  FIC_CMYK       = FREE_IMAGE_COLOR_TYPE(5); // CMYK color model
 
178
 
 
179
  // Color quantization algorithms. Constants used in FreeImage_ColorQuantize.
 
180
  FIQ_WUQUANT = FREE_IMAGE_QUANTIZE(0); // Xiaolin Wu color quantization algorithm
 
181
  FIQ_NNQUANT = FREE_IMAGE_QUANTIZE(1); // NeuQuant neural-net quantization algorithm by Anthony Dekker
 
182
 
 
183
  // Dithering algorithms. Constants used FreeImage_Dither.
 
184
  FID_FS            = FREE_IMAGE_DITHER(0);     // Floyd & Steinberg error diffusion
 
185
  FID_BAYER4x4      = FREE_IMAGE_DITHER(1);     // Bayer ordered dispersed dot dithering (order 2 dithering matrix)
 
186
  FID_BAYER8x8      = FREE_IMAGE_DITHER(2);     // Bayer ordered dispersed dot dithering (order 3 dithering matrix)
 
187
  FID_CLUSTER6x6    = FREE_IMAGE_DITHER(3);     // Ordered clustered dot dithering (order 3 - 6x6 matrix)
 
188
  FID_CLUSTER8x8    = FREE_IMAGE_DITHER(4);     // Ordered clustered dot dithering (order 4 - 8x8 matrix)
 
189
  FID_CLUSTER16x16  = FREE_IMAGE_DITHER(5); // Ordered clustered dot dithering (order 8 - 16x16 matrix)
 
190
 
 
191
  // Lossless JPEG transformations Constants used in FreeImage_JPEGTransform
 
192
        FIJPEG_OP_NONE                    = FREE_IMAGE_JPEG_OPERATION(0);       // no transformation
 
193
        FIJPEG_OP_FLIP_H                  = FREE_IMAGE_JPEG_OPERATION(1);       // horizontal flip
 
194
        FIJPEG_OP_FLIP_V                  = FREE_IMAGE_JPEG_OPERATION(2);       // vertical flip
 
195
        FIJPEG_OP_TRANSPOSE             = FREE_IMAGE_JPEG_OPERATION(3); // transpose across UL-to-LR axis
 
196
        FIJPEG_OP_TRANSVERSE    = FREE_IMAGE_JPEG_OPERATION(4); // transpose across UR-to-LL axis
 
197
        FIJPEG_OP_ROTATE_90             = FREE_IMAGE_JPEG_OPERATION(5); // 90-degree clockwise rotation
 
198
        FIJPEG_OP_ROTATE_180    = FREE_IMAGE_JPEG_OPERATION(6); // 180-degree rotation
 
199
        FIJPEG_OP_ROTATE_270    = FREE_IMAGE_JPEG_OPERATION(7); // 270-degree clockwise (or 90 ccw)
 
200
 
 
201
  // Tone mapping operators. Constants used in FreeImage_ToneMapping.
 
202
  FITMO_DRAGO03    = FREE_IMAGE_TMO(0); // Adaptive logarithmic mapping (F. Drago, 2003)
 
203
        FITMO_REINHARD05 = FREE_IMAGE_TMO(1);   // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005)
 
204
 
 
205
  // Upsampling / downsampling filters. Constants used in FreeImage_Rescale.
 
206
  FILTER_BOX          = FREE_IMAGE_FILTER(0);   // Box, pulse, Fourier window, 1st order (constant) b-spline
 
207
  FILTER_BICUBIC    = FREE_IMAGE_FILTER(1);     // Mitchell & Netravali's two-param cubic filter
 
208
  FILTER_BILINEAR   = FREE_IMAGE_FILTER(2);     // Bilinear filter
 
209
  FILTER_BSPLINE    = FREE_IMAGE_FILTER(3);     // 4th order (cubic) b-spline
 
210
  FILTER_CATMULLROM = FREE_IMAGE_FILTER(4);     // Catmull-Rom spline, Overhauser spline
 
211
  FILTER_LANCZOS3   = FREE_IMAGE_FILTER(5);     // Lanczos3 filter
 
212
 
 
213
  // Color channels. Constants used in color manipulation routines.
 
214
  FICC_RGB   = FREE_IMAGE_COLOR_CHANNEL(0); // Use red, green and blue channels
 
215
  FICC_RED   = FREE_IMAGE_COLOR_CHANNEL(1); // Use red channel
 
216
  FICC_GREEN = FREE_IMAGE_COLOR_CHANNEL(2); // Use green channel
 
217
  FICC_BLUE  = FREE_IMAGE_COLOR_CHANNEL(3); // Use blue channel
 
218
  FICC_ALPHA = FREE_IMAGE_COLOR_CHANNEL(4); // Use alpha channel
 
219
  FICC_BLACK = FREE_IMAGE_COLOR_CHANNEL(5); // Use black channel
 
220
  FICC_REAL  = FREE_IMAGE_COLOR_CHANNEL(6); // Complex images: use real part
 
221
  FICC_IMAG  = FREE_IMAGE_COLOR_CHANNEL(7); // Complex images: use imaginary part
 
222
  FICC_MAG   = FREE_IMAGE_COLOR_CHANNEL(8); // Complex images: use magnitude
 
223
  FICC_PHASE = FREE_IMAGE_COLOR_CHANNEL(9);     // Complex images: use phase
 
224
 
 
225
  // Tag data type information (based on TIFF specifications)
 
226
  FIDT_NOTYPE      = FREE_IMAGE_MDTYPE(0);      // placeholder
 
227
  FIDT_BYTE          = FREE_IMAGE_MDTYPE(1);    // 8-bit unsigned integer
 
228
  FIDT_ASCII       = FREE_IMAGE_MDTYPE(2);      // 8-bit bytes w/ last byte null
 
229
  FIDT_SHORT       = FREE_IMAGE_MDTYPE(3);      // 16-bit unsigned integer
 
230
  FIDT_LONG          = FREE_IMAGE_MDTYPE(4);    // 32-bit unsigned integer
 
231
  FIDT_RATIONAL  = FREE_IMAGE_MDTYPE(5);        // 64-bit unsigned fraction
 
232
  FIDT_SBYTE       = FREE_IMAGE_MDTYPE(6);      // 8-bit signed integer
 
233
  FIDT_UNDEFINED = FREE_IMAGE_MDTYPE(7);        // 8-bit untyped data
 
234
  FIDT_SSHORT      = FREE_IMAGE_MDTYPE(8);      // 16-bit signed integer
 
235
  FIDT_SLONG       = FREE_IMAGE_MDTYPE(9);      // 32-bit signed integer
 
236
  FIDT_SRATIONAL = FREE_IMAGE_MDTYPE(10); // 64-bit signed fraction
 
237
  FIDT_FLOAT       = FREE_IMAGE_MDTYPE(11); // 32-bit IEEE floating point
 
238
  FIDT_DOUBLE      = FREE_IMAGE_MDTYPE(12); // 64-bit IEEE floating point
 
239
  FIDT_IFD           = FREE_IMAGE_MDTYPE(13);   // 32-bit unsigned integer (offset)
 
240
  FIDT_PALETTE   = FREE_IMAGE_MDTYPE(14);       // 32-bit RGBQUAD
 
241
 
 
242
  // Metadata models supported by FreeImage
 
243
  FIMD_NODATA           = FREE_IMAGE_MDMODEL(-1);
 
244
  FIMD_COMMENTS       = FREE_IMAGE_MDMODEL(0);  // single comment or keywords
 
245
  FIMD_EXIF_MAIN      = FREE_IMAGE_MDMODEL(1);  // Exif-TIFF metadata
 
246
  FIMD_EXIF_EXIF      = FREE_IMAGE_MDMODEL(2);  // Exif-specific metadata
 
247
  FIMD_EXIF_GPS       = FREE_IMAGE_MDMODEL(3);  // Exif GPS metadata
 
248
  FIMD_EXIF_MAKERNOTE = FREE_IMAGE_MDMODEL(4);  // Exif maker note metadata
 
249
  FIMD_EXIF_INTEROP   = FREE_IMAGE_MDMODEL(5);  // Exif interoperability metadata
 
250
  FIMD_IPTC               = FREE_IMAGE_MDMODEL(6);  // IPTC/NAA metadata
 
251
  FIMD_XMP                = FREE_IMAGE_MDMODEL(7);  // Abobe XMP metadata
 
252
  FIMD_GEOTIFF        = FREE_IMAGE_MDMODEL(8);  // GeoTIFF metadata (to be implemented)
 
253
  FIMD_ANIMATION                  = FREE_IMAGE_MDMODEL(9);  // Animation metadata
 
254
  FIMD_CUSTOM           = FREE_IMAGE_MDMODEL(10); // Used to attach other metadata types to a dib
 
255
 
 
256
//{$endif}
 
257
 
 
258
type
 
259
  // Handle to a metadata model
 
260
  FIMETADATA = record
 
261
    data: Pointer;
 
262
  end;
 
263
  PFIMETADATA = ^FIMETADATA;
 
264
 
 
265
  // Handle to a metadata tag
 
266
  FITAG = record
 
267
    data: Pointer;
 
268
  end;
 
269
  PFITAG = ^FITAG;
 
270
 
 
271
// --------------------------------------------------------------------------
 
272
// File IO routines ---------------------------------------------------------
 
273
// --------------------------------------------------------------------------
 
274
 
 
275
type
 
276
  FI_Handle = Pointer;
 
277
  PCardinal = ^Cardinal;
 
278
  PInt = ^Integer;
 
279
 
 
280
  FI_ReadProc = function(buffer : pointer; size : Cardinal; count : Cardinal; handle : fi_handle) : PCardinal; stdcall;
 
281
  FI_WriteProc = function(buffer : pointer; size, count : Cardinal; handle : FI_Handle) : PCardinal; stdcall;
 
282
  FI_SeekProc = function(handle : fi_handle; offset : longint; origin : integer) : pint; stdcall;
 
283
  FI_TellProc = function(handle : fi_handle) : PCardinal; stdcall;
 
284
 
 
285
  FreeImageIO = packed record
 
286
    read_proc : FI_ReadProc;     // pointer to the function used to read data
 
287
    write_proc: FI_WriteProc;    // pointer to the function used to write data
 
288
    seek_proc : FI_SeekProc;     // pointer to the function used to seek
 
289
    tell_proc : FI_TellProc;     // pointer to the function used to aquire the current position
 
290
  end;
 
291
  PFreeImageIO = ^FreeImageIO;
 
292
 
 
293
  // Handle to a memory I/O stream
 
294
  FIMEMORY = record
 
295
    data: Pointer;
 
296
  end;
 
297
  PFIMEMORY = ^FIMEMORY;
 
298
 
 
299
const
 
300
  // constants used in FreeImage_Seek for Origin parameter
 
301
  SEEK_SET = 0;
 
302
  SEEK_CUR = 1;
 
303
  SEEK_END = 2;
 
304
 
 
305
// --------------------------------------------------------------------------
 
306
// Plugin routines ----------------------------------------------------------
 
307
// --------------------------------------------------------------------------
 
308
 
 
309
type
 
310
  PPluginStruct = ^PluginStruct;
 
311
 
 
312
  FI_InitProc = procedure(Plugin: PPluginStruct; Format_ID: Integer); stdcall;
 
313
  FI_FormatProc = function: PChar; stdcall;
 
314
  FI_DescriptionProc = function: PChar; stdcall;
 
315
  FI_ExtensionListProc = function: PChar; stdcall;
 
316
  FI_RegExprProc = function: PChar; stdcall;
 
317
  FI_OpenProc = function(IO: PFreeImageIO; Handle: FI_Handle; Read: Boolean): Pointer; stdcall;
 
318
  FI_CloseProc = procedure(IO: PFreeImageIO; Handle: FI_Handle; Data: Pointer); stdcall;
 
319
  FI_PageCountProc = function(IO: PFreeImageIO; Handle: FI_Handle; Data: Pointer): Integer; stdcall;
 
320
  FI_PageCapabilityProc = function(IO: PFreeImageIO; Handle: FI_Handle; Data: Pointer): integer; stdcall;
 
321
  FI_LoadProc = function(IO: PFreeImageIO; Handle: FI_Handle; Page, Flags: Integer; data: pointer): PFIBITMAP; stdcall;
 
322
  FI_SaveProc = function(IO: PFreeImageIO; Dib: PFIBITMAP; Handle: FI_Handle; Page, Flags: Integer; Data: Pointer): Boolean; stdcall;
 
323
  FI_ValidateProc = function(IO: PFreeImageIO; Handle: FI_Handle): Boolean; stdcall;
 
324
  FI_MimeProc = function: PChar; stdcall;
 
325
  FI_SupportsExportBPPProc = function(Bpp: integer): boolean; stdcall;
 
326
  FI_SupportsExportTypeProc = function(AType: FREE_IMAGE_TYPE): Boolean; stdcall;
 
327
  FI_SupportsICCProfilesProc = function: Boolean; stdcall;
 
328
 
 
329
  PluginStruct = record
 
330
    format_proc: FI_FormatProc;
 
331
    description_proc: FI_DescriptionProc;
 
332
    extension_proc: FI_ExtensionListProc;
 
333
    regexpr_proc: FI_RegExprProc;
 
334
    open_proc: FI_OpenProc;
 
335
    close_proc: FI_CloseProc;
 
336
    pagecount_proc: FI_PageCountProc;
 
337
    pagecapability_proc: FI_PageCapabilityProc;
 
338
    load_proc: FI_LoadProc;
 
339
    save_proc: FI_SaveProc;
 
340
    validate_proc: FI_ValidateProc;
 
341
    mime_proc: FI_MimeProc;
 
342
    supports_export_bpp_proc: FI_SupportsExportBPPProc;
 
343
    supports_export_type_proc: FI_SupportsExportTypeProc;
 
344
    supports_icc_profiles_proc: FI_SupportsICCProfilesProc;
 
345
  end;
 
346
 
 
347
// --------------------------------------------------------------------------
 
348
// Load/Save flag constants -------------------------------------------------
 
349
// --------------------------------------------------------------------------
 
350
 
 
351
const
 
352
  BMP_DEFAULT         = 0;
 
353
  BMP_SAVE_RLE        = 1;
 
354
  CUT_DEFAULT         = 0;
 
355
  DDS_DEFAULT         = 0;
 
356
  FAXG3_DEFAULT       = 0;
 
357
  GIF_DEFAULT         = 0;
 
358
  ICO_DEFAULT         = 0;
 
359
  ICO_MAKEALPHA       = 0;     // convert to 32bpp and create an alpha channel from the AND-mask when loading
 
360
  IFF_DEFAULT         = 0;
 
361
  JPEG_DEFAULT        = 0;
 
362
  JPEG_FAST           = 1;
 
363
  JPEG_ACCURATE       = 2;
 
364
  JPEG_QUALITYSUPERB  = $0080;
 
365
  JPEG_QUALITYGOOD    = $0100;
 
366
  JPEG_QUALITYNORMAL  = $0200;
 
367
  JPEG_QUALITYAVERAGE = $0400;
 
368
  JPEG_QUALITYBAD     = $0800;
 
369
  JPEG_CMYK           = $1000; // load separated CMYK "as is" (use | to combine with other flags)
 
370
  KOALA_DEFAULT       = 0;
 
371
  LBM_DEFAULT         = 0;
 
372
  MNG_DEFAULT         = 0;
 
373
  PCD_DEFAULT         = 0;
 
374
  PCD_BASE            = 1;     // load the bitmap sized 768 x 512
 
375
  PCD_BASEDIV4        = 2;     // load the bitmap sized 384 x 256
 
376
  PCD_BASEDIV16       = 3;     // load the bitmap sized 192 x 128
 
377
  PCX_DEFAULT         = 0;
 
378
  PNG_DEFAULT         = 0;
 
379
  PNG_IGNOREGAMMA     = 1;     // avoid gamma correction
 
380
  PNM_DEFAULT         = 0;
 
381
  PNM_SAVE_RAW        = 0;     // If set the writer saves in RAW format (i.e. P4, P5 or P6)
 
382
  PNM_SAVE_ASCII      = 1;     // If set the writer saves in ASCII format (i.e. P1, P2 or P3)
 
383
  PSD_DEFAULT         = 0;
 
384
  RAS_DEFAULT         = 0;
 
385
  SGI_DEFAULT         = 0;
 
386
  TARGA_DEFAULT       = 0;
 
387
  TARGA_LOAD_RGB888   = 1;     // If set the loader converts RGB555 and ARGB8888 -> RGB888.
 
388
  TIFF_DEFAULT        = 0;
 
389
  TIFF_CMYK               = $0001;  // reads/stores tags for separated CMYK (use | to combine with compression flags)
 
390
  TIFF_PACKBITS       = $0100;  // save using PACKBITS compression
 
391
  TIFF_DEFLATE        = $0200;  // save using DEFLATE compression
 
392
  TIFF_ADOBE_DEFLATE  = $0400;  // save using ADOBE DEFLATE compression
 
393
  TIFF_NONE           = $0800;  // save without any compression
 
394
  TIFF_CCITTFAX3                  = $1000;  // save using CCITT Group 3 fax encoding
 
395
  TIFF_CCITTFAX4                  = $2000;  // save using CCITT Group 4 fax encoding
 
396
  TIFF_LZW                            = $4000;  // save using LZW compression
 
397
  TIFF_JPEG                           = $8000;  // save using JPEG compression
 
398
  WBMP_DEFAULT        = 0;
 
399
  XBM_DEFAULT         = 0;
 
400
  XPM_DEFAULT         = 0;
 
401
 
 
402
// --------------------------------------------------------------------------
 
403
// Init/Error routines ------------------------------------------------------
 
404
// --------------------------------------------------------------------------
 
405
 
 
406
procedure FreeImage_Initialise(load_local_plugins_only : boolean = False); stdcall; external FIDLL name '_FreeImage_Initialise@4';
 
407
procedure FreeImage_DeInitialise; stdcall; external FIDLL name '_FreeImage_DeInitialise@0';
 
408
 
 
409
// --------------------------------------------------------------------------
 
410
// Version routines ---------------------------------------------------------
 
411
// --------------------------------------------------------------------------
 
412
 
 
413
function FreeImage_GetVersion : PChar; stdcall; external FIDLL name '_FreeImage_GetVersion@0';
 
414
function FreeImage_GetCopyrightMessage : PChar; stdcall; external FIDLL name '_FreeImage_GetCopyrightMessage@0';
 
415
 
 
416
// --------------------------------------------------------------------------
 
417
// Message output functions -------------------------------------------------
 
418
// --------------------------------------------------------------------------
 
419
 
 
420
procedure FreeImage_OutPutMessageProc(fif: Integer; fmt: PChar); stdcall; external FIDLL name 'FreeImage_OutputMessageProc';
 
421
type FreeImage_OutputMessageFunction = function(fif: FREE_IMAGE_FORMAT; msg: PChar): pointer; stdcall;
 
422
procedure FreeImage_SetOutputMessage(omf: FreeImage_OutputMessageFunction); stdcall; external FIDLL name '_FreeImage_SetOutputMessage@4';
 
423
 
 
424
// --------------------------------------------------------------------------
 
425
// Allocate/Unload routines -------------------------------------------------
 
426
// --------------------------------------------------------------------------
 
427
 
 
428
function FreeImage_Allocate(width, height, bpp: integer; red_mask: Cardinal = 0; green_mask: Cardinal = 0; blue_mask: Cardinal = 0): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_Allocate@24';
 
429
function FreeImage_AllocateT(Atype: FREE_IMAGE_TYPE; Width, Height: Integer; bpp: Integer = 8; red_mask: Cardinal = 0; green_mask: Cardinal = 0; blue_mask: Cardinal = 0): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_AllocateT@28';
 
430
function FreeImage_Clone(dib: PFIBITMAP): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_Clone@4';
 
431
procedure FreeImage_Unload(dib: PFIBITMAP); stdcall; external FIDLL name '_FreeImage_Unload@4';
 
432
 
 
433
// --------------------------------------------------------------------------
 
434
// Load / Save routines -----------------------------------------------------
 
435
// --------------------------------------------------------------------------
 
436
 
 
437
function FreeImage_Load(fif: FREE_IMAGE_FORMAT; const filename: PChar; flags: integer = 0): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_Load@12';
 
438
function FreeImage_LoadU(fif: FREE_IMAGE_FORMAT; const filename: PWideChar; flags: Integer = 0): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_LoadU@12';
 
439
function FreeImage_LoadFromHandle(fif: FREE_IMAGE_FORMAT; io: PFreeImageIO; handle: fi_handle; flags: integer = 0): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_LoadFromHandle@16';
 
440
function FreeImage_Save(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; filename: PChar; flags: integer = 0): Boolean; stdcall; external FIDLL name '_FreeImage_Save@16';
 
441
function FreeImage_SaveU(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; const filename: PWideChar; flags: Integer = 0): Boolean; stdcall; external FIDLL name '_FreeImage_SaveU@16';
 
442
function FreeImage_SaveToHandle(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; io : PFreeImageIO; handle : fi_handle; flags : integer = 0) : Boolean; stdcall; external FIDLL name '_FreeImage_SaveToHandle@20';
 
443
 
 
444
// --------------------------------------------------------------------------
 
445
// Memory I/O stream routines -----------------------------------------------
 
446
// --------------------------------------------------------------------------
 
447
 
 
448
function FreeImage_OpenMemory(data: PByte = nil; size_in_bytes: DWORD = 0): PFIMEMORY; stdcall; external FIDLL name '_FreeImage_OpenMemory@8';
 
449
procedure FreeImage_CloseMemory(stream: PFIMEMORY); stdcall; external FIDLL name '_FreeImage_CloseMemory@4';
 
450
function FreeImage_LoadFromMemory(fif: FREE_IMAGE_FORMAT; stream: PFIMEMORY; flags: Integer = 0): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_LoadFromMemory@12';
 
451
function FreeImage_SaveToMemory(fif: FREE_IMAGE_FORMAT; dib: PFIBITMAP; stream: PFIMEMORY; flags: Integer = 0): Boolean; stdcall; external FIDLL name '_FreeImage_SaveToMemory@16';
 
452
function FreeImage_TellMemory(stream: PFIMEMORY): Longint; stdcall; external FIDLL name '_FreeImage_TellMemory@4';
 
453
function FreeImage_SeekMemory(stream: PFIMEMORY; offset: Longint; origin: Integer): Boolean; stdcall; external FIDLL name '_FreeImage_SeekMemory@12';
 
454
function FreeImage_AcquireMemory(stream: PFIMEMORY; var data: PByte; var size_in_bytes: DWORD): Boolean; stdcall; external FIDLL name '_FreeImage_AcquireMemory@12';
 
455
 
 
456
// --------------------------------------------------------------------------
 
457
// Plugin Interface ---------------------------------------------------------
 
458
// --------------------------------------------------------------------------
 
459
 
 
460
function FreeImage_RegisterLocalPlugin(proc_address: FI_InitProc; format, description, extension, regexpr: PChar): FREE_IMAGE_FORMAT; stdcall; external FIDLL name '_FreeImage_RegisterLocalPlugin@20';
 
461
function FreeImage_RegisterExternalPlugin(path, format, description, extension, regexpr: PChar): FREE_IMAGE_FORMAT; stdcall; external FIDLL name '_FreeImage_RegisterExternalPlugin@20';
 
462
function FreeImage_GetFIFCount: Integer; stdcall; external FIDLL name '_FreeImage_GetFIFCount@0';
 
463
procedure FreeImage_SetPluginEnabled(fif: FREE_IMAGE_FORMAT; enable: Boolean); stdcall; external FIDLL Name '_FreeImage_SetPluginEnabled@8';
 
464
function FreeImage_IsPluginEnabled(fif: FREE_IMAGE_FORMAT): Integer; stdcall; external FIDLL Name '_FreeImage_IsPluginEnabled@4';
 
465
function FreeImage_GetFIFFromFormat(const format: PChar): FREE_IMAGE_FORMAT; stdcall; external FIDLL Name '_FreeImage_GetFIFFromFormat@4';
 
466
function FreeImage_GetFIFFromMime(const format: PChar): FREE_IMAGE_FORMAT; stdcall; external FIDLL Name '_FreeImage_GetFIFFromMime@4';
 
467
function FreeImage_GetFormatFromFIF(fif: FREE_IMAGE_FORMAT): PChar; stdcall; external FIDLL Name '_FreeImage_GetFormatFromFIF@4';
 
468
function FreeImage_GetFIFExtensionList(fif: FREE_IMAGE_FORMAT): PChar; stdcall; external FIDLL Name '_FreeImage_GetFIFExtensionList@4';
 
469
function FreeImage_GetFIFDescription(fif: FREE_IMAGE_FORMAT): PChar; stdcall; external FIDLL Name '_FreeImage_GetFIFDescription@4';
 
470
function FreeImage_GetFIFRegExpr(fif: FREE_IMAGE_FORMAT): PChar; stdcall; external FIDLL Name '_FreeImage_GetFIFRegExpr@4';
 
471
function FreeImage_GetFIFFromFilename(const fname: PChar): FREE_IMAGE_FORMAT; stdcall; external FIDLL Name '_FreeImage_GetFIFFromFilename@4';
 
472
function FreeImage_GetFIFFromFilenameU(const fname:PWideChar): FREE_IMAGE_FORMAT; stdcall; external FIDLL Name '_FreeImage_GetFIFFromFilenameU@4';
 
473
function FreeImage_FIFSupportsReading(fif: FREE_IMAGE_FORMAT): Boolean; stdcall; external FIDLL Name '_FreeImage_FIFSupportsReading@4';
 
474
function FreeImage_FIFSupportsWriting(fif: FREE_IMAGE_FORMAT): Boolean; stdcall; external FIDLL Name '_FreeImage_FIFSupportsWriting@4';
 
475
function FreeImage_FIFSupportsExportBPP(fif: FREE_IMAGE_FORMAT; bpp: Integer): Boolean; stdcall; external FIDLL Name '_FreeImage_FIFSupportsExportBPP@8';
 
476
function FreeImage_FIFSupportsICCProfiles(fif: FREE_IMAGE_FORMAT): Boolean; stdcall; external FIDLL Name '_FreeImage_FIFSupportsICCProfiles@4';
 
477
function FreeImage_FIFSupportsExportType(fif: FREE_IMAGE_FORMAT; image_type: FREE_IMAGE_TYPE): Boolean; stdcall; external FIDLL name '_FreeImage_FIFSupportsExportType@8';
 
478
 
 
479
// --------------------------------------------------------------------------
 
480
// Multipaging interface ----------------------------------------------------
 
481
// --------------------------------------------------------------------------
 
482
 
 
483
function FreeImage_OpenMultiBitmap(fif: FREE_IMAGE_FORMAT; filename: PChar; create_new, read_only, keep_cache_in_memory: Boolean; flags: integer = 0): PFIMULTIBITMAP; stdcall; external FIDLL Name '_FreeImage_OpenMultiBitmap@24';
 
484
function FreeImage_CloseMultiBitmap(bitmap: PFIMULTIBITMAP; flags: Integer = 0): Boolean; stdcall; external FIDLL Name '_FreeImage_CloseMultiBitmap@8';
 
485
function FreeImage_GetPageCount(bitmap: PFIMULTIBITMAP): Integer; stdcall; external FIDLL Name '_FreeImage_GetPageCount@4';
 
486
procedure FreeImage_AppendPage(bitmap: PFIMULTIBITMAP; data: PFIBITMAP); stdcall; external FIDLL Name '_FreeImage_AppendPage@8';
 
487
procedure FreeImage_InsertPage(bitmap: PFIMULTIBITMAP; page: Integer; data: PFIBITMAP); stdcall; external FIDLL Name '_FreeImage_InsertPage@12';
 
488
procedure FreeImage_DeletePage(bitmap: PFIMULTIBITMAP; page: Integer); stdcall; external FIDLL Name '_FreeImage_DeletePage@8';
 
489
function FreeImage_LockPage(bitmap: PFIMULTIBITMAP; page: Integer): PFIBITMAP; stdcall; external FIDLL Name '_FreeImage_LockPage@8';
 
490
procedure FreeImage_UnlockPage(bitmap: PFIMULTIBITMAP; page: PFIBITMAP; changed: boolean); stdcall; external FIDLL Name '_FreeImage_UnlockPage@12';
 
491
function FreeImage_MovePage(bitmap: PFIMULTIBITMAP; target, source: Integer): Boolean; stdcall; external FIDLL Name '_FreeImage_MovePage@12';
 
492
function FreeImage_GetLockedPageNumbers(bitmap: PFIMULTIBITMAP; var pages: Integer; var count : integer): Boolean; stdcall; external FIDLL Name '_FreeImage_GetLockedPageNumbers@12';
 
493
 
 
494
// --------------------------------------------------------------------------
 
495
// Filetype request routines ------------------------------------------------
 
496
// --------------------------------------------------------------------------
 
497
 
 
498
function FreeImage_GetFileType(const filename: PChar; size: Integer): FREE_IMAGE_FORMAT; stdcall; external FIDLL name '_FreeImage_GetFileType@8';
 
499
function FreeImage_GetFileTypeU(const filename: PWideChar; size: Integer): FREE_IMAGE_FORMAT; stdcall; external FIDLL name '_FreeImage_GetFileTypeU@8';
 
500
function FreeImage_GetFileTypeFromHandle(io: PFreeImageIO; handle: FI_Handle; size: Integer = 0): FREE_IMAGE_FORMAT; stdcall; external FIDLL name '_FreeImage_GetFileTypeFromHandle@12';
 
501
function FreeImage_GetFileTypeFromMemory(stream: PFIMEMORY; size: Integer = 0): FREE_IMAGE_FORMAT; stdcall; external FIDLL name '_FreeImage_GetFileTypeFromMemory@8'; 
 
502
 
 
503
// --------------------------------------------------------------------------
 
504
// ImageType request routine ------------------------------------------------
 
505
// --------------------------------------------------------------------------
 
506
 
 
507
function FreeImage_GetImageType(dib: PFIBITMAP): FREE_IMAGE_TYPE; stdcall; external FIDLL name '_FreeImage_GetImageType@4';
 
508
 
 
509
// --------------------------------------------------------------------------
 
510
// FreeImage helper routines ------------------------------------------------
 
511
// --------------------------------------------------------------------------
 
512
 
 
513
function FreeImage_IsLittleEndian: Boolean; stdcall; external FIDLL name '_FreeImage_IsLittleEndian@0';
 
514
function FreeImage_LookupX11Color(const szColor: PChar; var nRed, nGreen, nBlue: PByte): Boolean; stdcall; external FIDLL name '_FreeImage_LookupX11Color@16';
 
515
function FreeImage_LookupSVGColor(const szColor: PChar; var nRed, nGreen, nBlue: PByte): Boolean; stdcall; external FIDLL name '_FreeImage_LookupSVGColor@16';
 
516
 
 
517
// --------------------------------------------------------------------------
 
518
// Pixels access routines ---------------------------------------------------
 
519
// --------------------------------------------------------------------------
 
520
 
 
521
function FreeImage_GetBits(dib: PFIBITMAP): PByte; stdcall; external FIDLL name '_FreeImage_GetBits@4';
 
522
function FreeImage_GetScanLine(dib: PFIBITMAP; scanline: Integer): PByte; stdcall; external FIDLL name '_FreeImage_GetScanLine@8';
 
523
 
 
524
function FreeImage_GetPixelIndex(dib: PFIBITMAP; X, Y: Longint; Value: PByte): Boolean; stdcall; external FIDLL name '_FreeImage_GetPixelIndex@16';
 
525
function FreeImage_GetPixelColor(dib: PFIBITMAP; X, Y: Longint; Value: PRGBQuad): Boolean; stdcall; external FIDLL name '_FreeImage_GetPixelColor@16';
 
526
function FreeImage_SetPixelIndex(dib: PFIBITMAP; X, Y: Longint; Value: PByte): Boolean; stdcall; external FIDLL name '_FreeImage_SetPixelIndex@16';
 
527
function FreeImage_SetPixelColor(dib: PFIBITMAP; X, Y: Longint; Value: PRGBQuad): Boolean; stdcall; external FIDLL name '_FreeImage_SetPixelColor@16';
 
528
 
 
529
// --------------------------------------------------------------------------
 
530
// DIB info routines --------------------------------------------------------
 
531
// --------------------------------------------------------------------------
 
532
 
 
533
function FreeImage_GetColorsUsed(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetColorsUsed@4';
 
534
function FreeImage_GetBPP(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetBPP@4';
 
535
function FreeImage_GetWidth(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetWidth@4';
 
536
function FreeImage_GetHeight(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetHeight@4';
 
537
function FreeImage_GetLine(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetLine@4';
 
538
function FreeImage_GetPitch(dib : PFIBITMAP) : Cardinal; stdcall; external FIDLL name '_FreeImage_GetPitch@4';
 
539
function FreeImage_GetDIBSize(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetDIBSize@4';
 
540
function FreeImage_GetPalette(dib: PFIBITMAP): PRGBQUAD; stdcall; external FIDLL name '_FreeImage_GetPalette@4';
 
541
 
 
542
function FreeImage_GetDotsPerMeterX(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetDotsPerMeterX@4';
 
543
function FreeImage_GetDotsPerMeterY(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetDotsPerMeterY@4';
 
544
procedure FreeImage_SetDotsPerMeterX(dib: PFIBITMAP; res: Cardinal); stdcall; external FIDLL name '_FreeImage_SetDotsPerMeterX@8';
 
545
procedure FreeImage_SetDotsPerMeterY(dib: PFIBITMAP; res: Cardinal); stdcall; external FIDLL name '_FreeImage_SetDotsPerMeterY@8';
 
546
 
 
547
function FreeImage_GetInfoHeader(dib: PFIBITMAP): PBITMAPINFOHEADER; stdcall; external FIDLL name '_FreeImage_GetInfoHeader@4';
 
548
function FreeImage_GetInfo(var dib: FIBITMAP): PBITMAPINFO; stdcall; external FIDLL name '_FreeImage_GetInfo@4';
 
549
function FreeImage_GetColorType(dib: PFIBITMAP): FREE_IMAGE_COLOR_TYPE; stdcall; external FIDLL name '_FreeImage_GetColorType@4';
 
550
 
 
551
function FreeImage_GetRedMask(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetRedMask@4';
 
552
function FreeImage_GetGreenMask(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetGreenMask@4';
 
553
function FreeImage_GetBlueMask(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetBlueMask@4';
 
554
 
 
555
function FreeImage_GetTransparencyCount(dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetTransparencyCount@4';
 
556
function FreeImage_GetTransparencyTable(dib: PFIBITMAP): PByte; stdcall; external FIDLL name '_FreeImage_GetTransparencyTable@4';
 
557
procedure FreeImage_SetTransparent(dib: PFIBITMAP; enabled: boolean); stdcall; external FIDLL name '_FreeImage_SetTransparent@8';
 
558
procedure FreeImage_SetTransparencyTable(dib: PFIBITMAP; table: PByte; count: integer); stdcall; external FIDLL name '_FreeImage_SetTransparencyTable@12';
 
559
function FreeImage_IsTransparent(dib: PFIBITMAP): boolean; stdcall; external FIDLL name '_FreeImage_IsTransparent@4';
 
560
 
 
561
function FreeImage_HasBackgroundColor(dib: PFIBITMAP): Boolean; stdcall; external FIDLL name '_FreeImage_HasBackgroundColor@4';
 
562
function FreeImage_GetBackgroundColor(dib: PFIBITMAP; var bkcolor: PRGBQUAD): Boolean; stdcall; external FIDLL name '_FreeImage_GetBackgroundColor@8';
 
563
function FreeImage_SetBackgroundColor(dib: PFIBITMAP; bkcolor: PRGBQUAD): Boolean; stdcall; external FIDLL name '_FreeImage_SetBackgroundColor@8';
 
564
 
 
565
// --------------------------------------------------------------------------
 
566
// ICC profile routines -----------------------------------------------------
 
567
// --------------------------------------------------------------------------
 
568
 
 
569
function FreeImage_GetICCProfile(var dib: FIBITMAP): PFIICCPROFILE; stdcall; external FIDLL name '_FreeImage_GetICCProfile@4';
 
570
function FreeImage_CreateICCProfile(var dib: FIBITMAP; data: Pointer; size: Longint): PFIICCPROFILE; stdcall; external FIDLL name 'FreeImage_CreateICCProfile@12';
 
571
procedure FreeImage_DestroyICCProfile(var dib : FIBITMAP); stdcall; external FIDLL name 'FreeImage_DestroyICCProfile@4';
 
572
 
 
573
// --------------------------------------------------------------------------
 
574
// Line conversion routines -------------------------------------------------
 
575
// --------------------------------------------------------------------------
 
576
 
 
577
procedure FreeImage_ConvertLine1To4(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine1To4@12';
 
578
procedure FreeImage_ConvertLine8To4(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQuad);  stdcall; external FIDLL name '_FreeImage_ConvertLine8To4@16';
 
579
procedure FreeImage_ConvertLine16To4_555(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine16To4_555@12';
 
580
procedure FreeImage_ConvertLine16To4_565(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine16To4_565@12';
 
581
procedure FreeImage_ConvertLine24To4(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine24To4@12';
 
582
procedure FreeImage_ConvertLine32To4(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine32To4@12';
 
583
 
 
584
procedure FreeImage_ConvertLine1To8(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine1To8@12';
 
585
procedure FreeImage_ConvertLine4To8(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine4To8@12';
 
586
procedure FreeImage_ConvertLine16To8_555(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine16To8_555@12';
 
587
procedure FreeImage_ConvertLine16To8_565(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine16To8_565@12';
 
588
procedure FreeImage_ConvertLine24To8(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine24To8@12';
 
589
procedure FreeImage_ConvertLine32To8(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine32To8@12';
 
590
 
 
591
procedure FreeImage_ConvertLine1To16_555(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine1To16_555@16';
 
592
procedure FreeImage_ConvertLine4To16_555(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine4To16_555@16';
 
593
procedure FreeImage_ConvertLine8To16_555(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine8To16_555@16';
 
594
procedure FreeImage_ConvertLine16_565_To16_555(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine16_565_To16_555@12';
 
595
procedure FreeImage_ConvertLine24To16_555(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine24To16_555@12';
 
596
procedure FreeImage_ConvertLine32To16_555(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine32To16_555@12';
 
597
 
 
598
procedure FreeImage_ConvertLine1To16_565(target, source : PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine1To16_565@16';
 
599
procedure FreeImage_ConvertLine4To16_565(target, source : PBYTE; width_in_pixels : Integer; palette : PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine4To16_565@16';
 
600
procedure FreeImage_ConvertLine8To16_565(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine8To16_565@16';
 
601
procedure FreeImage_ConvertLine16_555_To16_565(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine16_555_To16_565@12';
 
602
procedure FreeImage_ConvertLine24To16_565(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine24To16_565@12';
 
603
procedure FreeImage_ConvertLine32To16_565(target, source : PBYTE; width_in_pixels : Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine32To16_565@12';
 
604
 
 
605
procedure FreeImage_ConvertLine1To24(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine1To24@16';
 
606
procedure FreeImage_ConvertLine4To24(target, source : PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine4To24@16';
 
607
procedure FreeImage_ConvertLine8To24(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine8To24@16';
 
608
procedure FreeImage_ConvertLine16To24_555(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine16To24_555@12';
 
609
procedure FreeImage_ConvertLine16To24_565(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine16To24_565@12';
 
610
procedure FreeImage_ConvertLine32To24(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine32To24@12';
 
611
 
 
612
procedure FreeImage_ConvertLine1To32(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine1To32@16';
 
613
procedure FreeImage_ConvertLine4To32(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine4To32@16';
 
614
procedure FreeImage_ConvertLine8To32(target, source: PBYTE; width_in_pixels: Integer; palette: PRGBQUAD); stdcall; external FIDLL name '_FreeImage_ConvertLine8To32@16';
 
615
procedure FreeImage_ConvertLine16To32_555(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine16To32_555@12';
 
616
procedure FreeImage_ConvertLine16To32_565(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine16To32_565@12';
 
617
procedure FreeImage_ConvertLine24To32(target, source: PBYTE; width_in_pixels: Integer); stdcall; external FIDLL name '_FreeImage_ConvertLine24To32@12';
 
618
 
 
619
// --------------------------------------------------------------------------
 
620
// Smart conversion routines ------------------------------------------------
 
621
// --------------------------------------------------------------------------
 
622
 
 
623
function FreeImage_ConvertTo4Bits(dib: PFIBITMAP): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertTo4Bits@4';
 
624
function FreeImage_ConvertTo8Bits(dib: PFIBITMAP): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertTo8Bits@4';
 
625
function FreeImage_ConvertToGreyscale(dib: PFIBITMAP): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertToGreyscale@4';
 
626
function FreeImage_ConvertTo16Bits555(dib: PFIBITMAP): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertTo16Bits555@4';
 
627
function FreeImage_ConvertTo16Bits565(dib: PFIBITMAP): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertTo16Bits565@4';
 
628
function FreeImage_ConvertTo24Bits(dib: PFIBITMAP): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertTo24Bits@4';
 
629
function FreeImage_ConvertTo32Bits(dib: PFIBITMAP): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertTo32Bits@4';
 
630
function FreeImage_ColorQuantize(dib: PFIBITMAP; quantize: FREE_IMAGE_QUANTIZE): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ColorQuantize@8';
 
631
function FreeImage_ColorQuantizeEx(dib: PFIBITMAP; quantize: FREE_IMAGE_QUANTIZE = FIQ_WUQUANT; PaletteSize: Integer = 256; ReserveSize: Integer = 0; ReservePalette: PRGBQuad = nil): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ColorQuantizeEx@20';
 
632
function FreeImage_Threshold(dib: PFIBITMAP; T: Byte): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_Threshold@8';
 
633
function FreeImage_Dither(dib: PFIBITMAP; algorithm: FREE_IMAGE_DITHER): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_Dither@8';
 
634
 
 
635
function FreeImage_ConvertFromRawBits(bits: PBYTE; width, height, pitch: Integer; bpp, red_mask, green_mask, blue_mask: LongWord; topdown: Boolean): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertFromRawBits@36';
 
636
procedure FreeImage_ConvertToRawBits(bits: PBYTE; dib: PFIBITMAP; pitch: Integer; bpp, red_mask, green_mask, blue_mask: LongWord; topdown: Boolean); stdcall; external FIDLL name '_FreeImage_ConvertToRawBits@32';
 
637
 
 
638
function FreeImage_ConvertToRGBF(dib: PFIBITMAP): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertToRGBF@4';
 
639
 
 
640
function FreeImage_ConvertToStandardType(src: PFIBITMAP; scale_linear: Boolean = True): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertToStandardType@8';
 
641
function FreeImage_ConvertToType(src: PFIBITMAP; dst_type: FREE_IMAGE_TYPE; scale_linear: Boolean = True): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ConvertToType@12';
 
642
 
 
643
// tone mapping operators
 
644
function FreeImage_ToneMapping(dib: PFIBITMAP; tmo: FREE_IMAGE_TMO; first_param: Double = 0; second_param: Double = 0): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_ToneMapping@24';
 
645
function FreeImage_TmoDrago03(src: PFIBITMAP; gamma: Double = 2.2; exposure: Double = 0): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_TmoDrago03@20';
 
646
function FreeImage_TmoReinhard05(src: PFIBITMAP; intensity: Double = 0; contrast: Double = 0): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_TmoReinhard05@20';
 
647
 
 
648
// --------------------------------------------------------------------------
 
649
// ZLib interface -----------------------------------------------------------
 
650
// --------------------------------------------------------------------------
 
651
 
 
652
function FreeImage_ZLibCompress(target: PBYTE; target_size: DWORD; source: PBYTE; source_size: DWORD): DWORD; stdcall; external FIDLL name '_FreeImage_ZLibCompress@16';
 
653
function FreeImage_ZLibUncompress(target: PBYTE; target_size: DWORD; source: PBYTE; source_size: DWORD): DWORD; stdcall; external FIDLL name '_FreeImage_ZLibUncompress@16';
 
654
 
 
655
function FreeImage_ZLibGZip(target: PBYTE; target_size: DWORD; source: PBYTE; source_size: DWORD): DWORD; stdcall; external FIDLL name '_FreeImage_ZLibGZip@16';
 
656
function FreeImage_ZLibGUnzip(target: PBYTE; target_size: DWORD; source: PBYTE; source_size: DWORD): DWORD; stdcall; external FIDLL name '_FreeImage_ZLibGUnzip@16';
 
657
function FreeImage_ZLibCRC32(crc: DWORD; source: PByte; source_size: DWORD): DWORD; stdcall; external FIDLL name '_FreeImage_ZLibCRC32@12';
 
658
 
 
659
// --------------------------------------------------------------------------
 
660
// Metadata routines --------------------------------------------------------
 
661
// --------------------------------------------------------------------------
 
662
 
 
663
// tag creation / destruction
 
664
function FreeImage_CreateTag: PFITAG; stdcall; external FIDLL name '_FreeImage_CreateTag@0';
 
665
procedure FreeImage_DeleteTag(tag: PFITAG); stdcall; external FIDLL name '_FreeImage_DeleteTag@4';
 
666
function FreeImage_CloneTag(tag: PFITAG): PFITAG; stdcall; external FIDLL name '_FreeImage_CloneTag@4';
 
667
 
 
668
// tag getters and setters
 
669
function FreeImage_GetTagKey(tag: PFITAG): PChar; stdcall; external FIDLL name '_FreeImage_GetTagKey@4';
 
670
function FreeImage_GetTagDescription(tag: PFITAG): PChar; stdcall; external FIDLL name '_FreeImage_GetTagDescription@4';
 
671
function FreeImage_GetTagID(tag: PFITAG): Word; stdcall; external FIDLL name '_FreeImage_GetTagID@4';
 
672
function FreeImage_GetTagType(tag: PFITAG): FREE_IMAGE_MDTYPE; stdcall; external FIDLL name '_FreeImage_GetTagType@4';
 
673
function FreeImage_GetTagCount(tag: PFITAG): DWORD; stdcall; external FIDLL name '_FreeImage_GetTagCount@4';
 
674
function FreeImage_GetTagLength(tag: PFITAG): DWORD; stdcall; external FIDLL name '_FreeImage_GetTagLength@4';
 
675
function FreeImage_GetTagValue(tag: PFITAG): Pointer; stdcall; external FIDLL name '_FreeImage_GetTagValue@4';
 
676
 
 
677
function FreeImage_SetTagKey(tag: PFITAG; const key: PChar): Boolean; stdcall; external FIDLL name '_FreeImage_SetTagKey@8';
 
678
function FreeImage_SetTagDescription(tag: PFITAG; const description: PChar): Boolean; stdcall; external FIDLL name '_FreeImage_SetTagDescription@8';
 
679
function FreeImage_SetTagID(tag: PFITAG; id: Word): Boolean; stdcall; external FIDLL name '_FreeImage_SetTagID@8';
 
680
function FreeImage_SetTagType(tag: PFITAG; atype: FREE_IMAGE_MDTYPE): Boolean; stdcall; external FIDLL name '_FreeImage_SetTagType@8';
 
681
function FreeImage_SetTagCount(tag: PFITAG; count: DWORD): Boolean; stdcall; external FIDLL name '_FreeImage_SetTagCount@8';
 
682
function FreeImage_SetTagLength(tag: PFITAG; length: DWORD): Boolean; stdcall; external FIDLL name '_FreeImage_SetTagLength@8';
 
683
function FreeImage_SetTagValue(tag: PFITAG; const value: Pointer): Boolean; stdcall; external FIDLL name '_FreeImage_SetTagValue@8';
 
684
 
 
685
// iterator
 
686
function FreeImage_FindFirstMetadata(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; var tag: PFITAG): PFIMETADATA; stdcall; external FIDLL name '_FreeImage_FindFirstMetadata@12';
 
687
function FreeImage_FindNextMetadata(mdhandle: PFIMETADATA; var tag: PFITAG): Boolean; stdcall; external FIDLL name '_FreeImage_FindNextMetadata@8';
 
688
procedure FreeImage_FindCloseMetadata(mdhandle: PFIMETADATA); stdcall; external FIDLL name '_FreeImage_FindCloseMetadata@4';
 
689
 
 
690
// metadata setter and getter
 
691
function FreeImage_SetMetadata(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; const key: PChar; tag: PFITAG): Boolean; stdcall; external FIDLL name '_FreeImage_SetMetadata@16';
 
692
function FreeImage_GetMetaData(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP; const key: PChar; var tag: PFITAG): Boolean; stdcall; external FIDLL name '_FreeImage_GetMetadata@16';
 
693
 
 
694
// helpers
 
695
function FreeImage_GetMetadataCount(model: FREE_IMAGE_MDMODEL; dib: PFIBITMAP): Cardinal; stdcall; external FIDLL name '_FreeImage_GetMetadataCount@8';
 
696
 
 
697
// tag to C string conversion
 
698
function FreeImage_TagToString(model: FREE_IMAGE_MDMODEL; tag: PFITAG; Make: PChar = nil): PChar; stdcall; external FIDLL name '_FreeImage_TagToString@12';
 
699
 
 
700
// --------------------------------------------------------------------------
 
701
// Image manipulation toolkit -----------------------------------------------
 
702
// --------------------------------------------------------------------------
 
703
 
 
704
// rotation and flipping
 
705
function FreeImage_RotateClassic(dib: PFIBITMAP; angle: Double): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_RotateClassic@12';
 
706
function FreeImage_RotateEx(dib: PFIBITMAP; angle, x_shift, y_shift, x_origin, y_origin: Double; use_mask: Boolean): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_RotateEx@48';
 
707
function FreeImage_FlipHorizontal(dib: PFIBITMAP): Boolean; stdcall; external FIDLL name '_FreeImage_FlipHorizontal@4';
 
708
function FreeImage_FlipVertical(dib: PFIBITMAP): Boolean; stdcall; external FIDLL name '_FreeImage_FlipVertical@4';
 
709
function FreeImage_JPEGTransform(const src_file: PChar; const dst_file: PChar; operation: FREE_IMAGE_JPEG_OPERATION; perfect: Boolean = False): Boolean; stdcall; external FIDLL name '_FreeImage_JPEGTransform@16';
 
710
 
 
711
// upsampling / downsampling
 
712
function FreeImage_Rescale(dib: PFIBITMAP; dst_width, dst_height: Integer; filter: FREE_IMAGE_FILTER): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_Rescale@16';
 
713
function FreeImage_MakeThumbnail(dib: PFIBITMAP; max_pixel_size: Integer; convert:boolean = TRUE): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_MakeThumbnail@12'; 
 
714
 
 
715
// color manipulation routines (point operations)
 
716
function FreeImage_AdjustCurve(dib: PFIBITMAP; LUT: PBYTE; channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; stdcall; external FIDLL name '_FreeImage_AdjustCurve@12';
 
717
function FreeImage_AdjustGamma(dib: PFIBITMAP; gamma: Double): Boolean; stdcall; external FIDLL name '_FreeImage_AdjustGamma@12';
 
718
function FreeImage_AdjustBrightness(dib: PFIBITMAP; percentage: Double): Boolean; stdcall; external FIDLL name '_FreeImage_AdjustBrightness@12';
 
719
function FreeImage_AdjustContrast(dib: PFIBITMAP; percentage: Double): Boolean; stdcall; external FIDLL name '_FreeImage_AdjustContrast@12';
 
720
function FreeImage_Invert(dib: PFIBITMAP): Boolean; stdcall; external FIDLL name '_FreeImage_Invert@4';
 
721
function FreeImage_GetHistogram(dib: PFIBITMAP; histo: PDWORD; channel: FREE_IMAGE_COLOR_CHANNEL = FICC_BLACK): Boolean; stdcall; external FIDLL name '_FreeImage_GetHistogram@12';
 
722
 
 
723
// channel processing routines
 
724
function FreeImage_GetChannel(dib: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_GetChannel@8';
 
725
function FreeImage_SetChannel(dib, dib8: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; stdcall; external FIDLL name '_FreeImage_SetChannel@12';
 
726
function FreeImage_GetComplexChannel(src: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_GetComplexChannel@8';
 
727
function FreeImage_SetComplexChannel(src: PFIBITMAP; channel: FREE_IMAGE_COLOR_CHANNEL): Boolean; stdcall; external FIDLL name '_FreeImage_SetComplexChannel@12';
 
728
 
 
729
// copy / paste / composite routines
 
730
 
 
731
function FreeImage_Copy(dib: PFIBITMAP; left, top, right, bottom: Integer): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_Copy@20';
 
732
function FreeImage_Paste(dst, src: PFIBITMAP; left, top, alpha: Integer): Boolean; stdcall; external FIDLL name '_FreeImage_Paste@20';
 
733
function FreeImage_Composite(fg: PFIBITMAP; useFileBkg: Boolean = False; appBkColor: PRGBQUAD = nil; bg: PFIBITMAP = nil): PFIBITMAP; stdcall; external FIDLL name '_FreeImage_Composite@16';
 
734
  
 
735
{$MINENUMSIZE 1}
 
736
implementation
 
737
 
 
738
end.