FreeImage.h

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