47
47
// Version information ------------------------------------------------------
49
49
#define FREEIMAGE_MAJOR_VERSION 3
50
#define FREEIMAGE_MINOR_VERSION 10
51
#define FREEIMAGE_RELEASE_SERIAL 0
50
#define FREEIMAGE_MINOR_VERSION 13
51
#define FREEIMAGE_RELEASE_SERIAL 1
53
53
// Compiler options ---------------------------------------------------------
98
98
// This really only affects 24 and 32 bit formats, the rest are always RGB order.
99
99
#define FREEIMAGE_COLORORDER_BGR 0
100
100
#define FREEIMAGE_COLORORDER_RGB 1
101
#if defined(__APPLE__) || defined(FREEIMAGE_BIGENDIAN)
101
#if defined(FREEIMAGE_BIGENDIAN)
102
102
#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB
104
104
#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR
612
typedef const char *(DLL_CALLCONV *FI_FormatProc) ();
613
typedef const char *(DLL_CALLCONV *FI_DescriptionProc) ();
614
typedef const char *(DLL_CALLCONV *FI_ExtensionListProc) ();
615
typedef const char *(DLL_CALLCONV *FI_RegExprProc) ();
619
typedef const char *(DLL_CALLCONV *FI_FormatProc)(void);
620
typedef const char *(DLL_CALLCONV *FI_DescriptionProc)(void);
621
typedef const char *(DLL_CALLCONV *FI_ExtensionListProc)(void);
622
typedef const char *(DLL_CALLCONV *FI_RegExprProc)(void);
616
623
typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read);
617
624
typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data);
618
625
typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data);
620
627
typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data);
621
628
typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data);
622
629
typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle);
623
typedef const char *(DLL_CALLCONV *FI_MimeProc) ();
630
typedef const char *(DLL_CALLCONV *FI_MimeProc)(void);
624
631
typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp);
625
632
typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type);
626
typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)();
633
typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(void);
628
635
FI_STRUCT (Plugin) {
629
636
FI_FormatProc format_proc;
672
679
#define IFF_DEFAULT 0
673
680
#define J2K_DEFAULT 0 // save with a 16:1 rate
674
681
#define JP2_DEFAULT 0 // save with a 16:1 rate
675
#define JPEG_DEFAULT 0 // loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD)
682
#define JPEG_DEFAULT 0 // loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420)
676
683
#define JPEG_FAST 0x0001 // load the file as fast as possible, sacrificing some quality
677
684
#define JPEG_ACCURATE 0x0002 // load the file with the best quality, sacrificing some speed
678
685
#define JPEG_CMYK 0x0004 // load separated CMYK "as is" (use | to combine with other load flags)
686
#define JPEG_EXIFROTATE 0x0008 // load and rotate according to Exif 'Orientation' tag if available
679
687
#define JPEG_QUALITYSUPERB 0x80 // save with superb quality (100:1)
680
688
#define JPEG_QUALITYGOOD 0x0100 // save with good quality (75:1)
681
689
#define JPEG_QUALITYNORMAL 0x0200 // save with normal quality (50:1)
682
690
#define JPEG_QUALITYAVERAGE 0x0400 // save with average quality (25:1)
683
691
#define JPEG_QUALITYBAD 0x0800 // save with bad quality (10:1)
684
692
#define JPEG_PROGRESSIVE 0x2000 // save as a progressive-JPEG (use | to combine with other save flags)
693
#define JPEG_SUBSAMPLING_411 0x1000 // save with high 4x1 chroma subsampling (4:1:1)
694
#define JPEG_SUBSAMPLING_420 0x4000 // save with medium 2x2 medium chroma subsampling (4:2:0) - default value
695
#define JPEG_SUBSAMPLING_422 0x8000 // save with low 2x1 chroma subsampling (4:2:2)
696
#define JPEG_SUBSAMPLING_444 0x10000 // save with no chroma subsampling (4:4:4)
685
697
#define KOALA_DEFAULT 0
686
698
#define LBM_DEFAULT 0
687
699
#define MNG_DEFAULT 0
690
702
#define PCD_BASEDIV4 2 // load the bitmap sized 384 x 256
691
703
#define PCD_BASEDIV16 3 // load the bitmap sized 192 x 128
692
704
#define PCX_DEFAULT 0
705
#define PFM_DEFAULT 0
706
#define PICT_DEFAULT 0
693
707
#define PNG_DEFAULT 0
694
#define PNG_IGNOREGAMMA 1 // avoid gamma correction
708
#define PNG_IGNOREGAMMA 1 // loading: avoid gamma correction
709
#define PNG_Z_BEST_SPEED 0x0001 // save using ZLib level 1 compression flag (default value is 6)
710
#define PNG_Z_DEFAULT_COMPRESSION 0x0006 // save using ZLib level 6 compression flag (default recommended value)
711
#define PNG_Z_BEST_COMPRESSION 0x0009 // save using ZLib level 9 compression flag (default value is 6)
712
#define PNG_Z_NO_COMPRESSION 0x0100 // save without ZLib compression
713
#define PNG_INTERLACED 0x0200 // save using Adam7 interlacing (use | to combine with other save flags)
695
714
#define PNM_DEFAULT 0
696
715
#define PNM_SAVE_RAW 0 // If set the writer saves in RAW format (i.e. P4, P5 or P6)
697
716
#define PNM_SAVE_ASCII 1 // If set the writer saves in ASCII format (i.e. P1, P2 or P3)
698
717
#define PSD_DEFAULT 0
699
718
#define RAS_DEFAULT 0
719
#define RAW_DEFAULT 0 // load the file as linear RGB 48-bit
720
#define RAW_PREVIEW 1 // try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit
721
#define RAW_DISPLAY 2 // load the file as RGB 24-bit
700
722
#define SGI_DEFAULT 0
701
723
#define TARGA_DEFAULT 0
702
724
#define TARGA_LOAD_RGB888 1 // If set the loader converts RGB555 and ARGB8888 -> RGB888.
714
736
#define XBM_DEFAULT 0
715
737
#define XPM_DEFAULT 0
739
// Background filling options ---------------------------------------------------------
740
// Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas
742
#define FI_COLOR_IS_RGB_COLOR 0x00 // RGBQUAD color is a RGB color (contains no valid alpha channel)
743
#define FI_COLOR_IS_RGBA_COLOR 0x01 // RGBQUAD color is a RGBA color (contains a valid alpha channel)
744
#define FI_COLOR_FIND_EQUAL_COLOR 0x02 // For palettized images: lookup equal RGB color from palette
745
#define FI_COLOR_ALPHA_IS_INDEX 0x04 // The color's rgbReserved member (alpha) contains the palette index to be used
746
#define FI_COLOR_PALETTE_SEARCH_MASK (FI_COLOR_FIND_EQUAL_COLOR | FI_COLOR_ALPHA_IS_INDEX) // No color lookup is performed
718
749
#ifdef __cplusplus
792
823
// Multipaging interface ----------------------------------------------------
794
825
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));
826
DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
795
827
DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0));
796
828
DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap);
797
829
DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data);
819
851
DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
820
852
DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
823
854
// Pixel access routines ----------------------------------------------------
825
856
DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib);
938
969
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));
939
970
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0));
940
971
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0));
972
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05Ex(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0), double adaptation FI_DEFAULT(1), double color_correction FI_DEFAULT(0));
941
974
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color_saturation FI_DEFAULT(0.5), double attenuation FI_DEFAULT(0.85));
943
976
// ZLib interface -----------------------------------------------------------
953
986
// --------------------------------------------------------------------------
955
988
// tag creation / destruction
956
DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag();
989
DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag(void);
957
990
DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag);
958
991
DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag);
987
1020
DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib);
1021
DLL_API BOOL DLL_CALLCONV FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src);
989
1023
// tag to C string conversion
990
1024
DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL));
994
1028
// --------------------------------------------------------------------------
996
1030
// rotation and flipping
1031
/// @deprecated see FreeImage_Rotate
997
1032
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle);
1033
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor FI_DEFAULT(NULL));
998
1034
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);
999
1035
DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib);
1000
1036
DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib);
1001
1037
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));
1038
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(FALSE));
1003
1040
// upsampling / downsampling
1004
1041
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter);
1029
1066
DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha);
1030
1067
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL));
1031
1068
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
1069
DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCropU(const wchar_t *src_file, const wchar_t *dst_file, int left, int top, int right, int bottom);
1032
1070
DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib);
1072
// background filling routines
1073
DLL_API BOOL DLL_CALLCONV FreeImage_FillBackground(FIBITMAP *dib, const void *color, int options FI_DEFAULT(0));
1074
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_EnlargeCanvas(FIBITMAP *src, int left, int top, int right, int bottom, const void *color, int options FI_DEFAULT(0));
1075
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateEx(int width, int height, int bpp, const RGBQUAD *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
1076
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_AllocateExT(FREE_IMAGE_TYPE type, int width, int height, int bpp, const void *color, int options FI_DEFAULT(0), const RGBQUAD *palette FI_DEFAULT(NULL), unsigned red_mask FI_DEFAULT(0), unsigned green_mask FI_DEFAULT(0), unsigned blue_mask FI_DEFAULT(0));
1034
1078
// miscellaneous algorithms
1035
1079
DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle FI_DEFAULT(3));