📄 freeimage.h
字号:
FIDT_NOTYPE = 0, // placeholder
FIDT_BYTE = 1, // 8-bit unsigned integer
FIDT_ASCII = 2, // 8-bit bytes w/ last byte null
FIDT_SHORT = 3, // 16-bit unsigned integer
FIDT_LONG = 4, // 32-bit unsigned integer
FIDT_RATIONAL = 5, // 64-bit unsigned fraction
FIDT_SBYTE = 6, // 8-bit signed integer
FIDT_UNDEFINED = 7, // 8-bit untyped data
FIDT_SSHORT = 8, // 16-bit signed integer
FIDT_SLONG = 9, // 32-bit signed integer
FIDT_SRATIONAL = 10, // 64-bit signed fraction
FIDT_FLOAT = 11, // 32-bit IEEE floating point
FIDT_DOUBLE = 12, // 64-bit IEEE floating point
FIDT_IFD = 13, // 32-bit unsigned integer (offset)
FIDT_PALETTE = 14 // 32-bit RGBQUAD
};
/**
Metadata models supported by FreeImage
*/
FI_ENUM(FREE_IMAGE_MDMODEL) {
FIMD_NODATA = -1,
FIMD_COMMENTS = 0, // single comment or keywords
FIMD_EXIF_MAIN = 1, // Exif-TIFF metadata
FIMD_EXIF_EXIF = 2, // Exif-specific metadata
FIMD_EXIF_GPS = 3, // Exif GPS metadata
FIMD_EXIF_MAKERNOTE = 4, // Exif maker note metadata
FIMD_EXIF_INTEROP = 5, // Exif interoperability metadata
FIMD_IPTC = 6, // IPTC/NAA metadata
FIMD_XMP = 7, // Abobe XMP metadata
FIMD_GEOTIFF = 8, // GeoTIFF metadata
FIMD_ANIMATION = 9, // Animation metadata
FIMD_CUSTOM = 10 // Used to attach other metadata types to a dib
};
/**
Handle to a metadata model
*/
FI_STRUCT (FIMETADATA) { void *data; };
/**
Handle to a FreeImage tag
*/
FI_STRUCT (FITAG) { void *data; };
// File IO routines ---------------------------------------------------------
#ifndef FREEIMAGE_IO
#define FREEIMAGE_IO
typedef void* fi_handle;
typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin);
typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle);
#if (defined(_WIN32) || defined(__WIN32__))
#pragma pack(push, 1)
#else
#pragma pack(1)
#endif // WIN32
FI_STRUCT(FreeImageIO) {
FI_ReadProc read_proc; // pointer to the function used to read data
FI_WriteProc write_proc; // pointer to the function used to write data
FI_SeekProc seek_proc; // pointer to the function used to seek
FI_TellProc tell_proc; // pointer to the function used to aquire the current position
};
#if (defined(_WIN32) || defined(__WIN32__))
#pragma pack(pop)
#else
#pragma pack()
#endif // WIN32
/**
Handle to a memory I/O stream
*/
FI_STRUCT (FIMEMORY) { void *data; };
#endif // FREEIMAGE_IO
// Plugin routines ----------------------------------------------------------
#ifndef PLUGINS
#define PLUGINS
typedef const char *(DLL_CALLCONV *FI_FormatProc) ();
typedef const char *(DLL_CALLCONV *FI_DescriptionProc) ();
typedef const char *(DLL_CALLCONV *FI_ExtensionListProc) ();
typedef const char *(DLL_CALLCONV *FI_RegExprProc) ();
typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read);
typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data);
typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data);
typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data);
typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data);
typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data);
typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle);
typedef const char *(DLL_CALLCONV *FI_MimeProc) ();
typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp);
typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type);
typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)();
FI_STRUCT (Plugin) {
FI_FormatProc format_proc;
FI_DescriptionProc description_proc;
FI_ExtensionListProc extension_proc;
FI_RegExprProc regexpr_proc;
FI_OpenProc open_proc;
FI_CloseProc close_proc;
FI_PageCountProc pagecount_proc;
FI_PageCapabilityProc pagecapability_proc;
FI_LoadProc load_proc;
FI_SaveProc save_proc;
FI_ValidateProc validate_proc;
FI_MimeProc mime_proc;
FI_SupportsExportBPPProc supports_export_bpp_proc;
FI_SupportsExportTypeProc supports_export_type_proc;
FI_SupportsICCProfilesProc supports_icc_profiles_proc;
};
typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id);
#endif // PLUGINS
// Load / Save flag constants -----------------------------------------------
#define BMP_DEFAULT 0
#define BMP_SAVE_RLE 1
#define CUT_DEFAULT 0
#define DDS_DEFAULT 0
#define EXR_DEFAULT 0 // save data as half with piz-based wavelet compression
#define EXR_FLOAT 0x0001 // save data as float instead of as half (not recommended)
#define EXR_NONE 0x0002 // save with no compression
#define EXR_ZIP 0x0004 // save with zlib compression, in blocks of 16 scan lines
#define EXR_PIZ 0x0008 // save with piz-based wavelet compression
#define EXR_PXR24 0x0010 // save with lossy 24-bit float compression
#define EXR_B44 0x0020 // save with lossy 44% float compression - goes to 22% when combined with EXR_LC
#define EXR_LC 0x0040 // save images with one luminance and two chroma channels, rather than as RGB (lossy compression)
#define FAXG3_DEFAULT 0
#define GIF_DEFAULT 0
#define GIF_LOAD256 1 // Load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color
#define GIF_PLAYBACK 2 // 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading
#define HDR_DEFAULT 0
#define ICO_DEFAULT 0
#define ICO_MAKEALPHA 1 // convert to 32bpp and create an alpha channel from the AND-mask when loading
#define IFF_DEFAULT 0
#define J2K_DEFAULT 0 // save with a 16:1 rate
#define JP2_DEFAULT 0 // save with a 16:1 rate
#define JPEG_DEFAULT 0 // loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD)
#define JPEG_FAST 0x0001 // load the file as fast as possible, sacrificing some quality
#define JPEG_ACCURATE 0x0002 // load the file with the best quality, sacrificing some speed
#define JPEG_CMYK 0x0004 // load separated CMYK "as is" (use | to combine with other load flags)
#define JPEG_QUALITYSUPERB 0x80 // save with superb quality (100:1)
#define JPEG_QUALITYGOOD 0x0100 // save with good quality (75:1)
#define JPEG_QUALITYNORMAL 0x0200 // save with normal quality (50:1)
#define JPEG_QUALITYAVERAGE 0x0400 // save with average quality (25:1)
#define JPEG_QUALITYBAD 0x0800 // save with bad quality (10:1)
#define JPEG_PROGRESSIVE 0x2000 // save as a progressive-JPEG (use | to combine with other save flags)
#define KOALA_DEFAULT 0
#define LBM_DEFAULT 0
#define MNG_DEFAULT 0
#define PCD_DEFAULT 0
#define PCD_BASE 1 // load the bitmap sized 768 x 512
#define PCD_BASEDIV4 2 // load the bitmap sized 384 x 256
#define PCD_BASEDIV16 3 // load the bitmap sized 192 x 128
#define PCX_DEFAULT 0
#define PNG_DEFAULT 0
#define PNG_IGNOREGAMMA 1 // avoid gamma correction
#define PNM_DEFAULT 0
#define PNM_SAVE_RAW 0 // If set the writer saves in RAW format (i.e. P4, P5 or P6)
#define PNM_SAVE_ASCII 1 // If set the writer saves in ASCII format (i.e. P1, P2 or P3)
#define PSD_DEFAULT 0
#define RAS_DEFAULT 0
#define SGI_DEFAULT 0
#define TARGA_DEFAULT 0
#define TARGA_LOAD_RGB888 1 // If set the loader converts RGB555 and ARGB8888 -> RGB888.
#define TIFF_DEFAULT 0
#define TIFF_CMYK 0x0001 // reads/stores tags for separated CMYK (use | to combine with compression flags)
#define TIFF_PACKBITS 0x0100 // save using PACKBITS compression
#define TIFF_DEFLATE 0x0200 // save using DEFLATE compression (a.k.a. ZLIB compression)
#define TIFF_ADOBE_DEFLATE 0x0400 // save using ADOBE DEFLATE compression
#define TIFF_NONE 0x0800 // save without any compression
#define TIFF_CCITTFAX3 0x1000 // save using CCITT Group 3 fax encoding
#define TIFF_CCITTFAX4 0x2000 // save using CCITT Group 4 fax encoding
#define TIFF_LZW 0x4000 // save using LZW compression
#define TIFF_JPEG 0x8000 // save using JPEG compression
#define WBMP_DEFAULT 0
#define XBM_DEFAULT 0
#define XPM_DEFAULT 0
#ifdef __cplusplus
extern "C" {
#endif
// Init / Error routines ----------------------------------------------------
DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE));
DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void);
// Version routines ---------------------------------------------------------
DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void);
DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void);
// Message output functions -------------------------------------------------
typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg);
typedef void (DLL_CALLCONV *FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT fif, const char *msg);
DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf);
DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf);
DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...);
// Allocate / Clone / Unload routines ---------------------------------------
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));
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));
DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib);
DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib);
// Load / Save routines -----------------------------------------------------
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0));
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0));
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0));
DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0));
DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
// Memory I/O stream routines -----------------------------------------------
DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0));
DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream);
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0));
DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream);
DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin);
DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes);
DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
DLL_API FIMULTIBITMAP *DLL_CALLCONV FreeImage_LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
// Plugin Interface ---------------------------------------------------------
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));
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));
DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void);
DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable);
DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif);
DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format);
DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime);
DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif);
DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif);
DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif);
DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif);
DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif);
DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename);
DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename);
DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -