1// ==========================================================
2// FreeImage 3
3//
4// Design and implementation by
5// - Floris van den Berg (flvdberg@wxs.nl)
6// - Hervé Drolon (drolon@infonie.fr)
7//
8// Contributors:
9// - Adam Gates (radad@xoasis.com)
10// - Alex Kwak
11// - Alexander Dymerets (sashad@te.net.ua)
12// - Detlev Vendt (detlev.vendt@brillit.de)
13// - Jan L. Nauta (jln@magentammt.com)
14// - Jani Kajala (janik@remedy.fi)
15// - Juergen Riecker (j.riecker@gmx.de)
16// - Karl-Heinz Bussian (khbussian@moss.de)
17// - Laurent Rocher (rocherl@club-internet.fr)
18// - Luca Piergentili (l.pierge@terra.es)
19// - Machiel ten Brinke (brinkem@uni-one.nl)
20// - Markus Loibl (markus.loibl@epost.de)
21// - Martin Weber (martweb@gmx.net)
22// - Matthias Wandel (mwandel@rim.net)
23// - Michal Novotny (michal@etc.cz)
24// - Petr Pytelka (pyta@lightcomp.com)
25// - Riley McNiff (rmcniff@marexgroup.com)
26// - Ryan Rubley (ryan@lostreality.org)
27// - Volker Gärtner (volkerg@gmx.at)
28//
29// This file is part of FreeImage 3
30//
31// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
32// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
33// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
34// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
35// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
36// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
37// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
38// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
39// THIS DISCLAIMER.
40//
41// Use at your own risk!
42// ==========================================================
43
44#ifndef FREEIMAGE_H
45#define FREEIMAGE_H
46
47// Version information ------------------------------------------------------
48
49#define FREEIMAGE_MAJOR_VERSION 3
50#define FREEIMAGE_MINOR_VERSION 13
51#define FREEIMAGE_RELEASE_SERIAL 1
52
53// Compiler options ---------------------------------------------------------
54
55#include <wchar.h> // needed for UNICODE functions
56
57#if defined(FREEIMAGE_LIB)
58 #define DLL_API
59 #define DLL_CALLCONV
60#else
61 #if defined(_WIN32) || defined(__WIN32__)
62 #define DLL_CALLCONV __stdcall
63 // The following ifdef block is the standard way of creating macros which make exporting
64 // from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS
65 // symbol defined on the command line. this symbol should not be defined on any project
66 // that uses this DLL. This way any other project whose source files include this file see
67 // DLL_API functions as being imported from a DLL, wheras this DLL sees symbols
68 // defined with this macro as being exported.
69 #ifdef FREEIMAGE_EXPORTS
70 #define DLL_API __declspec(dllexport)
71 #else
72 #define DLL_API __declspec(dllimport)
73 #endif // FREEIMAGE_EXPORTS
74 #else
75 // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility)
76 #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
77 #ifndef GCC_HASCLASSVISIBILITY
78 #define GCC_HASCLASSVISIBILITY
79 #endif
80 #endif // __GNUC__
81 #define DLL_CALLCONV
82 #if defined(GCC_HASCLASSVISIBILITY)
83 #define DLL_API __attribute__ ((visibility("default")))
84 #else
85 #define DLL_API
86 #endif
87 #endif // WIN32 / !WIN32
88#endif // FREEIMAGE_LIB
89
90// Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined
91// If your big endian system isn't being detected, add an OS specific check
92#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \
93 (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \
94 defined(__BIG_ENDIAN__)
95#define FREEIMAGE_BIGENDIAN
96#endif // BYTE_ORDER
97
98// This really only affects 24 and 32 bit formats, the rest are always RGB order.
99#define FREEIMAGE_COLORORDER_BGR 0
100#define FREEIMAGE_COLORORDER_RGB 1
101#if defined(FREEIMAGE_BIGENDIAN)
102#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB
103#else
104#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR
105#endif
106
107// Ensure 4-byte enums if we're using Borland C++ compilers
108#if defined(__BORLANDC__)
109#pragma option push -b
110#endif
111
112// For C compatibility --------------------------------------------------------
113
114#ifdef __cplusplus
115#define FI_DEFAULT(x) = x
116#define FI_ENUM(x) enum x
117#define FI_STRUCT(x) struct x
118#else
119#define FI_DEFAULT(x)
120#define FI_ENUM(x) typedef int x; enum x
121#define FI_STRUCT(x) typedef struct x x; struct x
122#endif
123
124// Bitmap types -------------------------------------------------------------
125
126FI_STRUCT (FIBITMAP) { void *data; };
127FI_STRUCT (FIMULTIBITMAP) { void *data; };
128
129// Types used in the library (directly copied from Windows) -----------------
130
131#if defined(__MINGW32__) && defined(_WINDOWS_H)
132#define _WINDOWS_ // prevent a bug in MinGW32
133#endif // __MINGW32__
134
135#ifndef _WINDOWS_
136#define _WINDOWS_
137
138#ifndef FALSE
139#define FALSE 0
140#endif
141#ifndef TRUE
142#define TRUE 1
143#endif
144#ifndef NULL
145#define NULL 0
146#endif
147
148#ifndef SEEK_SET
149#define SEEK_SET 0
150#define SEEK_CUR 1
151#define SEEK_END 2
152#endif
153
154#ifndef _MSC_VER
155// define portable types for 32-bit / 64-bit OS
156#include <inttypes.h>
157typedef int32_t BOOL;
158typedef uint8_t BYTE;
159typedef uint16_t WORD;
160typedef uint32_t DWORD;
161typedef int32_t LONG;
162#else
163// MS is not C99 ISO compliant
164typedef long BOOL;
165typedef unsigned char BYTE;
166typedef unsigned short WORD;
167typedef unsigned long DWORD;
168typedef long LONG;
169#endif // _MSC_VER
170
171#if (defined(_WIN32) || defined(__WIN32__))
172#pragma pack(push, 1)
173#else
174#pragma pack(1)
175#endif // WIN32
176
177typedef struct tagRGBQUAD {
178#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
179 BYTE rgbBlue;
180 BYTE rgbGreen;
181 BYTE rgbRed;
182#else
183 BYTE rgbRed;
184 BYTE rgbGreen;
185 BYTE rgbBlue;
186#endif // FREEIMAGE_COLORORDER
187 BYTE rgbReserved;
188} RGBQUAD;
189
190typedef struct tagRGBTRIPLE {
191#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
192 BYTE rgbtBlue;
193 BYTE rgbtGreen;
194 BYTE rgbtRed;
195#else
196 BYTE rgbtRed;
197 BYTE rgbtGreen;
198 BYTE rgbtBlue;
199#endif // FREEIMAGE_COLORORDER
200} RGBTRIPLE;
201
202#if (defined(_WIN32) || defined(__WIN32__))
203#pragma pack(pop)
204#else
205#pragma pack()
206#endif // WIN32
207
208typedef struct tagBITMAPINFOHEADER{
209 DWORD biSize;
210 LONG biWidth;
211 LONG biHeight;
212 WORD biPlanes;
213 WORD biBitCount;
214 DWORD biCompression;
215 DWORD biSizeImage;
216 LONG biXPelsPerMeter;
217 LONG biYPelsPerMeter;
218 DWORD biClrUsed;
219 DWORD biClrImportant;
220} BITMAPINFOHEADER, *PBITMAPINFOHEADER;
221
222typedef struct tagBITMAPINFO {
223 BITMAPINFOHEADER bmiHeader;
224 RGBQUAD bmiColors[1];
225} BITMAPINFO, *PBITMAPINFO;
226
227#endif // _WINDOWS_
228
229// Types used in the library (specific to FreeImage) ------------------------
230
231#if (defined(_WIN32) || defined(__WIN32__))
232#pragma pack(push, 1)
233#else
234#pragma pack(1)
235#endif // WIN32
236
237/** 48-bit RGB
238*/
239typedef struct tagFIRGB16 {
240 WORD red;
241 WORD green;
242 WORD blue;
243} FIRGB16;
244
245/** 64-bit RGBA
246*/
247typedef struct tagFIRGBA16 {
248 WORD red;
249 WORD green;
250 WORD blue;
251 WORD alpha;
252} FIRGBA16;
253
254/** 96-bit RGB Float
255*/
256typedef struct tagFIRGBF {
257 float red;
258 float green;
259 float blue;
260} FIRGBF;
261
262/** 128-bit RGBA Float
263*/
264typedef struct tagFIRGBAF {
265 float red;
266 float green;
267 float blue;
268 float alpha;
269} FIRGBAF;
270
271/** Data structure for COMPLEX type (complex number)
272*/
273typedef struct tagFICOMPLEX {
274 /// real part
275 double r;
276 /// imaginary part
277 double i;
278} FICOMPLEX;
279
280#if (defined(_WIN32) || defined(__WIN32__))
281#pragma pack(pop)
282#else
283#pragma pack()
284#endif // WIN32
285
286// Indexes for byte arrays, masks and shifts for treating pixels as words ---
287// These coincide with the order of RGBQUAD and RGBTRIPLE -------------------
288
289#ifndef FREEIMAGE_BIGENDIAN
290#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
291// Little Endian (x86 / MS Windows, Linux) : BGR(A) order
292#define FI_RGBA_RED 2
293#define FI_RGBA_GREEN 1
294#define FI_RGBA_BLUE 0
295#define FI_RGBA_ALPHA 3
296#define FI_RGBA_RED_MASK 0x00FF0000
297#define FI_RGBA_GREEN_MASK 0x0000FF00
298#define FI_RGBA_BLUE_MASK 0x000000FF
299#define FI_RGBA_ALPHA_MASK 0xFF000000
300#define FI_RGBA_RED_SHIFT 16
301#define FI_RGBA_GREEN_SHIFT 8
302#define FI_RGBA_BLUE_SHIFT 0
303#define FI_RGBA_ALPHA_SHIFT 24
304#else
305// Little Endian (x86 / MaxOSX) : RGB(A) order
306#define FI_RGBA_RED 0
307#define FI_RGBA_GREEN 1
308#define FI_RGBA_BLUE 2
309#define FI_RGBA_ALPHA 3
310#define FI_RGBA_RED_MASK 0x000000FF
311#define FI_RGBA_GREEN_MASK 0x0000FF00
312#define FI_RGBA_BLUE_MASK 0x00FF0000
313#define FI_RGBA_ALPHA_MASK 0xFF000000
314#define FI_RGBA_RED_SHIFT 0
315#define FI_RGBA_GREEN_SHIFT 8
316#define FI_RGBA_BLUE_SHIFT 16
317#define FI_RGBA_ALPHA_SHIFT 24
318#endif // FREEIMAGE_COLORORDER
319#else
320#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
321// Big Endian (PPC / none) : BGR(A) order
322#define FI_RGBA_RED 2
323#define FI_RGBA_GREEN 1
324#define FI_RGBA_BLUE 0
325#define FI_RGBA_ALPHA 3
326#define FI_RGBA_RED_MASK 0x0000FF00
327#define FI_RGBA_GREEN_MASK 0x00FF0000
328#define FI_RGBA_BLUE_MASK 0xFF000000
329#define FI_RGBA_ALPHA_MASK 0x000000FF
330#define FI_RGBA_RED_SHIFT 8
331#define FI_RGBA_GREEN_SHIFT 16
332#define FI_RGBA_BLUE_SHIFT 24
333#define FI_RGBA_ALPHA_SHIFT 0
334#else
335// Big Endian (PPC / Linux, MaxOSX) : RGB(A) order
336#define FI_RGBA_RED 0
337#define FI_RGBA_GREEN 1
338#define FI_RGBA_BLUE 2
339#define FI_RGBA_ALPHA 3
340#define FI_RGBA_RED_MASK 0xFF000000
341#define FI_RGBA_GREEN_MASK 0x00FF0000
342#define FI_RGBA_BLUE_MASK 0x0000FF00
343#define FI_RGBA_ALPHA_MASK 0x000000FF
344#define FI_RGBA_RED_SHIFT 24
345#define FI_RGBA_GREEN_SHIFT 16
346#define FI_RGBA_BLUE_SHIFT 8
347#define FI_RGBA_ALPHA_SHIFT 0
348#endif // FREEIMAGE_COLORORDER
349#endif // FREEIMAGE_BIGENDIAN
350
351#define FI_RGBA_RGB_MASK (FI_RGBA_RED_MASK|FI_RGBA_GREEN_MASK|FI_RGBA_BLUE_MASK)
352
353// The 16bit macros only include masks and shifts, since each color element is not byte aligned
354
355#define FI16_555_RED_MASK 0x7C00
356#define FI16_555_GREEN_MASK 0x03E0
357#define FI16_555_BLUE_MASK 0x001F
358#define FI16_555_RED_SHIFT 10
359#define FI16_555_GREEN_SHIFT 5
360#define FI16_555_BLUE_SHIFT 0
361#define FI16_565_RED_MASK 0xF800
362#define FI16_565_GREEN_MASK 0x07E0
363#define FI16_565_BLUE_MASK 0x001F
364#define FI16_565_RED_SHIFT 11
365#define FI16_565_GREEN_SHIFT 5
366#define FI16_565_BLUE_SHIFT 0
367
368// ICC profile support ------------------------------------------------------
369
370#define FIICC_DEFAULT 0x00
371#define FIICC_COLOR_IS_CMYK 0x01
372
373FI_STRUCT (FIICCPROFILE) {
374 WORD flags; // info flag
375 DWORD size; // profile's size measured in bytes
376 void *data; // points to a block of contiguous memory containing the profile
377};
378
379// Important enums ----------------------------------------------------------
380
381/** I/O image format identifiers.
382*/
383FI_ENUM(FREE_IMAGE_FORMAT) {
384 FIF_UNKNOWN = -1,
385 FIF_BMP = 0,
386 FIF_ICO = 1,
387 FIF_JPEG = 2,
388 FIF_JNG = 3,
389 FIF_KOALA = 4,
390 FIF_LBM = 5,
391 FIF_IFF = FIF_LBM,
392 FIF_MNG = 6,
393 FIF_PBM = 7,
394 FIF_PBMRAW = 8,
395 FIF_PCD = 9,
396 FIF_PCX = 10,
397 FIF_PGM = 11,
398 FIF_PGMRAW = 12,
399 FIF_PNG = 13,
400 FIF_PPM = 14,
401 FIF_PPMRAW = 15,
402 FIF_RAS = 16,
403 FIF_TARGA = 17,
404 FIF_TIFF = 18,
405 FIF_WBMP = 19,
406 FIF_PSD = 20,
407 FIF_CUT = 21,
408 FIF_XBM = 22,
409 FIF_XPM = 23,
410 FIF_DDS = 24,
411 FIF_GIF = 25,
412 FIF_HDR = 26,
413 FIF_FAXG3 = 27,
414 FIF_SGI = 28,
415 FIF_EXR = 29,
416 FIF_J2K = 30,
417 FIF_JP2 = 31,
418 FIF_PFM = 32,
419 FIF_PICT = 33,
420 FIF_RAW = 34
421};
422
423/** Image type used in FreeImage.
424*/
425FI_ENUM(FREE_IMAGE_TYPE) {
426 FIT_UNKNOWN = 0, // unknown type
427 FIT_BITMAP = 1, // standard image : 1-, 4-, 8-, 16-, 24-, 32-bit
428 FIT_UINT16 = 2, // array of unsigned short : unsigned 16-bit
429 FIT_INT16 = 3, // array of short : signed 16-bit
430 FIT_UINT32 = 4, // array of unsigned long : unsigned 32-bit
431 FIT_INT32 = 5, // array of long : signed 32-bit
432 FIT_FLOAT = 6, // array of float : 32-bit IEEE floating point
433 FIT_DOUBLE = 7, // array of double : 64-bit IEEE floating point
434 FIT_COMPLEX = 8, // array of FICOMPLEX : 2 x 64-bit IEEE floating point
435 FIT_RGB16 = 9, // 48-bit RGB image : 3 x 16-bit
436 FIT_RGBA16 = 10, // 64-bit RGBA image : 4 x 16-bit
437 FIT_RGBF = 11, // 96-bit RGB float image : 3 x 32-bit IEEE floating point
438 FIT_RGBAF = 12 // 128-bit RGBA float image : 4 x 32-bit IEEE floating point
439};
440
441/** Image color type used in FreeImage.
442*/
443FI_ENUM(FREE_IMAGE_COLOR_TYPE) {
444 FIC_MINISWHITE = 0, // min value is white
445 FIC_MINISBLACK = 1, // min value is black
446 FIC_RGB = 2, // RGB color model
447 FIC_PALETTE = 3, // color map indexed
448 FIC_RGBALPHA = 4, // RGB color model with alpha channel
449 FIC_CMYK = 5 // CMYK color model
450};
451
452/** Color quantization algorithms.
453Constants used in FreeImage_ColorQuantize.
454*/
455FI_ENUM(FREE_IMAGE_QUANTIZE) {
456 FIQ_WUQUANT = 0, // Xiaolin Wu color quantization algorithm
457 FIQ_NNQUANT = 1 // NeuQuant neural-net quantization algorithm by Anthony Dekker
458};
459
460/** Dithering algorithms.
461Constants used in FreeImage_Dither.
462*/
463FI_ENUM(FREE_IMAGE_DITHER) {
464 FID_FS = 0, // Floyd & Steinberg error diffusion
465 FID_BAYER4x4 = 1, // Bayer ordered dispersed dot dithering (order 2 dithering matrix)
466 FID_BAYER8x8 = 2, // Bayer ordered dispersed dot dithering (order 3 dithering matrix)
467 FID_CLUSTER6x6 = 3, // Ordered clustered dot dithering (order 3 - 6x6 matrix)
468 FID_CLUSTER8x8 = 4, // Ordered clustered dot dithering (order 4 - 8x8 matrix)
469 FID_CLUSTER16x16= 5, // Ordered clustered dot dithering (order 8 - 16x16 matrix)
470 FID_BAYER16x16 = 6 // Bayer ordered dispersed dot dithering (order 4 dithering matrix)
471};
472
473/** Lossless JPEG transformations
474Constants used in FreeImage_JPEGTransform
475*/
476FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
477 FIJPEG_OP_NONE = 0, // no transformation
478 FIJPEG_OP_FLIP_H = 1, // horizontal flip
479 FIJPEG_OP_FLIP_V = 2, // vertical flip
480 FIJPEG_OP_TRANSPOSE = 3, // transpose across UL-to-LR axis
481 FIJPEG_OP_TRANSVERSE = 4, // transpose across UR-to-LL axis
482 FIJPEG_OP_ROTATE_90 = 5, // 90-degree clockwise rotation
483 FIJPEG_OP_ROTATE_180 = 6, // 180-degree rotation
484 FIJPEG_OP_ROTATE_270 = 7 // 270-degree clockwise (or 90 ccw)
485};
486
487/** Tone mapping operators.
488Constants used in FreeImage_ToneMapping.
489*/
490FI_ENUM(FREE_IMAGE_TMO) {
491 FITMO_DRAGO03 = 0, // Adaptive logarithmic mapping (F. Drago, 2003)
492 FITMO_REINHARD05 = 1, // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005)
493 FITMO_FATTAL02 = 2 // Gradient domain high dynamic range compression (R. Fattal, 2002)
494};
495
496/** Upsampling / downsampling filters.
497Constants used in FreeImage_Rescale.
498*/
499FI_ENUM(FREE_IMAGE_FILTER) {
500 FILTER_BOX = 0, // Box, pulse, Fourier window, 1st order (constant) b-spline
501 FILTER_BICUBIC = 1, // Mitchell & Netravali's two-param cubic filter
502 FILTER_BILINEAR = 2, // Bilinear filter
503 FILTER_BSPLINE = 3, // 4th order (cubic) b-spline
504 FILTER_CATMULLROM = 4, // Catmull-Rom spline, Overhauser spline
505 FILTER_LANCZOS3 = 5 // Lanczos3 filter
506};
507
508/** Color channels.
509Constants used in color manipulation routines.
510*/
511FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) {
512 FICC_RGB = 0, // Use red, green and blue channels
513 FICC_RED = 1, // Use red channel
514 FICC_GREEN = 2, // Use green channel
515 FICC_BLUE = 3, // Use blue channel
516 FICC_ALPHA = 4, // Use alpha channel
517 FICC_BLACK = 5, // Use black channel
518 FICC_REAL = 6, // Complex images: use real part
519 FICC_IMAG = 7, // Complex images: use imaginary part
520 FICC_MAG = 8, // Complex images: use magnitude
521 FICC_PHASE = 9 // Complex images: use phase
522};
523
524// Metadata support ---------------------------------------------------------
525
526/**
527 Tag data type information (based on TIFF specifications)
528
529 Note: RATIONALs are the ratio of two 32-bit integer values.
530*/
531FI_ENUM(FREE_IMAGE_MDTYPE) {
532 FIDT_NOTYPE = 0, // placeholder
533 FIDT_BYTE = 1, // 8-bit unsigned integer
534 FIDT_ASCII = 2, // 8-bit bytes w/ last byte null
535 FIDT_SHORT = 3, // 16-bit unsigned integer
536 FIDT_LONG = 4, // 32-bit unsigned integer
537 FIDT_RATIONAL = 5, // 64-bit unsigned fraction
538 FIDT_SBYTE = 6, // 8-bit signed integer
539 FIDT_UNDEFINED = 7, // 8-bit untyped data
540 FIDT_SSHORT = 8, // 16-bit signed integer
541 FIDT_SLONG = 9, // 32-bit signed integer
542 FIDT_SRATIONAL = 10, // 64-bit signed fraction
543 FIDT_FLOAT = 11, // 32-bit IEEE floating point
544 FIDT_DOUBLE = 12, // 64-bit IEEE floating point
545 FIDT_IFD = 13, // 32-bit unsigned integer (offset)
546 FIDT_PALETTE = 14 // 32-bit RGBQUAD
547};
548
549/**
550 Metadata models supported by FreeImage
551*/
552FI_ENUM(FREE_IMAGE_MDMODEL) {
553 FIMD_NODATA = -1,
554 FIMD_COMMENTS = 0, // single comment or keywords
555 FIMD_EXIF_MAIN = 1, // Exif-TIFF metadata
556 FIMD_EXIF_EXIF = 2, // Exif-specific metadata
557 FIMD_EXIF_GPS = 3, // Exif GPS metadata
558 FIMD_EXIF_MAKERNOTE = 4, // Exif maker note metadata
559 FIMD_EXIF_INTEROP = 5, // Exif interoperability metadata
560 FIMD_IPTC = 6, // IPTC/NAA metadata
561 FIMD_XMP = 7, // Abobe XMP metadata
562 FIMD_GEOTIFF = 8, // GeoTIFF metadata
563 FIMD_ANIMATION = 9, // Animation metadata
564 FIMD_CUSTOM = 10 // Used to attach other metadata types to a dib
565};
566
567/**
568 Handle to a metadata model
569*/
570FI_STRUCT (FIMETADATA) { void *data; };
571
572/**
573 Handle to a FreeImage tag
574*/
575FI_STRUCT (FITAG) { void *data; };
576
577// File IO routines ---------------------------------------------------------
578
579#ifndef FREEIMAGE_IO
580#define FREEIMAGE_IO
581
582typedef void* fi_handle;
583typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
584typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
585typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin);
586typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle);
587
588#if (defined(_WIN32) || defined(__WIN32__))
589#pragma pack(push, 1)
590#else
591#pragma pack(1)
592#endif // WIN32
593
594FI_STRUCT(FreeImageIO) {
595 FI_ReadProc read_proc; // pointer to the function used to read data
596 FI_WriteProc write_proc; // pointer to the function used to write data
597 FI_SeekProc seek_proc; // pointer to the function used to seek
598 FI_TellProc tell_proc; // pointer to the function used to aquire the current position
599};
600
601#if (defined(_WIN32) || defined(__WIN32__))
602#pragma pack(pop)
603#else
604#pragma pack()
605#endif // WIN32
606
607/**
608Handle to a memory I/O stream
609*/
610FI_STRUCT (FIMEMORY) { void *data; };
611
612#endif // FREEIMAGE_IO
613
614// Plugin routines ----------------------------------------------------------
615
616#ifndef PLUGINS
617#define PLUGINS
618
619typedef const char *(DLL_CALLCONV *FI_FormatProc)(void);
620typedef const char *(DLL_CALLCONV *FI_DescriptionProc)(void);
621typedef const char *(DLL_CALLCONV *FI_ExtensionListProc)(void);
622typedef const char *(DLL_CALLCONV *FI_RegExprProc)(void);
623typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read);
624typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data);
625typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data);
626typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data);
627typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data);
628typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data);
629typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle);
630typedef const char *(DLL_CALLCONV *FI_MimeProc)(void);
631typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp);
632typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type);
633typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(void);
634
635FI_STRUCT (Plugin) {
636 FI_FormatProc format_proc;
637 FI_DescriptionProc description_proc;
638 FI_ExtensionListProc extension_proc;
639 FI_RegExprProc regexpr_proc;
640 FI_OpenProc open_proc;
641 FI_CloseProc close_proc;
642 FI_PageCountProc pagecount_proc;
643 FI_PageCapabilityProc pagecapability_proc;
644 FI_LoadProc load_proc;
645 FI_SaveProc save_proc;
646 FI_ValidateProc validate_proc;
647 FI_MimeProc mime_proc;
648 FI_SupportsExportBPPProc supports_export_bpp_proc;
649 FI_SupportsExportTypeProc supports_export_type_proc;
650 FI_SupportsICCProfilesProc supports_icc_profiles_proc;
651};
652
653typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id);
654
655#endif // PLUGINS
656
657
658// Load / Save flag constants -----------------------------------------------
659
660#define BMP_DEFAULT 0
661#define BMP_SAVE_RLE 1
662#define CUT_DEFAULT 0
663#define DDS_DEFAULT 0
664#define EXR_DEFAULT 0 // save data as half with piz-based wavelet compression
665#define EXR_FLOAT 0x0001 // save data as float instead of as half (not recommended)
666#define EXR_NONE 0x0002 // save with no compression
667#define EXR_ZIP 0x0004 // save with zlib compression, in blocks of 16 scan lines
668#define EXR_PIZ 0x0008 // save with piz-based wavelet compression
669#define EXR_PXR24 0x0010 // save with lossy 24-bit float compression
670#define EXR_B44 0x0020 // save with lossy 44% float compression - goes to 22% when combined with EXR_LC
671#define EXR_LC 0x0040 // save images with one luminance and two chroma channels, rather than as RGB (lossy compression)
672#define FAXG3_DEFAULT 0
673#define GIF_DEFAULT 0
674#define GIF_LOAD256 1 // Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color
675#define GIF_PLAYBACK 2 // 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading
676#define HDR_DEFAULT 0
677#define ICO_DEFAULT 0
678#define ICO_MAKEALPHA 1 // convert to 32bpp and create an alpha channel from the AND-mask when loading
679#define IFF_DEFAULT 0
680#define J2K_DEFAULT 0 // save with a 16:1 rate
681#define JP2_DEFAULT 0 // save with a 16:1 rate
682#define JPEG_DEFAULT 0 // loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420)
683#define JPEG_FAST 0x0001 // load the file as fast as possible, sacrificing some quality
684#define JPEG_ACCURATE 0x0002 // load the file with the best quality, sacrificing some speed
685#define JPEG_CMYK 0x0004 // load separated CMYK "as is" (use | to combine with other load flags)
686#define JPEG_EXIFROTATE 0x0008 // load and rotate according to Exif 'Orientation' tag if available
687#define JPEG_QUALITYSUPERB 0x80 // save with superb quality (100:1)
688#define JPEG_QUALITYGOOD 0x0100 // save with good quality (75:1)
689#define JPEG_QUALITYNORMAL 0x0200 // save with normal quality (50:1)
690#define JPEG_QUALITYAVERAGE 0x0400 // save with average quality (25:1)
691#define JPEG_QUALITYBAD 0x0800 // save with bad quality (10:1)
692#define JPEG_PROGRESSIVE 0x2000 // save as a progressive-JPEG (use | to combine with other save flags)
693#define JPEG_SUBSAMPLING_411 0x1000 // save with high 4x1 chroma subsampling (4:1:1)
694#define JPEG_SUBSAMPLING_420 0x4000 // save with medium 2x2 medium chroma subsampling (4:2:0) - default value
695#define JPEG_SUBSAMPLING_422 0x8000 // save with low 2x1 chroma subsampling (4:2:2)
696#define JPEG_SUBSAMPLING_444 0x10000 // save with no chroma subsampling (4:4:4)
697#define KOALA_DEFAULT 0
698#define LBM_DEFAULT 0
699#define MNG_DEFAULT 0
700#define PCD_DEFAULT 0
701#define PCD_BASE 1 // load the bitmap sized 768 x 512
702#define PCD_BASEDIV4 2 // load the bitmap sized 384 x 256
703#define PCD_BASEDIV16 3 // load the bitmap sized 192 x 128
704#define PCX_DEFAULT 0
705#define PFM_DEFAULT 0
706#define PICT_DEFAULT 0
707#define PNG_DEFAULT 0
708#define PNG_IGNOREGAMMA 1 // loading: avoid gamma correction
709#define PNG_Z_BEST_SPEED 0x0001 // save using ZLib level 1 compression flag (default value is 6)
710#define PNG_Z_DEFAULT_COMPRESSION 0x0006 // save using ZLib level 6 compression flag (default recommended value)
711#define PNG_Z_BEST_COMPRESSION 0x0009 // save using ZLib level 9 compression flag (default value is 6)
712#define PNG_Z_NO_COMPRESSION 0x0100 // save without ZLib compression
713#define PNG_INTERLACED 0x0200 // save using Adam7 interlacing (use | to combine with other save flags)
714#define PNM_DEFAULT 0
715#define PNM_SAVE_RAW 0 // If set the writer saves in RAW format (i.e. P4, P5 or P6)
716#define PNM_SAVE_ASCII 1 // If set the writer saves in ASCII format (i.e. P1, P2 or P3)
717#define PSD_DEFAULT 0
718#define RAS_DEFAULT 0
719#define RAW_DEFAULT 0 // load the file as linear RGB 48-bit
720#define RAW_PREVIEW 1 // try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit
721#define RAW_DISPLAY 2 // load the file as RGB 24-bit
722#define SGI_DEFAULT 0
723#define TARGA_DEFAULT 0
724#define TARGA_LOAD_RGB888 1 // If set the loader converts RGB555 and ARGB8888 -> RGB888.
725#define TIFF_DEFAULT 0
726#define TIFF_CMYK 0x0001 // reads/stores tags for separated CMYK (use | to combine with compression flags)
727#define TIFF_PACKBITS 0x0100 // save using PACKBITS compression
728#define TIFF_DEFLATE 0x0200 // save using DEFLATE compression (a.k.a. ZLIB compression)
729#define TIFF_ADOBE_DEFLATE 0x0400 // save using ADOBE DEFLATE compression
730#define TIFF_NONE 0x0800 // save without any compression
731#define TIFF_CCITTFAX3 0x1000 // save using CCITT Group 3 fax encoding
732#define TIFF_CCITTFAX4 0x2000 // save using CCITT Group 4 fax encoding
733#define TIFF_LZW 0x4000 // save using LZW compression
734#define TIFF_JPEG 0x8000 // save using JPEG compression
735#define WBMP_DEFAULT 0
736#define XBM_DEFAULT 0
737#define XPM_DEFAULT 0
738
739// Background filling options ---------------------------------------------------------
740// Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas
741
742#define FI_COLOR_IS_RGB_COLOR 0x00 // RGBQUAD color is a RGB color (contains no valid alpha channel)
743#define FI_COLOR_IS_RGBA_COLOR 0x01 // RGBQUAD color is a RGBA color (contains a valid alpha channel)
744#define FI_COLOR_FIND_EQUAL_COLOR 0x02 // For palettized images: lookup equal RGB color from palette
745#define FI_COLOR_ALPHA_IS_INDEX 0x04 // The color's rgbReserved member (alpha) contains the palette index to be used
746#define FI_COLOR_PALETTE_SEARCH_MASK (FI_COLOR_FIND_EQUAL_COLOR | FI_COLOR_ALPHA_IS_INDEX) // No color lookup is performed
747
748
749#ifdef __cplusplus
750extern "C" {
751#endif
752
753// Init / Error routines ----------------------------------------------------
754
755DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE));
756DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void);
757
758// Version routines ---------------------------------------------------------
759
760DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void);
761DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void);
762
763// Message output functions -------------------------------------------------
764
765typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg);
766typedef void (DLL_CALLCONV *FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT fif, const char *msg);
767
768DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf);
769DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf);
770DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...);
771
772// Allocate / Clone / Unload routines ---------------------------------------
773
774DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Allocate(int width, int height, int bpp, unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
775DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateT(FREE_IMAGE_TYPE type, int width, int height, int bpp FI_DEFAULT(8), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
776DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib);
777DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib);
778
779// Load / Save routines -----------------------------------------------------
780
781DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0));
782DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0));
783DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
784DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0));
785DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0));
786DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
787
788// Memory I/O stream routines -----------------------------------------------
789
790DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0));
791DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream);
792DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
793DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0));
794DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream);
795DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin);
796DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes);
797DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
798DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
799DLL_API FIMULTIBITMAP *DLL_CALLCONV FreeImage_LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
800
801// Plugin Interface ---------------------------------------------------------
802
803DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterLocalPlugin(FI_InitProc proc_address, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0));
804DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_RegisterExternalPlugin(const char *path, const char *format FI_DEFAULT(0), const char *description FI_DEFAULT(0), const char *extension FI_DEFAULT(0), const char *regexpr FI_DEFAULT(0));
805DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void);
806DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable);
807DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif);
808DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format);
809DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime);
810DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif);
811DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif);
812DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif);
813DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif);
814DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif);
815DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename);
816DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename);
817DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif);
818DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif);
819DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp);
820DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type);
821DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif);
822
823// Multipaging interface ----------------------------------------------------
824
825DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL create_new, BOOL read_only, BOOL keep_cache_in_memory FI_DEFAULT(FALSE), int flags FI_DEFAULT(0));
826DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
827DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0));
828DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap);
829DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data);
830DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data);
831DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page);
832DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page);
833DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *data, BOOL changed);
834DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source);
835DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count);
836
837// Filetype request routines ------------------------------------------------
838
839DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0));
840DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0));
841DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0));
842DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0));
843
844// Image type request routine -----------------------------------------------
845
846DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib);
847
848// FreeImage helper routines ------------------------------------------------
849
850DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void);
851DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
852DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
853
854// Pixel access routines ----------------------------------------------------
855
856DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib);
857DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline);
858
859DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
860DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
861DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
862DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
863
864// DIB info routines --------------------------------------------------------
865
866DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib);
867DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib);
868DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib);
869DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib);
870DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib);
871DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib);
872DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib);
873DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib);
874
875DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib);
876DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib);
877DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res);
878DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res);
879
880DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib);
881DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib);
882DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib);
883
884DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib);
885DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib);
886DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib);
887
888DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib);
889DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib);
890DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled);
891DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count);
892DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib);
893DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index);
894DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib);
895
896DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib);
897DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
898DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
899
900
901// ICC profile routines -----------------------------------------------------
902
903DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib);
904DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size);
905DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib);
906
907// Line conversion routines -------------------------------------------------
908
909DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels);
910DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
911DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels);
912DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels);
913DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels);
914DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels);
915DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels);
916DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels);
917DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels);
918DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels);
919DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels);
920DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels);
921DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
922DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
923DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
924DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels);
925DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels);
926DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels);
927DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
928DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
929DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
930DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels);
931DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels);
932DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels);
933DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
934DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
935DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
936DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels);
937DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels);
938DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels);
939DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
940DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
941DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
942DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels);
943DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels);
944DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels);
945
946// Smart conversion routines ------------------------------------------------
947
948DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo4Bits(FIBITMAP *dib);
949DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib);
950DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToGreyscale(FIBITMAP *dib);
951DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib);
952DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib);
953DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib);
954DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib);
955DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize);
956DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantizeEx(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize FI_DEFAULT(FIQ_WUQUANT), int PaletteSize FI_DEFAULT(256), int ReserveSize FI_DEFAULT(0), RGBQUAD *ReservePalette FI_DEFAULT(NULL));
957DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T);
958DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm);
959
960DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBits(BYTE *bits, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
961DLL_API void DLL_CALLCONV FreeImage_ConvertToRawBits(BYTE *bits, FIBITMAP *dib, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
962
963DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib);
964
965DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear FI_DEFAULT(TRUE));
966DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear FI_DEFAULT(TRUE));
967
968// tone mapping operators
969DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ToneMapping(FIBITMAP *dib, FREE_IMAGE_TMO tmo, double first_param FI_DEFAULT(0), double second_param FI_DEFAULT(0));
970DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0));
971DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0));
972DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05Ex(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0), double adaptation FI_DEFAULT(1), double color_correction FI_DEFAULT(0));
973
974DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color_saturation FI_DEFAULT(0.5), double attenuation FI_DEFAULT(0.85));
975
976// ZLib interface -----------------------------------------------------------
977
978DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
979DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
980DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
981DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
982DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size);
983
984// --------------------------------------------------------------------------
985// Metadata routines --------------------------------------------------------
986// --------------------------------------------------------------------------
987
988// tag creation / destruction
989DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag(void);
990DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag);
991DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag);
992
993// tag getters and setters
994DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag);
995DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag);
996DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag);
997DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag);
998DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag);
999DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag);
1000DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag);
1001
1002DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key);
1003DLL_API BOOL DLL_CALLCONV FreeImage_SetTagDescription(FITAG *tag, const char *description);
1004DLL_API BOOL DLL_CALLCONV FreeImage_SetTagID(FITAG *tag, WORD id);
1005DLL_API BOOL DLL_CALLCONV FreeImage_SetTagType(FITAG *tag, FREE_IMAGE_MDTYPE type);
1006DLL_API BOOL DLL_CALLCONV FreeImage_SetTagCount(FITAG *tag, DWORD count);
1007DLL_API BOOL DLL_CALLCONV FreeImage_SetTagLength(FITAG *tag, DWORD length);
1008DLL_API BOOL DLL_CALLCONV FreeImage_SetTagValue(FITAG *tag, const void *value);
1009
1010// iterator
1011DLL_API FIMETADATA *DLL_CALLCONV FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag);
1012DLL_API BOOL DLL_CALLCONV FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag);
1013DLL_API void DLL_CALLCONV FreeImage_FindCloseMetadata(FIMETADATA *mdhandle);
1014
1015// metadata setter and getter
1016DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag);
1017DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag);
1018
1019// helpers
1020DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib);
1021DLL_API BOOL DLL_CALLCONV FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src);
1022
1023// tag to C string conversion
1024DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL));
1025
1026// --------------------------------------------------------------------------
1027// Image manipulation toolkit -----------------------------------------------
1028// --------------------------------------------------------------------------
1029
1030// rotation and flipping
1031/// @deprecated see FreeImage_Rotate
1032DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle);
1033DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor FI_DEFAULT(NULL));
1034DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateEx(FIBITMAP *dib, double angle, double x_shift, double y_shift, double x_origin, double y_origin, BOOL use_mask);
1035DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib);
1036DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib);
1037DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE));
1038DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE));
1039
1040// upsampling / downsampling
1041DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter);
1042DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert FI_DEFAULT(TRUE));
1043
1044// color manipulation routines (point operations)
1045DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel);
1046DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma);
1047DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage);
1048DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage);
1049DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib);
1050DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK));
1051DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert);
1052DLL_API BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert FI_DEFAULT(FALSE));
1053DLL_API unsigned DLL_CALLCONV FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolors, unsigned count, BOOL ignore_alpha, BOOL swap);
1054DLL_API unsigned DLL_CALLCONV FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ignore_alpha);
1055DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstindices, unsigned count, BOOL swap);
1056DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b);
1057
1058// channel processing routines
1059DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel);
1060DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dib, FIBITMAP *dib8, FREE_IMAGE_COLOR_CHANNEL channel);
1061DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
1062DLL_API BOOL DLL_CALLCONV FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
1063
1064// copy / paste / composite routines
1065DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom);
1066DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha);
1067DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL));
1068DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
1069DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCropU(const wchar_t *src_file, const wchar_t *dst_file, int left, int top, int right, int bottom);
1070DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib);
1071
1072// background filling routines
1073DLL_API BOOL DLL_CALLCONV FreeImage_FillBackground(FIBITMAP *dib, const void *color, int options FI_DEFAULT(0));
1074DLL_API FIBITMAP *DLL_CALLCONV FreeImage_EnlargeCanvas(FIBITMAP *src, int left, int top, int right, int bottom, const void *color, int options FI_DEFAULT(0));
1075DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateEx(int width, int height, int bpp, const RGBQUAD *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
1076DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, const void *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
1077
1078// miscellaneous algorithms
1079DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle FI_DEFAULT(3));
1080
1081// restore the borland-specific enum size option
1082#if defined(__BORLANDC__)
1083#pragma option pop
1084#endif
1085
1086#ifdef __cplusplus
1087}
1088#endif
1089
1090#endif // FREEIMAGE_H
1091