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 9 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) || !(defined(_WIN32) || defined(__WIN32__)) 00058 #define DLL_API 00059 #define DLL_CALLCONV 00060 #else 00061 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 #endif // FREEIMAGE_LIB || !WIN32 00075 00076 // Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined 00077 // If your big endian system isn't being detected, add an OS specific check 00078 #if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \ 00079 (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \ 00080 defined(__BIG_ENDIAN__) 00081 #define FREEIMAGE_BIGENDIAN 00082 #endif // BYTE_ORDER 00083 00084 // Ensure 4-byte enums if we're using Borland C++ compilers 00085 #if defined(__BORLANDC__) 00086 #pragma option push -b 00087 #endif 00088 00089 // For C compatibility -------------------------------------------------------- 00090 00091 #ifdef __cplusplus 00092 #define FI_DEFAULT(x) = x 00093 #define FI_ENUM(x) enum x 00094 #define FI_STRUCT(x) struct x 00095 #else 00096 #define FI_DEFAULT(x) 00097 #define FI_ENUM(x) typedef int x; enum x 00098 #define FI_STRUCT(x) typedef struct x x; struct x 00099 #endif 00100 00101 // Bitmap types ------------------------------------------------------------- 00102 00103 FI_STRUCT (FIBITMAP) { void *data; }; 00104 FI_STRUCT (FIMULTIBITMAP) { void *data; }; 00105 00106 // Types used in the library (directly copied from Windows) ----------------- 00107 00108 #ifndef _WINDOWS_ 00109 #define _WINDOWS_ 00110 00111 #ifndef FALSE 00112 #define FALSE 0 00113 #endif 00114 #ifndef TRUE 00115 #define TRUE 1 00116 #endif 00117 #ifndef NULL 00118 #define NULL 0 00119 #endif 00120 00121 #ifndef SEEK_SET 00122 #define SEEK_SET 0 00123 #define SEEK_CUR 1 00124 #define SEEK_END 2 00125 #endif 00126 00127 #ifndef _MSC_VER 00128 // define portable types for 32-bit / 64-bit OS 00129 #include <stdint.h> 00130 typedef int32_t BOOL; 00131 typedef uint8_t BYTE; 00132 typedef uint16_t WORD; 00133 typedef uint32_t DWORD; 00134 typedef int32_t LONG; 00135 #else 00136 // MS is not C99 ISO compliant 00137 typedef long BOOL; 00138 typedef unsigned char BYTE; 00139 typedef unsigned short WORD; 00140 typedef unsigned long DWORD; 00141 typedef long LONG; 00142 #endif // _MSC_VER 00143 00144 #if (defined(_WIN32) || defined(__WIN32__)) 00145 #pragma pack(push, 1) 00146 #else 00147 #pragma pack(1) 00148 #endif // WIN32 00149 00150 typedef struct tagRGBQUAD { 00151 #ifdef FREEIMAGE_BIGENDIAN 00152 BYTE rgbRed; 00153 BYTE rgbGreen; 00154 BYTE rgbBlue; 00155 #else 00156 BYTE rgbBlue; 00157 BYTE rgbGreen; 00158 BYTE rgbRed; 00159 #endif // FREEIMAGE_BIGENDIAN 00160 BYTE rgbReserved; 00161 } RGBQUAD; 00162 00163 typedef struct tagRGBTRIPLE { 00164 #ifdef FREEIMAGE_BIGENDIAN 00165 BYTE rgbtRed; 00166 BYTE rgbtGreen; 00167 BYTE rgbtBlue; 00168 #else 00169 BYTE rgbtBlue; 00170 BYTE rgbtGreen; 00171 BYTE rgbtRed; 00172 #endif // FREEIMAGE_BIGENDIAN 00173 } RGBTRIPLE; 00174 00175 #if (defined(_WIN32) || defined(__WIN32__)) 00176 #pragma pack(pop) 00177 #else 00178 #pragma pack() 00179 #endif // WIN32 00180 00181 typedef struct tagBITMAPINFOHEADER{ 00182 DWORD biSize; 00183 LONG biWidth; 00184 LONG biHeight; 00185 WORD biPlanes; 00186 WORD biBitCount; 00187 DWORD biCompression; 00188 DWORD biSizeImage; 00189 LONG biXPelsPerMeter; 00190 LONG biYPelsPerMeter; 00191 DWORD biClrUsed; 00192 DWORD biClrImportant; 00193 } BITMAPINFOHEADER, *PBITMAPINFOHEADER; 00194 00195 typedef struct tagBITMAPINFO { 00196 BITMAPINFOHEADER bmiHeader; 00197 RGBQUAD bmiColors[1]; 00198 } BITMAPINFO, *PBITMAPINFO; 00199 00200 #endif // _WINDOWS_ 00201 00202 // Types used in the library (specific to FreeImage) ------------------------ 00203 00204 #if (defined(_WIN32) || defined(__WIN32__)) 00205 #pragma pack(push, 1) 00206 #else 00207 #pragma pack(1) 00208 #endif // WIN32 00209 00212 typedef struct tagFIRGB16 { 00213 WORD red; 00214 WORD green; 00215 WORD blue; 00216 } FIRGB16; 00217 00220 typedef struct tagFIRGBA16 { 00221 WORD red; 00222 WORD green; 00223 WORD blue; 00224 WORD alpha; 00225 } FIRGBA16; 00226 00229 typedef struct tagFIRGBF { 00230 float red; 00231 float green; 00232 float blue; 00233 } FIRGBF; 00234 00237 typedef struct tagFIRGBAF { 00238 float red; 00239 float green; 00240 float blue; 00241 float alpha; 00242 } FIRGBAF; 00243 00246 typedef struct tagFICOMPLEX { 00248 double r; 00250 double i; 00251 } FICOMPLEX; 00252 00253 #if (defined(_WIN32) || defined(__WIN32__)) 00254 #pragma pack(pop) 00255 #else 00256 #pragma pack() 00257 #endif // WIN32 00258 00259 // Indexes for byte arrays, masks and shifts for treating pixels as words --- 00260 // These coincide with the order of RGBQUAD and RGBTRIPLE ------------------- 00261 00262 #ifndef FREEIMAGE_BIGENDIAN 00263 // Little Endian (x86 / MS Windows, Linux) : BGR(A) order 00264 #define FI_RGBA_RED 2 00265 #define FI_RGBA_GREEN 1 00266 #define FI_RGBA_BLUE 0 00267 #define FI_RGBA_ALPHA 3 00268 #define FI_RGBA_RED_MASK 0x00FF0000 00269 #define FI_RGBA_GREEN_MASK 0x0000FF00 00270 #define FI_RGBA_BLUE_MASK 0x000000FF 00271 #define FI_RGBA_ALPHA_MASK 0xFF000000 00272 #define FI_RGBA_RED_SHIFT 16 00273 #define FI_RGBA_GREEN_SHIFT 8 00274 #define FI_RGBA_BLUE_SHIFT 0 00275 #define FI_RGBA_ALPHA_SHIFT 24 00276 #else 00277 // Big Endian (PPC / Linux, MaxOSX) : RGB(A) order 00278 #define FI_RGBA_RED 0 00279 #define FI_RGBA_GREEN 1 00280 #define FI_RGBA_BLUE 2 00281 #define FI_RGBA_ALPHA 3 00282 #define FI_RGBA_RED_MASK 0xFF000000 00283 #define FI_RGBA_GREEN_MASK 0x00FF0000 00284 #define FI_RGBA_BLUE_MASK 0x0000FF00 00285 #define FI_RGBA_ALPHA_MASK 0x000000FF 00286 #define FI_RGBA_RED_SHIFT 24 00287 #define FI_RGBA_GREEN_SHIFT 16 00288 #define FI_RGBA_BLUE_SHIFT 8 00289 #define FI_RGBA_ALPHA_SHIFT 0 00290 #endif // FREEIMAGE_BIGENDIAN 00291 00292 #define FI_RGBA_RGB_MASK (FI_RGBA_RED_MASK|FI_RGBA_GREEN_MASK|FI_RGBA_BLUE_MASK) 00293 00294 // The 16bit macros only include masks and shifts, since each color element is not byte aligned 00295 00296 #define FI16_555_RED_MASK 0x7C00 00297 #define FI16_555_GREEN_MASK 0x03E0 00298 #define FI16_555_BLUE_MASK 0x001F 00299 #define FI16_555_RED_SHIFT 10 00300 #define FI16_555_GREEN_SHIFT 5 00301 #define FI16_555_BLUE_SHIFT 0 00302 #define FI16_565_RED_MASK 0xF800 00303 #define FI16_565_GREEN_MASK 0x07E0 00304 #define FI16_565_BLUE_MASK 0x001F 00305 #define FI16_565_RED_SHIFT 11 00306 #define FI16_565_GREEN_SHIFT 5 00307 #define FI16_565_BLUE_SHIFT 0 00308 00309 // ICC profile support ------------------------------------------------------ 00310 00311 #define FIICC_DEFAULT 0x00 00312 #define FIICC_COLOR_IS_CMYK 0x01 00313 00314 FI_STRUCT (FIICCPROFILE) { 00315 WORD flags; // info flag 00316 DWORD size; // profile's size measured in bytes 00317 void *data; // points to a block of contiguous memory containing the profile 00318 }; 00319 00320 // Important enums ---------------------------------------------------------- 00321 00324 FI_ENUM(FREE_IMAGE_FORMAT) { 00325 FIF_UNKNOWN = -1, 00326 FIF_BMP = 0, 00327 FIF_ICO = 1, 00328 FIF_JPEG = 2, 00329 FIF_JNG = 3, 00330 FIF_KOALA = 4, 00331 FIF_LBM = 5, 00332 FIF_IFF = FIF_LBM, 00333 FIF_MNG = 6, 00334 FIF_PBM = 7, 00335 FIF_PBMRAW = 8, 00336 FIF_PCD = 9, 00337 FIF_PCX = 10, 00338 FIF_PGM = 11, 00339 FIF_PGMRAW = 12, 00340 FIF_PNG = 13, 00341 FIF_PPM = 14, 00342 FIF_PPMRAW = 15, 00343 FIF_RAS = 16, 00344 FIF_TARGA = 17, 00345 FIF_TIFF = 18, 00346 FIF_WBMP = 19, 00347 FIF_PSD = 20, 00348 FIF_CUT = 21, 00349 FIF_XBM = 22, 00350 FIF_XPM = 23, 00351 FIF_DDS = 24, 00352 FIF_GIF = 25, 00353 FIF_HDR = 26, 00354 FIF_FAXG3 = 27, 00355 FIF_SGI = 28 00356 }; 00357 00360 FI_ENUM(FREE_IMAGE_TYPE) { 00361 FIT_UNKNOWN = 0, // unknown type 00362 FIT_BITMAP = 1, // standard image : 1-, 4-, 8-, 16-, 24-, 32-bit 00363 FIT_UINT16 = 2, // array of unsigned short : unsigned 16-bit 00364 FIT_INT16 = 3, // array of short : signed 16-bit 00365 FIT_UINT32 = 4, // array of unsigned long : unsigned 32-bit 00366 FIT_INT32 = 5, // array of long : signed 32-bit 00367 FIT_FLOAT = 6, // array of float : 32-bit IEEE floating point 00368 FIT_DOUBLE = 7, // array of double : 64-bit IEEE floating point 00369 FIT_COMPLEX = 8, // array of FICOMPLEX : 2 x 64-bit IEEE floating point 00370 FIT_RGB16 = 9, // 48-bit RGB image : 3 x 16-bit 00371 FIT_RGBA16 = 10, // 64-bit RGBA image : 4 x 16-bit 00372 FIT_RGBF = 11, // 96-bit RGB float image : 3 x 32-bit IEEE floating point 00373 FIT_RGBAF = 12 // 128-bit RGBA float image : 4 x 32-bit IEEE floating point 00374 }; 00375 00378 FI_ENUM(FREE_IMAGE_COLOR_TYPE) { 00379 FIC_MINISWHITE = 0, // min value is white 00380 FIC_MINISBLACK = 1, // min value is black 00381 FIC_RGB = 2, // RGB color model 00382 FIC_PALETTE = 3, // color map indexed 00383 FIC_RGBALPHA = 4, // RGB color model with alpha channel 00384 FIC_CMYK = 5 // CMYK color model 00385 }; 00386 00390 FI_ENUM(FREE_IMAGE_QUANTIZE) { 00391 FIQ_WUQUANT = 0, // Xiaolin Wu color quantization algorithm 00392 FIQ_NNQUANT = 1 // NeuQuant neural-net quantization algorithm by Anthony Dekker 00393 }; 00394 00398 FI_ENUM(FREE_IMAGE_DITHER) { 00399 FID_FS = 0, // Floyd & Steinberg error diffusion 00400 FID_BAYER4x4 = 1, // Bayer ordered dispersed dot dithering (order 2 dithering matrix) 00401 FID_BAYER8x8 = 2, // Bayer ordered dispersed dot dithering (order 3 dithering matrix) 00402 FID_CLUSTER6x6 = 3, // Ordered clustered dot dithering (order 3 - 6x6 matrix) 00403 FID_CLUSTER8x8 = 4, // Ordered clustered dot dithering (order 4 - 8x8 matrix) 00404 FID_CLUSTER16x16= 5 // Ordered clustered dot dithering (order 8 - 16x16 matrix) 00405 }; 00406 00410 FI_ENUM(FREE_IMAGE_JPEG_OPERATION) { 00411 FIJPEG_OP_NONE = 0, // no transformation 00412 FIJPEG_OP_FLIP_H = 1, // horizontal flip 00413 FIJPEG_OP_FLIP_V = 2, // vertical flip 00414 FIJPEG_OP_TRANSPOSE = 3, // transpose across UL-to-LR axis 00415 FIJPEG_OP_TRANSVERSE = 4, // transpose across UR-to-LL axis 00416 FIJPEG_OP_ROTATE_90 = 5, // 90-degree clockwise rotation 00417 FIJPEG_OP_ROTATE_180 = 6, // 180-degree rotation 00418 FIJPEG_OP_ROTATE_270 = 7 // 270-degree clockwise (or 90 ccw) 00419 }; 00420 00424 FI_ENUM(FREE_IMAGE_TMO) { 00425 FITMO_DRAGO03 = 0, // Adaptive logarithmic mapping (F. Drago, 2003) 00426 FITMO_REINHARD05 = 1, // Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005) 00427 }; 00428 00432 FI_ENUM(FREE_IMAGE_FILTER) { 00433 FILTER_BOX = 0, // Box, pulse, Fourier window, 1st order (constant) b-spline 00434 FILTER_BICUBIC = 1, // Mitchell & Netravali's two-param cubic filter 00435 FILTER_BILINEAR = 2, // Bilinear filter 00436 FILTER_BSPLINE = 3, // 4th order (cubic) b-spline 00437 FILTER_CATMULLROM = 4, // Catmull-Rom spline, Overhauser spline 00438 FILTER_LANCZOS3 = 5 // Lanczos3 filter 00439 }; 00440 00444 FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) { 00445 FICC_RGB = 0, // Use red, green and blue channels 00446 FICC_RED = 1, // Use red channel 00447 FICC_GREEN = 2, // Use green channel 00448 FICC_BLUE = 3, // Use blue channel 00449 FICC_ALPHA = 4, // Use alpha channel 00450 FICC_BLACK = 5, // Use black channel 00451 FICC_REAL = 6, // Complex images: use real part 00452 FICC_IMAG = 7, // Complex images: use imaginary part 00453 FICC_MAG = 8, // Complex images: use magnitude 00454 FICC_PHASE = 9 // Complex images: use phase 00455 }; 00456 00457 // Metadata support --------------------------------------------------------- 00458 00464 FI_ENUM(FREE_IMAGE_MDTYPE) { 00465 FIDT_NOTYPE = 0, // placeholder 00466 FIDT_BYTE = 1, // 8-bit unsigned integer 00467 FIDT_ASCII = 2, // 8-bit bytes w/ last byte null 00468 FIDT_SHORT = 3, // 16-bit unsigned integer 00469 FIDT_LONG = 4, // 32-bit unsigned integer 00470 FIDT_RATIONAL = 5, // 64-bit unsigned fraction 00471 FIDT_SBYTE = 6, // 8-bit signed integer 00472 FIDT_UNDEFINED = 7, // 8-bit untyped data 00473 FIDT_SSHORT = 8, // 16-bit signed integer 00474 FIDT_SLONG = 9, // 32-bit signed integer 00475 FIDT_SRATIONAL = 10, // 64-bit signed fraction 00476 FIDT_FLOAT = 11, // 32-bit IEEE floating point 00477 FIDT_DOUBLE = 12, // 64-bit IEEE floating point 00478 FIDT_IFD = 13, // 32-bit unsigned integer (offset) 00479 FIDT_PALETTE = 14 // 32-bit RGBQUAD 00480 }; 00481 00485 FI_ENUM(FREE_IMAGE_MDMODEL) { 00486 FIMD_NODATA = -1, 00487 FIMD_COMMENTS = 0, // single comment or keywords 00488 FIMD_EXIF_MAIN = 1, // Exif-TIFF metadata 00489 FIMD_EXIF_EXIF = 2, // Exif-specific metadata 00490 FIMD_EXIF_GPS = 3, // Exif GPS metadata 00491 FIMD_EXIF_MAKERNOTE = 4, // Exif maker note metadata 00492 FIMD_EXIF_INTEROP = 5, // Exif interoperability metadata 00493 FIMD_IPTC = 6, // IPTC/NAA metadata 00494 FIMD_XMP = 7, // Abobe XMP metadata 00495 FIMD_GEOTIFF = 8, // GeoTIFF metadata 00496 FIMD_ANIMATION = 9, // Animation metadata 00497 FIMD_CUSTOM = 10 // Used to attach other metadata types to a dib 00498 }; 00499 00503 FI_STRUCT (FIMETADATA) { void *data; }; 00504 00508 FI_STRUCT (FITAG) { void *data; }; 00509 00510 // File IO routines --------------------------------------------------------- 00511 00512 #ifndef FREEIMAGE_IO 00513 #define FREEIMAGE_IO 00514 00515 typedef void* fi_handle; 00516 typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle); 00517 typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle); 00518 typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin); 00519 typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle); 00520 00521 #if (defined(_WIN32) || defined(__WIN32__)) 00522 #pragma pack(push, 1) 00523 #else 00524 #pragma pack(1) 00525 #endif // WIN32 00526 00527 FI_STRUCT(FreeImageIO) { 00528 FI_ReadProc read_proc; // pointer to the function used to read data 00529 FI_WriteProc write_proc; // pointer to the function used to write data 00530 FI_SeekProc seek_proc; // pointer to the function used to seek 00531 FI_TellProc tell_proc; // pointer to the function used to aquire the current position 00532 }; 00533 00534 #if (defined(_WIN32) || defined(__WIN32__)) 00535 #pragma pack(pop) 00536 #else 00537 #pragma pack() 00538 #endif // WIN32 00539 00543 FI_STRUCT (FIMEMORY) { void *data; }; 00544 00545 #endif // FREEIMAGE_IO 00546 00547 // Plugin routines ---------------------------------------------------------- 00548 00549 #ifndef PLUGINS 00550 #define PLUGINS 00551 00552 typedef const char *(DLL_CALLCONV *FI_FormatProc) (); 00553 typedef const char *(DLL_CALLCONV *FI_DescriptionProc) (); 00554 typedef const char *(DLL_CALLCONV *FI_ExtensionListProc) (); 00555 typedef const char *(DLL_CALLCONV *FI_RegExprProc) (); 00556 typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read); 00557 typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data); 00558 typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data); 00559 typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data); 00560 typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data); 00561 typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data); 00562 typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle); 00563 typedef const char *(DLL_CALLCONV *FI_MimeProc) (); 00564 typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp); 00565 typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type); 00566 typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(); 00567 00568 FI_STRUCT (Plugin) { 00569 FI_FormatProc format_proc; 00570 FI_DescriptionProc description_proc; 00571 FI_ExtensionListProc extension_proc; 00572 FI_RegExprProc regexpr_proc; 00573 FI_OpenProc open_proc; 00574 FI_CloseProc close_proc; 00575 FI_PageCountProc pagecount_proc; 00576 FI_PageCapabilityProc pagecapability_proc; 00577 FI_LoadProc load_proc; 00578 FI_SaveProc save_proc; 00579 FI_ValidateProc validate_proc; 00580 FI_MimeProc mime_proc; 00581 FI_SupportsExportBPPProc supports_export_bpp_proc; 00582 FI_SupportsExportTypeProc supports_export_type_proc; 00583 FI_SupportsICCProfilesProc supports_icc_profiles_proc; 00584 }; 00585 00586 typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id); 00587 00588 #endif // PLUGINS 00589 00590 00591 // Load / Save flag constants ----------------------------------------------- 00592 00593 #define BMP_DEFAULT 0 00594 #define BMP_SAVE_RLE 1 00595 #define CUT_DEFAULT 0 00596 #define DDS_DEFAULT 0 00597 #define FAXG3_DEFAULT 0 00598 #define GIF_DEFAULT 0 00599 #define GIF_LOAD256 1 // Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color 00600 #define GIF_PLAYBACK 2 // 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading 00601 #define HDR_DEFAULT 0 00602 #define ICO_DEFAULT 0 00603 #define ICO_MAKEALPHA 1 // convert to 32bpp and create an alpha channel from the AND-mask when loading 00604 #define IFF_DEFAULT 0 00605 #define JPEG_DEFAULT 0 00606 #define JPEG_FAST 1 00607 #define JPEG_ACCURATE 2 00608 #define JPEG_QUALITYSUPERB 0x80 00609 #define JPEG_QUALITYGOOD 0x100 00610 #define JPEG_QUALITYNORMAL 0x200 00611 #define JPEG_QUALITYAVERAGE 0x400 00612 #define JPEG_QUALITYBAD 0x800 00613 #define JPEG_CMYK 0x1000 // load separated CMYK "as is" (use | to combine with other flags) 00614 #define JPEG_PROGRESSIVE 0x2000 // save as a progressive-JPEG (use | to combine with other flags) 00615 #define KOALA_DEFAULT 0 00616 #define LBM_DEFAULT 0 00617 #define MNG_DEFAULT 0 00618 #define PCD_DEFAULT 0 00619 #define PCD_BASE 1 // load the bitmap sized 768 x 512 00620 #define PCD_BASEDIV4 2 // load the bitmap sized 384 x 256 00621 #define PCD_BASEDIV16 3 // load the bitmap sized 192 x 128 00622 #define PCX_DEFAULT 0 00623 #define PNG_DEFAULT 0 00624 #define PNG_IGNOREGAMMA 1 // avoid gamma correction 00625 #define PNM_DEFAULT 0 00626 #define PNM_SAVE_RAW 0 // If set the writer saves in RAW format (i.e. P4, P5 or P6) 00627 #define PNM_SAVE_ASCII 1 // If set the writer saves in ASCII format (i.e. P1, P2 or P3) 00628 #define PSD_DEFAULT 0 00629 #define RAS_DEFAULT 0 00630 #define SGI_DEFAULT 0 00631 #define TARGA_DEFAULT 0 00632 #define TARGA_LOAD_RGB888 1 // If set the loader converts RGB555 and ARGB8888 -> RGB888. 00633 #define TIFF_DEFAULT 0 00634 #define TIFF_CMYK 0x0001 // reads/stores tags for separated CMYK (use | to combine with compression flags) 00635 #define TIFF_PACKBITS 0x0100 // save using PACKBITS compression 00636 #define TIFF_DEFLATE 0x0200 // save using DEFLATE compression (a.k.a. ZLIB compression) 00637 #define TIFF_ADOBE_DEFLATE 0x0400 // save using ADOBE DEFLATE compression 00638 #define TIFF_NONE 0x0800 // save without any compression 00639 #define TIFF_CCITTFAX3 0x1000 // save using CCITT Group 3 fax encoding 00640 #define TIFF_CCITTFAX4 0x2000 // save using CCITT Group 4 fax encoding 00641 #define TIFF_LZW 0x4000 // save using LZW compression 00642 #define TIFF_JPEG 0x8000 // save using JPEG compression 00643 #define WBMP_DEFAULT 0 00644 #define XBM_DEFAULT 0 00645 #define XPM_DEFAULT 0 00646 00647 00648 #ifdef __cplusplus 00649 extern "C" { 00650 #endif 00651 00652 // Init / Error routines ---------------------------------------------------- 00653 00654 DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE)); 00655 DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void); 00656 00657 // Version routines --------------------------------------------------------- 00658 00659 DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void); 00660 DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void); 00661 00662 // Message output functions ------------------------------------------------- 00663 00664 DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...); 00665 00666 typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg); 00667 DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf); 00668 00669 // Allocate / Clone / Unload routines --------------------------------------- 00670 00671 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)); 00672 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)); 00673 DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib); 00674 DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib); 00675 00676 // Load / Save routines ----------------------------------------------------- 00677 00678 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0)); 00679 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0)); 00680 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); 00681 DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0)); 00682 DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0)); 00683 DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); 00684 00685 // Memory I/O stream routines ----------------------------------------------- 00686 00687 DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0)); 00688 DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream); 00689 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0)); 00690 DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0)); 00691 DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream); 00692 DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin); 00693 DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes); 00694 DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream); 00695 DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream); 00696 00697 // Plugin Interface --------------------------------------------------------- 00698 00699 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)); 00700 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)); 00701 DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void); 00702 DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable); 00703 DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif); 00704 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format); 00705 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime); 00706 DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif); 00707 DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif); 00708 DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif); 00709 DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif); 00710 DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif); 00711 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename); 00712 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename); 00713 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif); 00714 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif); 00715 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp); 00716 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type); 00717 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif); 00718 00719 // Multipaging interface ---------------------------------------------------- 00720 00721 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)); 00722 DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0)); 00723 DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap); 00724 DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data); 00725 DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data); 00726 DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page); 00727 DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page); 00728 DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *data, BOOL changed); 00729 DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source); 00730 DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count); 00731 00732 // Filetype request routines ------------------------------------------------ 00733 00734 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0)); 00735 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0)); 00736 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0)); 00737 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0)); 00738 00739 // Image type request routine ----------------------------------------------- 00740 00741 DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib); 00742 00743 // FreeImage helper routines ------------------------------------------------ 00744 00745 DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void); 00746 DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue); 00747 DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue); 00748 00749 00750 // Pixel access routines ---------------------------------------------------- 00751 00752 DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib); 00753 DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline); 00754 00755 DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); 00756 DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); 00757 DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value); 00758 DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value); 00759 00760 // DIB info routines -------------------------------------------------------- 00761 00762 DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib); 00763 DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib); 00764 DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib); 00765 DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib); 00766 DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib); 00767 DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib); 00768 DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib); 00769 DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib); 00770 00771 DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib); 00772 DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib); 00773 DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res); 00774 DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res); 00775 00776 DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib); 00777 DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib); 00778 DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib); 00779 00780 DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib); 00781 DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib); 00782 DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib); 00783 00784 DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib); 00785 DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib); 00786 DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled); 00787 DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count); 00788 DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib); 00789 00790 DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib); 00791 DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor); 00792 DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor); 00793 00794 00795 // ICC profile routines ----------------------------------------------------- 00796 00797 DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib); 00798 DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size); 00799 DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib); 00800 00801 // Line conversion routines ------------------------------------------------- 00802 00803 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels); 00804 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00805 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels); 00806 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels); 00807 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels); 00808 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels); 00809 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels); 00810 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels); 00811 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels); 00812 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels); 00813 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels); 00814 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels); 00815 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00816 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00817 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00818 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels); 00819 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels); 00820 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels); 00821 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00822 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00823 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00824 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels); 00825 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels); 00826 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels); 00827 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00828 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00829 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00830 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels); 00831 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels); 00832 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels); 00833 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00834 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00835 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00836 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels); 00837 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels); 00838 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels); 00839 00840 // Smart conversion routines ------------------------------------------------ 00841 00842 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo4Bits(FIBITMAP *dib); 00843 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib); 00844 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToGreyscale(FIBITMAP *dib); 00845 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib); 00846 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib); 00847 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib); 00848 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib); 00849 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize); 00850 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)); 00851 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T); 00852 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm); 00853 00854 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)); 00855 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)); 00856 00857 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib); 00858 00859 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear FI_DEFAULT(TRUE)); 00860 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear FI_DEFAULT(TRUE)); 00861 00862 // tone mapping operators 00863 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)); 00864 DLL_API FIBITMAP* DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0)); 00865 DLL_API FIBITMAP* DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0)); 00866 00867 // ZLib interface ----------------------------------------------------------- 00868 00869 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); 00870 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); 00871 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); 00872 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); 00873 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size); 00874 00875 // -------------------------------------------------------------------------- 00876 // Metadata routines -------------------------------------------------------- 00877 // -------------------------------------------------------------------------- 00878 00879 // tag creation / destruction 00880 DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag(); 00881 DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag); 00882 DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag); 00883 00884 // tag getters and setters 00885 DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag); 00886 DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag); 00887 DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag); 00888 DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag); 00889 DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag); 00890 DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag); 00891 DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag); 00892 00893 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key); 00894 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagDescription(FITAG *tag, const char *description); 00895 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagID(FITAG *tag, WORD id); 00896 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagType(FITAG *tag, FREE_IMAGE_MDTYPE type); 00897 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagCount(FITAG *tag, DWORD count); 00898 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagLength(FITAG *tag, DWORD length); 00899 DLL_API BOOL DLL_CALLCONV FreeImage_SetTagValue(FITAG *tag, const void *value); 00900 00901 // iterator 00902 DLL_API FIMETADATA *DLL_CALLCONV FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag); 00903 DLL_API BOOL DLL_CALLCONV FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag); 00904 DLL_API void DLL_CALLCONV FreeImage_FindCloseMetadata(FIMETADATA *mdhandle); 00905 00906 // metadata setter and getter 00907 DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag); 00908 DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag); 00909 00910 // helpers 00911 DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib); 00912 00913 // tag to C string conversion 00914 DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL)); 00915 00916 // -------------------------------------------------------------------------- 00917 // Image manipulation toolkit ----------------------------------------------- 00918 // -------------------------------------------------------------------------- 00919 00920 // rotation and flipping 00921 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle); 00922 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); 00923 DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib); 00924 DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib); 00925 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)); 00926 00927 // upsampling / downsampling 00928 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter); 00929 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert FI_DEFAULT(TRUE)); 00930 00931 // color manipulation routines (point operations) 00932 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); 00933 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma); 00934 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage); 00935 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage); 00936 DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib); 00937 DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK)); 00938 00939 // channel processing routines 00940 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel); 00941 DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dib, FIBITMAP *dib8, FREE_IMAGE_COLOR_CHANNEL channel); 00942 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel); 00943 DLL_API BOOL DLL_CALLCONV FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel); 00944 00945 // copy / paste / composite routines 00946 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom); 00947 DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha); 00948 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL)); 00949 00950 00951 // restore the borland-specific enum size option 00952 #if defined(__BORLANDC__) 00953 #pragma option pop 00954 #endif 00955 00956 #ifdef __cplusplus 00957 } 00958 #endif 00959 00960 #endif // FREEIMAGE_H