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 // - Ryan Rubley (ryan@lostreality.org) 00025 // 00026 // This file is part of FreeImage 3 00027 // 00028 // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY 00029 // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES 00030 // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE 00031 // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED 00032 // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT 00033 // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY 00034 // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL 00035 // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER 00036 // THIS DISCLAIMER. 00037 // 00038 // Use at your own risk! 00039 // ========================================================== 00040 00041 #ifndef FREEIMAGE_H 00042 #define FREEIMAGE_H 00043 00044 // Compiler options --------------------------------------------------------- 00045 00046 #if defined(FREEIMAGE_LIB) || !defined(WIN32) 00047 #define DLL_API 00048 #define DLL_CALLCONV 00049 #else 00050 #define WIN32_LEAN_AND_MEAN 00051 #define DLL_CALLCONV __stdcall 00052 // The following ifdef block is the standard way of creating macros which make exporting 00053 // from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS 00054 // symbol defined on the command line. this symbol should not be defined on any project 00055 // that uses this DLL. This way any other project whose source files include this file see 00056 // DLL_API functions as being imported from a DLL, wheras this DLL sees symbols 00057 // defined with this macro as being exported. 00058 #ifdef FREEIMAGE_EXPORTS 00059 #define DLL_API __declspec(dllexport) 00060 #else 00061 #define DLL_API __declspec(dllimport) 00062 #endif // FREEIMAGE_EXPORTS 00063 #endif // FREEIMAGE_LIB || !WIN32 00064 00065 // For C compatility -------------------------------------------------------- 00066 00067 #ifdef __cplusplus 00068 #define FI_DEFAULT(x) = x 00069 #define FI_ENUM(x) enum x 00070 #define FI_STRUCT(x) struct x 00071 #else 00072 #define FI_DEFAULT(x) 00073 #define FI_ENUM(x) typedef int x; enum x 00074 #define FI_STRUCT(x) typedef struct x x; struct x 00075 #endif 00076 00077 // Bitmap types ------------------------------------------------------------- 00078 00079 FI_STRUCT (FIBITMAP) { void *data; }; 00080 FI_STRUCT (FIMULTIBITMAP) { void *data; }; 00081 00082 // Types used in the library (directly copied from Windows) ----------------- 00083 00084 #ifndef _WINDOWS_ 00085 #define _WINDOWS_ 00086 00087 #ifndef FALSE 00088 #define FALSE 0 00089 #endif 00090 #ifndef TRUE 00091 #define TRUE 1 00092 #endif 00093 #ifndef NULL 00094 #define NULL 0 00095 #endif 00096 00097 #ifndef SEEK_SET 00098 #define SEEK_SET 0 00099 #define SEEK_CUR 1 00100 #define SEEK_END 2 00101 #endif 00102 00103 //#ifndef __GNUC__ 00104 typedef long BOOL; 00105 typedef unsigned char BYTE; 00106 typedef unsigned short WORD; 00107 typedef unsigned long DWORD; 00108 typedef long LONG; 00109 00110 typedef struct tagRGBQUAD { 00111 BYTE rgbBlue; 00112 BYTE rgbGreen; 00113 BYTE rgbRed; 00114 BYTE rgbReserved; 00115 } RGBQUAD; 00116 00117 typedef struct tagBITMAPINFOHEADER{ 00118 DWORD biSize; 00119 LONG biWidth; 00120 LONG biHeight; 00121 WORD biPlanes; 00122 WORD biBitCount; 00123 DWORD biCompression; 00124 DWORD biSizeImage; 00125 LONG biXPelsPerMeter; 00126 LONG biYPelsPerMeter; 00127 DWORD biClrUsed; 00128 DWORD biClrImportant; 00129 } BITMAPINFOHEADER, *PBITMAPINFOHEADER; 00130 00131 typedef struct tagBITMAPINFO { 00132 BITMAPINFOHEADER bmiHeader; 00133 RGBQUAD bmiColors[1]; 00134 } BITMAPINFO, *PBITMAPINFO; 00135 00136 //#endif // __GNUC__ 00137 #endif // _WINDOWS_ 00138 00139 // ICC profile support ------------------------------------------------------ 00140 00141 #define FIICC_DEFAULT 0x00 00142 #define FIICC_COLOR_IS_CMYK 0x01 00143 00144 FI_STRUCT (FIICCPROFILE) { 00145 WORD flags; // info flag 00146 DWORD size; // profile's size measured in bytes 00147 void *data; // points to a block of contiguous memory containing the profile 00148 }; 00149 00150 // Important enums ---------------------------------------------------------- 00151 00154 FI_ENUM(FREE_IMAGE_FORMAT) { 00155 FIF_UNKNOWN = -1, 00156 FIF_BMP = 0, 00157 FIF_ICO = 1, 00158 FIF_JPEG = 2, 00159 FIF_JNG = 3, 00160 FIF_KOALA = 4, 00161 FIF_LBM = 5, 00162 FIF_IFF = FIF_LBM, 00163 FIF_MNG = 6, 00164 FIF_PBM = 7, 00165 FIF_PBMRAW = 8, 00166 FIF_PCD = 9, 00167 FIF_PCX = 10, 00168 FIF_PGM = 11, 00169 FIF_PGMRAW = 12, 00170 FIF_PNG = 13, 00171 FIF_PPM = 14, 00172 FIF_PPMRAW = 15, 00173 FIF_RAS = 16, 00174 FIF_TARGA = 17, 00175 FIF_TIFF = 18, 00176 FIF_WBMP = 19, 00177 FIF_PSD = 20, 00178 FIF_CUT = 21, 00179 FIF_XBM = 22, 00180 FIF_XPM = 23 00181 }; 00182 00185 FI_ENUM(FREE_IMAGE_COLOR_TYPE) { 00186 FIC_MINISWHITE = 0, // min value is white 00187 FIC_MINISBLACK = 1, // min value is black 00188 FIC_RGB = 2, // RGB color model 00189 FIC_PALETTE = 3, // color map indexed 00190 FIC_RGBALPHA = 4, // RGB color model with alpha channel 00191 FIC_CMYK = 5 // CMYK color model 00192 }; 00193 00197 FI_ENUM(FREE_IMAGE_QUANTIZE) { 00198 FIQ_WUQUANT = 0, // Xiaolin Wu color quantization algorithm 00199 FIQ_NNQUANT = 1 // NeuQuant neural-net quantization algorithm by Anthony Dekker 00200 }; 00201 00205 FI_ENUM(FREE_IMAGE_DITHER) { 00206 FID_FS = 0, // Floyd & Steinberg error diffusion 00207 FID_BAYER4x4 = 1, // Bayer ordered dispersed dot dithering (order 2 dithering matrix) 00208 FID_BAYER8x8 = 2, // Bayer ordered dispersed dot dithering (order 3 dithering matrix) 00209 FID_CLUSTER6x6 = 3, // Ordered clustered dot dithering (order 3 - 6x6 matrix) 00210 FID_CLUSTER8x8 = 4, // Ordered clustered dot dithering (order 4 - 8x8 matrix) 00211 FID_CLUSTER16x16= 5 // Ordered clustered dot dithering (order 8 - 16x16 matrix) 00212 }; 00213 00217 FI_ENUM(FREE_IMAGE_FILTER) { 00218 FILTER_BOX = 0, // Box, pulse, Fourier window, 1st order (constant) b-spline 00219 FILTER_BICUBIC = 1, // Mitchell & Netravali's two-param cubic filter 00220 FILTER_BILINEAR = 2, // Bilinear filter 00221 FILTER_BSPLINE = 3, // 4th order (cubic) b-spline 00222 FILTER_CATMULLROM = 4, // Catmull-Rom spline, Overhauser spline 00223 FILTER_LANCZOS3 = 5 // Lanczos3 filter 00224 }; 00225 00229 FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) { 00230 FICC_RGB = 0, // Use red, green and blue channels 00231 FICC_RED = 1, // Use red channel 00232 FICC_GREEN = 2, // Use green channel 00233 FICC_BLUE = 3, // Use blue channel 00234 FICC_ALPHA = 4, // Use alpha channel 00235 FICC_BLACK = 5 // Use black channel 00236 }; 00237 00238 // File IO routines --------------------------------------------------------- 00239 00240 #ifndef FREEIMAGE_IO 00241 #define FREEIMAGE_IO 00242 00243 typedef void* fi_handle; 00244 typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle); 00245 typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle); 00246 typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin); 00247 typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle); 00248 00249 #ifdef WIN32 00250 #pragma pack(push, 1) 00251 #else 00252 #pragma pack(1) 00253 #endif // WIN32 00254 00255 FI_STRUCT(FreeImageIO) { 00256 FI_ReadProc read_proc; // pointer to the function used to read data 00257 FI_WriteProc write_proc; // pointer to the function used to write data 00258 FI_SeekProc seek_proc; // pointer to the function used to seek 00259 FI_TellProc tell_proc; // pointer to the function used to aquire the current position 00260 }; 00261 00262 #ifdef WIN32 00263 #pragma pack(pop) 00264 #else 00265 #pragma pack() 00266 #endif // WIN32 00267 00268 #endif // FREEIMAGE_IO 00269 00270 // Plugin routines ---------------------------------------------------------- 00271 00272 #ifndef PLUGINS 00273 #define PLUGINS 00274 00275 typedef const char *(DLL_CALLCONV *FI_FormatProc) (); 00276 typedef const char *(DLL_CALLCONV *FI_DescriptionProc) (); 00277 typedef const char *(DLL_CALLCONV *FI_ExtensionListProc) (); 00278 typedef const char *(DLL_CALLCONV *FI_RegExprProc) (); 00279 typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read); 00280 typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data); 00281 typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data); 00282 typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data); 00283 typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data); 00284 typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data); 00285 typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle); 00286 typedef const char *(DLL_CALLCONV *FI_MimeProc) (); 00287 typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp); 00288 typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(); 00289 00290 FI_STRUCT (Plugin) { 00291 FI_FormatProc format_proc; 00292 FI_DescriptionProc description_proc; 00293 FI_ExtensionListProc extension_proc; 00294 FI_RegExprProc regexpr_proc; 00295 FI_OpenProc open_proc; 00296 FI_CloseProc close_proc; 00297 FI_PageCountProc pagecount_proc; 00298 FI_PageCapabilityProc pagecapability_proc; 00299 FI_LoadProc load_proc; 00300 FI_SaveProc save_proc; 00301 FI_ValidateProc validate_proc; 00302 FI_MimeProc mime_proc; 00303 FI_SupportsExportBPPProc supports_export_bpp_proc; 00304 FI_SupportsICCProfilesProc supports_icc_profiles_proc; 00305 }; 00306 00307 typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id); 00308 00309 #endif // PLUGINS 00310 00311 00312 // Load / Save flag constants ----------------------------------------------- 00313 00314 #define BMP_DEFAULT 0 00315 #define BMP_SAVE_RLE 1 00316 #define CUT_DEFAULT 0 00317 #define ICO_DEFAULT 0 00318 #define IFF_DEFAULT 0 00319 #define JPEG_DEFAULT 0 00320 #define JPEG_FAST 1 00321 #define JPEG_ACCURATE 2 00322 #define JPEG_QUALITYSUPERB 0x80 00323 #define JPEG_QUALITYGOOD 0x100 00324 #define JPEG_QUALITYNORMAL 0x200 00325 #define JPEG_QUALITYAVERAGE 0x400 00326 #define JPEG_QUALITYBAD 0x800 00327 #define KOALA_DEFAULT 0 00328 #define LBM_DEFAULT 0 00329 #define MNG_DEFAULT 0 00330 #define PCD_DEFAULT 0 00331 #define PCD_BASE 1 // load the bitmap sized 768 x 512 00332 #define PCD_BASEDIV4 2 // load the bitmap sized 384 x 256 00333 #define PCD_BASEDIV16 3 // load the bitmap sized 192 x 128 00334 #define PCX_DEFAULT 0 00335 #define PNG_DEFAULT 0 00336 #define PNG_IGNOREGAMMA 1 // avoid gamma correction 00337 #define PNM_DEFAULT 0 00338 #define PNM_SAVE_RAW 0 // If set the writer saves in RAW format (i.e. P4, P5 or P6) 00339 #define PNM_SAVE_ASCII 1 // If set the writer saves in ASCII format (i.e. P1, P2 or P3) 00340 #define PSD_DEFAULT 0 00341 #define RAS_DEFAULT 0 00342 #define TARGA_DEFAULT 0 00343 #define TARGA_LOAD_RGB888 1 // If set the loader converts RGB555 and ARGB8888 -> RGB888. 00344 #define TIFF_DEFAULT 0 00345 #define TIFF_CMYK 0x0001 // reads/stores tags for separated CMYK (use | to combine with compression flags) 00346 #define TIFF_PACKBITS 0x0100 // save using PACKBITS compression 00347 #define TIFF_DEFLATE 0x0200 // save using DEFLATE compression 00348 #define TIFF_ADOBE_DEFLATE 0x0400 // save using ADOBE DEFLATE compression 00349 #define TIFF_NONE 0x0800 // save without any compression 00350 #define WBMP_DEFAULT 0 00351 #define XBM_DEFAULT 0 00352 #define XPM_DEFAULT 0 00353 00354 00355 #ifdef __cplusplus 00356 extern "C" { 00357 #endif 00358 00359 // Init / Error routines ---------------------------------------------------- 00360 00361 DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE)); 00362 DLL_API void DLL_CALLCONV FreeImage_DeInitialise(); 00363 00364 // Version routines --------------------------------------------------------- 00365 00366 DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(); 00367 DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(); 00368 00369 // Message output functions ------------------------------------------------- 00370 00371 DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...); 00372 00373 typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg); 00374 DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf); 00375 00376 // Allocate / Clone / Unload routines --------------------------------------- 00377 00378 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)); 00379 DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib); 00380 DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib); 00381 00382 // Load / Save routines ----------------------------------------------------- 00383 00384 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0)); 00385 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); 00386 DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0)); 00387 DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0)); 00388 00389 // Plugin Interface --------------------------------------------------------- 00390 00391 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)); 00392 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)); 00393 DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(); 00394 DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable); 00395 DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif); 00396 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format); 00397 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime); 00398 DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif); 00399 DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif); 00400 DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif); 00401 DLL_API const char * DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif); 00402 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename); 00403 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif); 00404 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif); 00405 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp); 00406 DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif); 00407 00408 // Multipaging interface ---------------------------------------------------- 00409 00410 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)); 00411 DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0)); 00412 DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap); 00413 DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data); 00414 DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data); 00415 DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page); 00416 DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page); 00417 DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *page, BOOL changed); 00418 DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source); 00419 DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count); 00420 00421 // Filetype request routines ------------------------------------------------ 00422 00423 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0)); 00424 DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0)); 00425 00426 // FreeImage info routines -------------------------------------------------- 00427 00428 DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib); 00429 DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib); 00430 DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib); 00431 DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib); 00432 DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib); 00433 DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled); 00434 DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count); 00435 DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib); 00436 00437 // DIB info routines -------------------------------------------------------- 00438 00439 DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib); 00440 DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib); 00441 DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline); 00442 DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib); 00443 DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib); 00444 DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib); 00445 DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib); 00446 DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib); 00447 DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib); 00448 DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib); 00449 DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib); 00450 DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib); 00451 DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib); 00452 DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib); 00453 DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib); 00454 00455 // ICC profile routines ----------------------------------------------------- 00456 00457 DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib); 00458 DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size); 00459 DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib); 00460 00461 // Line conversion routines ------------------------------------------------- 00462 00463 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels); 00464 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels); 00465 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels); 00466 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels); 00467 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels); 00468 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels); 00469 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00470 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00471 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00472 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels); 00473 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels); 00474 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels); 00475 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00476 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00477 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00478 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels); 00479 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels); 00480 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels); 00481 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00482 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00483 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00484 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels); 00485 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels); 00486 DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels); 00487 DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00488 DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00489 DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette); 00490 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels); 00491 DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels); 00492 DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels); 00493 00494 // Smart conversion routines ------------------------------------------------ 00495 00496 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib); 00497 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib); 00498 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib); 00499 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib); 00500 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib); 00501 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize); 00502 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T); 00503 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm); 00504 00505 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)); 00506 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)); 00507 00508 // ZLib interface ----------------------------------------------------------- 00509 00510 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); 00511 DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size); 00512 00513 // -------------------------------------------------------------------------- 00514 // Image manipulation toolkit ----------------------------------------------- 00515 // -------------------------------------------------------------------------- 00516 00517 // rotation and flipping 00518 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle); 00519 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); 00520 DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib); 00521 DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib); 00522 00523 // upsampling / downsampling 00524 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter); 00525 00526 // color manipulation routines (point operations) 00527 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel); 00528 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma); 00529 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage); 00530 DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage); 00531 DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib); 00532 DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK)); 00533 00534 // channel processing routines 00535 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel); 00536 DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dib, FIBITMAP *dib8, FREE_IMAGE_COLOR_CHANNEL channel); 00537 00538 // copy / paste routines 00539 DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom); 00540 DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha); 00541 00542 00543 #ifdef __cplusplus 00544 } 00545 #endif 00546 00547 #endif // FREEIMAGE_H