You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1153 lines
56 KiB

  1. // ==========================================================
  2. // FreeImage 3
  3. //
  4. // Design and implementation by
  5. // - Floris van den Berg (flvdberg@wxs.nl)
  6. // - Herv?Drolon (drolon@infonie.fr)
  7. //
  8. // Contributors:
  9. // - see changes log named 'Whatsnew.txt', see header of each .h and .cpp file
  10. //
  11. // This file is part of FreeImage 3
  12. //
  13. // COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
  14. // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
  15. // THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
  16. // OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
  17. // CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
  18. // THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
  19. // SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
  20. // PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
  21. // THIS DISCLAIMER.
  22. //
  23. // Use at your own risk!
  24. // ==========================================================
  25. #ifndef FREEIMAGE_H
  26. #define FREEIMAGE_H
  27. // Version information ------------------------------------------------------
  28. #define FREEIMAGE_MAJOR_VERSION 3
  29. #define FREEIMAGE_MINOR_VERSION 17
  30. #define FREEIMAGE_RELEASE_SERIAL 0
  31. // Compiler options ---------------------------------------------------------
  32. #include <wchar.h> // needed for UNICODE functions
  33. #if defined(FREEIMAGE_LIB)
  34. #define DLL_API
  35. #define DLL_CALLCONV
  36. #else
  37. #if defined(_WIN32) || defined(__WIN32__)
  38. #define DLL_CALLCONV __stdcall
  39. // The following ifdef block is the standard way of creating macros which make exporting
  40. // from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS
  41. // symbol defined on the command line. this symbol should not be defined on any project
  42. // that uses this DLL. This way any other project whose source files include this file see
  43. // DLL_API functions as being imported from a DLL, wheras this DLL sees symbols
  44. // defined with this macro as being exported.
  45. #ifdef FREEIMAGE_EXPORTS
  46. #define DLL_API __declspec(dllexport)
  47. #else
  48. #define DLL_API __declspec(dllimport)
  49. #endif // FREEIMAGE_EXPORTS
  50. #else
  51. // try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility)
  52. #if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
  53. #ifndef GCC_HASCLASSVISIBILITY
  54. #define GCC_HASCLASSVISIBILITY
  55. #endif
  56. #endif // __GNUC__
  57. #define DLL_CALLCONV
  58. #if defined(GCC_HASCLASSVISIBILITY)
  59. #define DLL_API __attribute__ ((visibility("default")))
  60. #else
  61. #define DLL_API
  62. #endif
  63. #endif // WIN32 / !WIN32
  64. #endif // FREEIMAGE_LIB
  65. // Endianness:
  66. // Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined.
  67. // If your big endian system isn't being detected, add an OS specific check
  68. // or define any of FREEIMAGE_BIGENDIAN and FREEIMAGE_LITTLEENDIAN directly
  69. // to specify the desired endianness.
  70. #if (!defined(FREEIMAGE_BIGENDIAN) && !defined(FREEIMAGE_LITTLEENDIAN))
  71. #if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || (defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || defined(__BIG_ENDIAN__)
  72. #define FREEIMAGE_BIGENDIAN
  73. #endif // BYTE_ORDER
  74. #endif // !FREEIMAGE_[BIG|LITTLE]ENDIAN
  75. // Color-Order:
  76. // The specified order of color components red, green and blue affects 24-
  77. // and 32-bit images of type FIT_BITMAP as well as the colors that are part
  78. // of a color palette. All other images always use RGB order. By default,
  79. // color order is coupled to endianness:
  80. // little-endian -> BGR
  81. // big-endian -> RGB
  82. // However, you can always define FREEIMAGE_COLORORDER to any of the known
  83. // orders FREEIMAGE_COLORORDER_BGR (0) and FREEIMAGE_COLORORDER_RGB (1) to
  84. // specify your preferred color order.
  85. #define FREEIMAGE_COLORORDER_BGR 0
  86. #define FREEIMAGE_COLORORDER_RGB 1
  87. #if (!defined(FREEIMAGE_COLORORDER)) || ((FREEIMAGE_COLORORDER != FREEIMAGE_COLORORDER_BGR) && (FREEIMAGE_COLORORDER != FREEIMAGE_COLORORDER_RGB))
  88. #if defined(FREEIMAGE_BIGENDIAN)
  89. #define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB
  90. #else
  91. #define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR
  92. #endif // FREEIMAGE_BIGENDIAN
  93. #endif // FREEIMAGE_COLORORDER
  94. // Ensure 4-byte enums if we're using Borland C++ compilers
  95. #if defined(__BORLANDC__)
  96. #pragma option push -b
  97. #endif
  98. // For C compatibility --------------------------------------------------------
  99. #ifdef __cplusplus
  100. #define FI_DEFAULT(x) = x
  101. #define FI_ENUM(x) enum x
  102. #define FI_STRUCT(x) struct x
  103. #else
  104. #define FI_DEFAULT(x)
  105. #define FI_ENUM(x) typedef int x; enum x
  106. #define FI_STRUCT(x) typedef struct x x; struct x
  107. #endif
  108. // Bitmap types -------------------------------------------------------------
  109. FI_STRUCT (FIBITMAP) { void *data; };
  110. FI_STRUCT (FIMULTIBITMAP) { void *data; };
  111. // Types used in the library (directly copied from Windows) -----------------
  112. #if defined(__MINGW32__) && defined(_WINDOWS_H)
  113. #define _WINDOWS_ // prevent a bug in MinGW32
  114. #endif // __MINGW32__
  115. #ifndef _WINDOWS_
  116. #define _WINDOWS_
  117. #ifndef FALSE
  118. #define FALSE 0
  119. #endif
  120. #ifndef TRUE
  121. #define TRUE 1
  122. #endif
  123. #ifndef NULL
  124. #define NULL 0
  125. #endif
  126. #ifndef SEEK_SET
  127. #define SEEK_SET 0
  128. #define SEEK_CUR 1
  129. #define SEEK_END 2
  130. #endif
  131. #ifndef _MSC_VER
  132. // define portable types for 32-bit / 64-bit OS
  133. #include <inttypes.h>
  134. typedef int32_t BOOL;
  135. typedef uint8_t BYTE;
  136. typedef uint16_t WORD;
  137. typedef uint32_t DWORD;
  138. typedef int32_t LONG;
  139. typedef int64_t INT64;
  140. typedef uint64_t UINT64;
  141. #else
  142. // MS is not C99 ISO compliant
  143. typedef long BOOL;
  144. typedef unsigned char BYTE;
  145. typedef unsigned short WORD;
  146. typedef unsigned long DWORD;
  147. typedef long LONG;
  148. typedef signed __int64 INT64;
  149. typedef unsigned __int64 UINT64;
  150. #endif // _MSC_VER
  151. #if (defined(_WIN32) || defined(__WIN32__))
  152. #pragma pack(push, 1)
  153. #else
  154. #pragma pack(1)
  155. #endif // WIN32
  156. typedef struct tagRGBQUAD {
  157. #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
  158. BYTE rgbBlue;
  159. BYTE rgbGreen;
  160. BYTE rgbRed;
  161. #else
  162. BYTE rgbRed;
  163. BYTE rgbGreen;
  164. BYTE rgbBlue;
  165. #endif // FREEIMAGE_COLORORDER
  166. BYTE rgbReserved;
  167. } RGBQUAD;
  168. typedef struct tagRGBTRIPLE {
  169. #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
  170. BYTE rgbtBlue;
  171. BYTE rgbtGreen;
  172. BYTE rgbtRed;
  173. #else
  174. BYTE rgbtRed;
  175. BYTE rgbtGreen;
  176. BYTE rgbtBlue;
  177. #endif // FREEIMAGE_COLORORDER
  178. } RGBTRIPLE;
  179. #if (defined(_WIN32) || defined(__WIN32__))
  180. #pragma pack(pop)
  181. #else
  182. #pragma pack()
  183. #endif // WIN32
  184. typedef struct tagBITMAPINFOHEADER{
  185. DWORD biSize;
  186. LONG biWidth;
  187. LONG biHeight;
  188. WORD biPlanes;
  189. WORD biBitCount;
  190. DWORD biCompression;
  191. DWORD biSizeImage;
  192. LONG biXPelsPerMeter;
  193. LONG biYPelsPerMeter;
  194. DWORD biClrUsed;
  195. DWORD biClrImportant;
  196. } BITMAPINFOHEADER, *PBITMAPINFOHEADER;
  197. typedef struct tagBITMAPINFO {
  198. BITMAPINFOHEADER bmiHeader;
  199. RGBQUAD bmiColors[1];
  200. } BITMAPINFO, *PBITMAPINFO;
  201. #endif // _WINDOWS_
  202. // Types used in the library (specific to FreeImage) ------------------------
  203. #if (defined(_WIN32) || defined(__WIN32__))
  204. #pragma pack(push, 1)
  205. #else
  206. #pragma pack(1)
  207. #endif // WIN32
  208. /** 48-bit RGB
  209. */
  210. typedef struct tagFIRGB16 {
  211. WORD red;
  212. WORD green;
  213. WORD blue;
  214. } FIRGB16;
  215. /** 64-bit RGBA
  216. */
  217. typedef struct tagFIRGBA16 {
  218. WORD red;
  219. WORD green;
  220. WORD blue;
  221. WORD alpha;
  222. } FIRGBA16;
  223. /** 96-bit RGB Float
  224. */
  225. typedef struct tagFIRGBF {
  226. float red;
  227. float green;
  228. float blue;
  229. } FIRGBF;
  230. /** 128-bit RGBA Float
  231. */
  232. typedef struct tagFIRGBAF {
  233. float red;
  234. float green;
  235. float blue;
  236. float alpha;
  237. } FIRGBAF;
  238. /** Data structure for COMPLEX type (complex number)
  239. */
  240. typedef struct tagFICOMPLEX {
  241. /// real part
  242. double r;
  243. /// imaginary part
  244. double i;
  245. } FICOMPLEX;
  246. #if (defined(_WIN32) || defined(__WIN32__))
  247. #pragma pack(pop)
  248. #else
  249. #pragma pack()
  250. #endif // WIN32
  251. // Indexes for byte arrays, masks and shifts for treating pixels as words ---
  252. // These coincide with the order of RGBQUAD and RGBTRIPLE -------------------
  253. #ifndef FREEIMAGE_BIGENDIAN
  254. #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
  255. // Little Endian (x86 / MS Windows, Linux) : BGR(A) order
  256. #define FI_RGBA_RED 2
  257. #define FI_RGBA_GREEN 1
  258. #define FI_RGBA_BLUE 0
  259. #define FI_RGBA_ALPHA 3
  260. #define FI_RGBA_RED_MASK 0x00FF0000
  261. #define FI_RGBA_GREEN_MASK 0x0000FF00
  262. #define FI_RGBA_BLUE_MASK 0x000000FF
  263. #define FI_RGBA_ALPHA_MASK 0xFF000000
  264. #define FI_RGBA_RED_SHIFT 16
  265. #define FI_RGBA_GREEN_SHIFT 8
  266. #define FI_RGBA_BLUE_SHIFT 0
  267. #define FI_RGBA_ALPHA_SHIFT 24
  268. #else
  269. // Little Endian (x86 / MaxOSX) : RGB(A) order
  270. #define FI_RGBA_RED 0
  271. #define FI_RGBA_GREEN 1
  272. #define FI_RGBA_BLUE 2
  273. #define FI_RGBA_ALPHA 3
  274. #define FI_RGBA_RED_MASK 0x000000FF
  275. #define FI_RGBA_GREEN_MASK 0x0000FF00
  276. #define FI_RGBA_BLUE_MASK 0x00FF0000
  277. #define FI_RGBA_ALPHA_MASK 0xFF000000
  278. #define FI_RGBA_RED_SHIFT 0
  279. #define FI_RGBA_GREEN_SHIFT 8
  280. #define FI_RGBA_BLUE_SHIFT 16
  281. #define FI_RGBA_ALPHA_SHIFT 24
  282. #endif // FREEIMAGE_COLORORDER
  283. #else
  284. #if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
  285. // Big Endian (PPC / none) : BGR(A) order
  286. #define FI_RGBA_RED 2
  287. #define FI_RGBA_GREEN 1
  288. #define FI_RGBA_BLUE 0
  289. #define FI_RGBA_ALPHA 3
  290. #define FI_RGBA_RED_MASK 0x0000FF00
  291. #define FI_RGBA_GREEN_MASK 0x00FF0000
  292. #define FI_RGBA_BLUE_MASK 0xFF000000
  293. #define FI_RGBA_ALPHA_MASK 0x000000FF
  294. #define FI_RGBA_RED_SHIFT 8
  295. #define FI_RGBA_GREEN_SHIFT 16
  296. #define FI_RGBA_BLUE_SHIFT 24
  297. #define FI_RGBA_ALPHA_SHIFT 0
  298. #else
  299. // Big Endian (PPC / Linux, MaxOSX) : RGB(A) order
  300. #define FI_RGBA_RED 0
  301. #define FI_RGBA_GREEN 1
  302. #define FI_RGBA_BLUE 2
  303. #define FI_RGBA_ALPHA 3
  304. #define FI_RGBA_RED_MASK 0xFF000000
  305. #define FI_RGBA_GREEN_MASK 0x00FF0000
  306. #define FI_RGBA_BLUE_MASK 0x0000FF00
  307. #define FI_RGBA_ALPHA_MASK 0x000000FF
  308. #define FI_RGBA_RED_SHIFT 24
  309. #define FI_RGBA_GREEN_SHIFT 16
  310. #define FI_RGBA_BLUE_SHIFT 8
  311. #define FI_RGBA_ALPHA_SHIFT 0
  312. #endif // FREEIMAGE_COLORORDER
  313. #endif // FREEIMAGE_BIGENDIAN
  314. #define FI_RGBA_RGB_MASK (FI_RGBA_RED_MASK|FI_RGBA_GREEN_MASK|FI_RGBA_BLUE_MASK)
  315. // The 16bit macros only include masks and shifts, since each color element is not byte aligned
  316. #define FI16_555_RED_MASK 0x7C00
  317. #define FI16_555_GREEN_MASK 0x03E0
  318. #define FI16_555_BLUE_MASK 0x001F
  319. #define FI16_555_RED_SHIFT 10
  320. #define FI16_555_GREEN_SHIFT 5
  321. #define FI16_555_BLUE_SHIFT 0
  322. #define FI16_565_RED_MASK 0xF800
  323. #define FI16_565_GREEN_MASK 0x07E0
  324. #define FI16_565_BLUE_MASK 0x001F
  325. #define FI16_565_RED_SHIFT 11
  326. #define FI16_565_GREEN_SHIFT 5
  327. #define FI16_565_BLUE_SHIFT 0
  328. // ICC profile support ------------------------------------------------------
  329. #define FIICC_DEFAULT 0x00
  330. #define FIICC_COLOR_IS_CMYK 0x01
  331. FI_STRUCT (FIICCPROFILE) {
  332. WORD flags; //! info flag
  333. DWORD size; //! profile's size measured in bytes
  334. void *data; //! points to a block of contiguous memory containing the profile
  335. };
  336. // Important enums ----------------------------------------------------------
  337. /** I/O image format identifiers.
  338. */
  339. FI_ENUM(FREE_IMAGE_FORMAT) {
  340. FIF_UNKNOWN = -1,
  341. FIF_BMP = 0,
  342. FIF_ICO = 1,
  343. FIF_JPEG = 2,
  344. FIF_JNG = 3,
  345. FIF_KOALA = 4,
  346. FIF_LBM = 5,
  347. FIF_IFF = FIF_LBM,
  348. FIF_MNG = 6,
  349. FIF_PBM = 7,
  350. FIF_PBMRAW = 8,
  351. FIF_PCD = 9,
  352. FIF_PCX = 10,
  353. FIF_PGM = 11,
  354. FIF_PGMRAW = 12,
  355. FIF_PNG = 13,
  356. FIF_PPM = 14,
  357. FIF_PPMRAW = 15,
  358. FIF_RAS = 16,
  359. FIF_TARGA = 17,
  360. FIF_TIFF = 18,
  361. FIF_WBMP = 19,
  362. FIF_PSD = 20,
  363. FIF_CUT = 21,
  364. FIF_XBM = 22,
  365. FIF_XPM = 23,
  366. FIF_DDS = 24,
  367. FIF_GIF = 25,
  368. FIF_HDR = 26,
  369. FIF_FAXG3 = 27,
  370. FIF_SGI = 28,
  371. FIF_EXR = 29,
  372. FIF_J2K = 30,
  373. FIF_JP2 = 31,
  374. FIF_PFM = 32,
  375. FIF_PICT = 33,
  376. FIF_RAW = 34,
  377. FIF_WEBP = 35,
  378. FIF_JXR = 36
  379. };
  380. /** Image type used in FreeImage.
  381. */
  382. FI_ENUM(FREE_IMAGE_TYPE) {
  383. FIT_UNKNOWN = 0, //! unknown type
  384. FIT_BITMAP = 1, //! standard image : 1-, 4-, 8-, 16-, 24-, 32-bit
  385. FIT_UINT16 = 2, //! array of unsigned short : unsigned 16-bit
  386. FIT_INT16 = 3, //! array of short : signed 16-bit
  387. FIT_UINT32 = 4, //! array of unsigned long : unsigned 32-bit
  388. FIT_INT32 = 5, //! array of long : signed 32-bit
  389. FIT_FLOAT = 6, //! array of float : 32-bit IEEE floating point
  390. FIT_DOUBLE = 7, //! array of double : 64-bit IEEE floating point
  391. FIT_COMPLEX = 8, //! array of FICOMPLEX : 2 x 64-bit IEEE floating point
  392. FIT_RGB16 = 9, //! 48-bit RGB image : 3 x 16-bit
  393. FIT_RGBA16 = 10, //! 64-bit RGBA image : 4 x 16-bit
  394. FIT_RGBF = 11, //! 96-bit RGB float image : 3 x 32-bit IEEE floating point
  395. FIT_RGBAF = 12 //! 128-bit RGBA float image : 4 x 32-bit IEEE floating point
  396. };
  397. /** Image color type used in FreeImage.
  398. */
  399. FI_ENUM(FREE_IMAGE_COLOR_TYPE) {
  400. FIC_MINISWHITE = 0, //! min value is white
  401. FIC_MINISBLACK = 1, //! min value is black
  402. FIC_RGB = 2, //! RGB color model
  403. FIC_PALETTE = 3, //! color map indexed
  404. FIC_RGBALPHA = 4, //! RGB color model with alpha channel
  405. FIC_CMYK = 5 //! CMYK color model
  406. };
  407. /** Color quantization algorithms.
  408. Constants used in FreeImage_ColorQuantize.
  409. */
  410. FI_ENUM(FREE_IMAGE_QUANTIZE) {
  411. FIQ_WUQUANT = 0, //! Xiaolin Wu color quantization algorithm
  412. FIQ_NNQUANT = 1, //! NeuQuant neural-net quantization algorithm by Anthony Dekker
  413. FIQ_LFPQUANT = 2 //! Lossless Fast Pseudo-Quantization Algorithm by Carsten Klein
  414. };
  415. /** Dithering algorithms.
  416. Constants used in FreeImage_Dither.
  417. */
  418. FI_ENUM(FREE_IMAGE_DITHER) {
  419. FID_FS = 0, //! Floyd & Steinberg error diffusion
  420. FID_BAYER4x4 = 1, //! Bayer ordered dispersed dot dithering (order 2 dithering matrix)
  421. FID_BAYER8x8 = 2, //! Bayer ordered dispersed dot dithering (order 3 dithering matrix)
  422. FID_CLUSTER6x6 = 3, //! Ordered clustered dot dithering (order 3 - 6x6 matrix)
  423. FID_CLUSTER8x8 = 4, //! Ordered clustered dot dithering (order 4 - 8x8 matrix)
  424. FID_CLUSTER16x16= 5, //! Ordered clustered dot dithering (order 8 - 16x16 matrix)
  425. FID_BAYER16x16 = 6 //! Bayer ordered dispersed dot dithering (order 4 dithering matrix)
  426. };
  427. /** Lossless JPEG transformations
  428. Constants used in FreeImage_JPEGTransform
  429. */
  430. FI_ENUM(FREE_IMAGE_JPEG_OPERATION) {
  431. FIJPEG_OP_NONE = 0, //! no transformation
  432. FIJPEG_OP_FLIP_H = 1, //! horizontal flip
  433. FIJPEG_OP_FLIP_V = 2, //! vertical flip
  434. FIJPEG_OP_TRANSPOSE = 3, //! transpose across UL-to-LR axis
  435. FIJPEG_OP_TRANSVERSE = 4, //! transpose across UR-to-LL axis
  436. FIJPEG_OP_ROTATE_90 = 5, //! 90-degree clockwise rotation
  437. FIJPEG_OP_ROTATE_180 = 6, //! 180-degree rotation
  438. FIJPEG_OP_ROTATE_270 = 7 //! 270-degree clockwise (or 90 ccw)
  439. };
  440. /** Tone mapping operators.
  441. Constants used in FreeImage_ToneMapping.
  442. */
  443. FI_ENUM(FREE_IMAGE_TMO) {
  444. FITMO_DRAGO03 = 0, //! Adaptive logarithmic mapping (F. Drago, 2003)
  445. FITMO_REINHARD05 = 1, //! Dynamic range reduction inspired by photoreceptor physiology (E. Reinhard, 2005)
  446. FITMO_FATTAL02 = 2 //! Gradient domain high dynamic range compression (R. Fattal, 2002)
  447. };
  448. /** Upsampling / downsampling filters.
  449. Constants used in FreeImage_Rescale.
  450. */
  451. FI_ENUM(FREE_IMAGE_FILTER) {
  452. FILTER_BOX = 0, //! Box, pulse, Fourier window, 1st order (constant) b-spline
  453. FILTER_BICUBIC = 1, //! Mitchell & Netravali's two-param cubic filter
  454. FILTER_BILINEAR = 2, //! Bilinear filter
  455. FILTER_BSPLINE = 3, //! 4th order (cubic) b-spline
  456. FILTER_CATMULLROM = 4, //! Catmull-Rom spline, Overhauser spline
  457. FILTER_LANCZOS3 = 5 //! Lanczos3 filter
  458. };
  459. /** Color channels.
  460. Constants used in color manipulation routines.
  461. */
  462. FI_ENUM(FREE_IMAGE_COLOR_CHANNEL) {
  463. FICC_RGB = 0, //! Use red, green and blue channels
  464. FICC_RED = 1, //! Use red channel
  465. FICC_GREEN = 2, //! Use green channel
  466. FICC_BLUE = 3, //! Use blue channel
  467. FICC_ALPHA = 4, //! Use alpha channel
  468. FICC_BLACK = 5, //! Use black channel
  469. FICC_REAL = 6, //! Complex images: use real part
  470. FICC_IMAG = 7, //! Complex images: use imaginary part
  471. FICC_MAG = 8, //! Complex images: use magnitude
  472. FICC_PHASE = 9 //! Complex images: use phase
  473. };
  474. // Metadata support ---------------------------------------------------------
  475. /**
  476. Tag data type information (based on TIFF specifications)
  477. Note: RATIONALs are the ratio of two 32-bit integer values.
  478. */
  479. FI_ENUM(FREE_IMAGE_MDTYPE) {
  480. FIDT_NOTYPE = 0, //! placeholder
  481. FIDT_BYTE = 1, //! 8-bit unsigned integer
  482. FIDT_ASCII = 2, //! 8-bit bytes w/ last byte null
  483. FIDT_SHORT = 3, //! 16-bit unsigned integer
  484. FIDT_LONG = 4, //! 32-bit unsigned integer
  485. FIDT_RATIONAL = 5, //! 64-bit unsigned fraction
  486. FIDT_SBYTE = 6, //! 8-bit signed integer
  487. FIDT_UNDEFINED = 7, //! 8-bit untyped data
  488. FIDT_SSHORT = 8, //! 16-bit signed integer
  489. FIDT_SLONG = 9, //! 32-bit signed integer
  490. FIDT_SRATIONAL = 10, //! 64-bit signed fraction
  491. FIDT_FLOAT = 11, //! 32-bit IEEE floating point
  492. FIDT_DOUBLE = 12, //! 64-bit IEEE floating point
  493. FIDT_IFD = 13, //! 32-bit unsigned integer (offset)
  494. FIDT_PALETTE = 14, //! 32-bit RGBQUAD
  495. FIDT_LONG8 = 16, //! 64-bit unsigned integer
  496. FIDT_SLONG8 = 17, //! 64-bit signed integer
  497. FIDT_IFD8 = 18 //! 64-bit unsigned integer (offset)
  498. };
  499. /**
  500. Metadata models supported by FreeImage
  501. */
  502. FI_ENUM(FREE_IMAGE_MDMODEL) {
  503. FIMD_NODATA = -1,
  504. FIMD_COMMENTS = 0, //! single comment or keywords
  505. FIMD_EXIF_MAIN = 1, //! Exif-TIFF metadata
  506. FIMD_EXIF_EXIF = 2, //! Exif-specific metadata
  507. FIMD_EXIF_GPS = 3, //! Exif GPS metadata
  508. FIMD_EXIF_MAKERNOTE = 4, //! Exif maker note metadata
  509. FIMD_EXIF_INTEROP = 5, //! Exif interoperability metadata
  510. FIMD_IPTC = 6, //! IPTC/NAA metadata
  511. FIMD_XMP = 7, //! Abobe XMP metadata
  512. FIMD_GEOTIFF = 8, //! GeoTIFF metadata
  513. FIMD_ANIMATION = 9, //! Animation metadata
  514. FIMD_CUSTOM = 10, //! Used to attach other metadata types to a dib
  515. FIMD_EXIF_RAW = 11 //! Exif metadata as a raw buffer
  516. };
  517. /**
  518. Handle to a metadata model
  519. */
  520. FI_STRUCT (FIMETADATA) { void *data; };
  521. /**
  522. Handle to a FreeImage tag
  523. */
  524. FI_STRUCT (FITAG) { void *data; };
  525. // File IO routines ---------------------------------------------------------
  526. #ifndef FREEIMAGE_IO
  527. #define FREEIMAGE_IO
  528. typedef void* fi_handle;
  529. typedef unsigned (DLL_CALLCONV *FI_ReadProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
  530. typedef unsigned (DLL_CALLCONV *FI_WriteProc) (void *buffer, unsigned size, unsigned count, fi_handle handle);
  531. typedef int (DLL_CALLCONV *FI_SeekProc) (fi_handle handle, long offset, int origin);
  532. typedef long (DLL_CALLCONV *FI_TellProc) (fi_handle handle);
  533. #if (defined(_WIN32) || defined(__WIN32__))
  534. #pragma pack(push, 1)
  535. #else
  536. #pragma pack(1)
  537. #endif // WIN32
  538. FI_STRUCT(FreeImageIO) {
  539. FI_ReadProc read_proc; //! pointer to the function used to read data
  540. FI_WriteProc write_proc; //! pointer to the function used to write data
  541. FI_SeekProc seek_proc; //! pointer to the function used to seek
  542. FI_TellProc tell_proc; //! pointer to the function used to aquire the current position
  543. };
  544. #if (defined(_WIN32) || defined(__WIN32__))
  545. #pragma pack(pop)
  546. #else
  547. #pragma pack()
  548. #endif // WIN32
  549. /**
  550. Handle to a memory I/O stream
  551. */
  552. FI_STRUCT (FIMEMORY) { void *data; };
  553. #endif // FREEIMAGE_IO
  554. // Plugin routines ----------------------------------------------------------
  555. #ifndef PLUGINS
  556. #define PLUGINS
  557. typedef const char *(DLL_CALLCONV *FI_FormatProc)(void);
  558. typedef const char *(DLL_CALLCONV *FI_DescriptionProc)(void);
  559. typedef const char *(DLL_CALLCONV *FI_ExtensionListProc)(void);
  560. typedef const char *(DLL_CALLCONV *FI_RegExprProc)(void);
  561. typedef void *(DLL_CALLCONV *FI_OpenProc)(FreeImageIO *io, fi_handle handle, BOOL read);
  562. typedef void (DLL_CALLCONV *FI_CloseProc)(FreeImageIO *io, fi_handle handle, void *data);
  563. typedef int (DLL_CALLCONV *FI_PageCountProc)(FreeImageIO *io, fi_handle handle, void *data);
  564. typedef int (DLL_CALLCONV *FI_PageCapabilityProc)(FreeImageIO *io, fi_handle handle, void *data);
  565. typedef FIBITMAP *(DLL_CALLCONV *FI_LoadProc)(FreeImageIO *io, fi_handle handle, int page, int flags, void *data);
  566. typedef BOOL (DLL_CALLCONV *FI_SaveProc)(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data);
  567. typedef BOOL (DLL_CALLCONV *FI_ValidateProc)(FreeImageIO *io, fi_handle handle);
  568. typedef const char *(DLL_CALLCONV *FI_MimeProc)(void);
  569. typedef BOOL (DLL_CALLCONV *FI_SupportsExportBPPProc)(int bpp);
  570. typedef BOOL (DLL_CALLCONV *FI_SupportsExportTypeProc)(FREE_IMAGE_TYPE type);
  571. typedef BOOL (DLL_CALLCONV *FI_SupportsICCProfilesProc)(void);
  572. typedef BOOL (DLL_CALLCONV *FI_SupportsNoPixelsProc)(void);
  573. FI_STRUCT (Plugin) {
  574. FI_FormatProc format_proc;
  575. FI_DescriptionProc description_proc;
  576. FI_ExtensionListProc extension_proc;
  577. FI_RegExprProc regexpr_proc;
  578. FI_OpenProc open_proc;
  579. FI_CloseProc close_proc;
  580. FI_PageCountProc pagecount_proc;
  581. FI_PageCapabilityProc pagecapability_proc;
  582. FI_LoadProc load_proc;
  583. FI_SaveProc save_proc;
  584. FI_ValidateProc validate_proc;
  585. FI_MimeProc mime_proc;
  586. FI_SupportsExportBPPProc supports_export_bpp_proc;
  587. FI_SupportsExportTypeProc supports_export_type_proc;
  588. FI_SupportsICCProfilesProc supports_icc_profiles_proc;
  589. FI_SupportsNoPixelsProc supports_no_pixels_proc;
  590. };
  591. typedef void (DLL_CALLCONV *FI_InitProc)(Plugin *plugin, int format_id);
  592. #endif // PLUGINS
  593. // Load / Save flag constants -----------------------------------------------
  594. #define FIF_LOAD_NOPIXELS 0x8000 //! loading: load the image header only (not supported by all plugins, default to full loading)
  595. #define BMP_DEFAULT 0
  596. #define BMP_SAVE_RLE 1
  597. #define CUT_DEFAULT 0
  598. #define DDS_DEFAULT 0
  599. #define EXR_DEFAULT 0 //! save data as half with piz-based wavelet compression
  600. #define EXR_FLOAT 0x0001 //! save data as float instead of as half (not recommended)
  601. #define EXR_NONE 0x0002 //! save with no compression
  602. #define EXR_ZIP 0x0004 //! save with zlib compression, in blocks of 16 scan lines
  603. #define EXR_PIZ 0x0008 //! save with piz-based wavelet compression
  604. #define EXR_PXR24 0x0010 //! save with lossy 24-bit float compression
  605. #define EXR_B44 0x0020 //! save with lossy 44% float compression - goes to 22% when combined with EXR_LC
  606. #define EXR_LC 0x0040 //! save images with one luminance and two chroma channels, rather than as RGB (lossy compression)
  607. #define FAXG3_DEFAULT 0
  608. #define GIF_DEFAULT 0
  609. #define GIF_LOAD256 1 //! load the image as a 256 color image with ununsed palette entries, if it's 16 or 2 color
  610. #define GIF_PLAYBACK 2 //! 'Play' the GIF to generate each frame (as 32bpp) instead of returning raw frame data when loading
  611. #define HDR_DEFAULT 0
  612. #define ICO_DEFAULT 0
  613. #define ICO_MAKEALPHA 1 //! convert to 32bpp and create an alpha channel from the AND-mask when loading
  614. #define IFF_DEFAULT 0
  615. #define J2K_DEFAULT 0 //! save with a 16:1 rate
  616. #define JP2_DEFAULT 0 //! save with a 16:1 rate
  617. #define JPEG_DEFAULT 0 //! loading (see JPEG_FAST); saving (see JPEG_QUALITYGOOD|JPEG_SUBSAMPLING_420)
  618. #define JPEG_FAST 0x0001 //! load the file as fast as possible, sacrificing some quality
  619. #define JPEG_ACCURATE 0x0002 //! load the file with the best quality, sacrificing some speed
  620. #define JPEG_CMYK 0x0004 //! load separated CMYK "as is" (use | to combine with other load flags)
  621. #define JPEG_EXIFROTATE 0x0008 //! load and rotate according to Exif 'Orientation' tag if available
  622. #define JPEG_GREYSCALE 0x0010 //! load and convert to a 8-bit greyscale image
  623. #define JPEG_QUALITYSUPERB 0x80 //! save with superb quality (100:1)
  624. #define JPEG_QUALITYGOOD 0x0100 //! save with good quality (75:1)
  625. #define JPEG_QUALITYNORMAL 0x0200 //! save with normal quality (50:1)
  626. #define JPEG_QUALITYAVERAGE 0x0400 //! save with average quality (25:1)
  627. #define JPEG_QUALITYBAD 0x0800 //! save with bad quality (10:1)
  628. #define JPEG_PROGRESSIVE 0x2000 //! save as a progressive-JPEG (use | to combine with other save flags)
  629. #define JPEG_SUBSAMPLING_411 0x1000 //! save with high 4x1 chroma subsampling (4:1:1)
  630. #define JPEG_SUBSAMPLING_420 0x4000 //! save with medium 2x2 medium chroma subsampling (4:2:0) - default value
  631. #define JPEG_SUBSAMPLING_422 0x8000 //! save with low 2x1 chroma subsampling (4:2:2)
  632. #define JPEG_SUBSAMPLING_444 0x10000 //! save with no chroma subsampling (4:4:4)
  633. #define JPEG_OPTIMIZE 0x20000 //! on saving, compute optimal Huffman coding tables (can reduce a few percent of file size)
  634. #define JPEG_BASELINE 0x40000 //! save basic JPEG, without metadata or any markers
  635. #define KOALA_DEFAULT 0
  636. #define LBM_DEFAULT 0
  637. #define MNG_DEFAULT 0
  638. #define PCD_DEFAULT 0
  639. #define PCD_BASE 1 //! load the bitmap sized 768 x 512
  640. #define PCD_BASEDIV4 2 //! load the bitmap sized 384 x 256
  641. #define PCD_BASEDIV16 3 //! load the bitmap sized 192 x 128
  642. #define PCX_DEFAULT 0
  643. #define PFM_DEFAULT 0
  644. #define PICT_DEFAULT 0
  645. #define PNG_DEFAULT 0
  646. #define PNG_IGNOREGAMMA 1 //! loading: avoid gamma correction
  647. #define PNG_Z_BEST_SPEED 0x0001 //! save using ZLib level 1 compression flag (default value is 6)
  648. #define PNG_Z_DEFAULT_COMPRESSION 0x0006 //! save using ZLib level 6 compression flag (default recommended value)
  649. #define PNG_Z_BEST_COMPRESSION 0x0009 //! save using ZLib level 9 compression flag (default value is 6)
  650. #define PNG_Z_NO_COMPRESSION 0x0100 //! save without ZLib compression
  651. #define PNG_INTERLACED 0x0200 //! save using Adam7 interlacing (use | to combine with other save flags)
  652. #define PNM_DEFAULT 0
  653. #define PNM_SAVE_RAW 0 //! if set the writer saves in RAW format (i.e. P4, P5 or P6)
  654. #define PNM_SAVE_ASCII 1 //! if set the writer saves in ASCII format (i.e. P1, P2 or P3)
  655. #define PSD_DEFAULT 0
  656. #define PSD_CMYK 1 //! reads tags for separated CMYK (default is conversion to RGB)
  657. #define PSD_LAB 2 //! reads tags for CIELab (default is conversion to RGB)
  658. #define RAS_DEFAULT 0
  659. #define RAW_DEFAULT 0 //! load the file as linear RGB 48-bit
  660. #define RAW_PREVIEW 1 //! try to load the embedded JPEG preview with included Exif Data or default to RGB 24-bit
  661. #define RAW_DISPLAY 2 //! load the file as RGB 24-bit
  662. #define RAW_HALFSIZE 4 //! output a half-size color image
  663. #define RAW_UNPROCESSED 8 //! output a FIT_UINT16 raw Bayer image
  664. #define SGI_DEFAULT 0
  665. #define TARGA_DEFAULT 0
  666. #define TARGA_LOAD_RGB888 1 //! if set the loader converts RGB555 and ARGB8888 -> RGB888.
  667. #define TARGA_SAVE_RLE 2 //! if set, the writer saves with RLE compression
  668. #define TIFF_DEFAULT 0
  669. #define TIFF_CMYK 0x0001 //! reads/stores tags for separated CMYK (use | to combine with compression flags)
  670. #define TIFF_PACKBITS 0x0100 //! save using PACKBITS compression
  671. #define TIFF_DEFLATE 0x0200 //! save using DEFLATE compression (a.k.a. ZLIB compression)
  672. #define TIFF_ADOBE_DEFLATE 0x0400 //! save using ADOBE DEFLATE compression
  673. #define TIFF_NONE 0x0800 //! save without any compression
  674. #define TIFF_CCITTFAX3 0x1000 //! save using CCITT Group 3 fax encoding
  675. #define TIFF_CCITTFAX4 0x2000 //! save using CCITT Group 4 fax encoding
  676. #define TIFF_LZW 0x4000 //! save using LZW compression
  677. #define TIFF_JPEG 0x8000 //! save using JPEG compression
  678. #define TIFF_LOGLUV 0x10000 //! save using LogLuv compression
  679. #define WBMP_DEFAULT 0
  680. #define XBM_DEFAULT 0
  681. #define XPM_DEFAULT 0
  682. #define WEBP_DEFAULT 0 //! save with good quality (75:1)
  683. #define WEBP_LOSSLESS 0x100 //! save in lossless mode
  684. #define JXR_DEFAULT 0 //! save with quality 80 and no chroma subsampling (4:4:4)
  685. #define JXR_LOSSLESS 0x0064 //! save lossless
  686. #define JXR_PROGRESSIVE 0x2000 //! save as a progressive-JXR (use | to combine with other save flags)
  687. // Background filling options ---------------------------------------------------------
  688. // Constants used in FreeImage_FillBackground and FreeImage_EnlargeCanvas
  689. #define FI_COLOR_IS_RGB_COLOR 0x00 //! RGBQUAD color is a RGB color (contains no valid alpha channel)
  690. #define FI_COLOR_IS_RGBA_COLOR 0x01 //! RGBQUAD color is a RGBA color (contains a valid alpha channel)
  691. #define FI_COLOR_FIND_EQUAL_COLOR 0x02 //! For palettized images: lookup equal RGB color from palette
  692. #define FI_COLOR_ALPHA_IS_INDEX 0x04 //! The color's rgbReserved member (alpha) contains the palette index to be used
  693. #define FI_COLOR_PALETTE_SEARCH_MASK (FI_COLOR_FIND_EQUAL_COLOR | FI_COLOR_ALPHA_IS_INDEX) // No color lookup is performed
  694. // RescaleEx options ---------------------------------------------------------
  695. // Constants used in FreeImage_RescaleEx
  696. #define FI_RESCALE_DEFAULT 0x00 //! default options; none of the following other options apply
  697. #define FI_RESCALE_TRUE_COLOR 0x01 //! for non-transparent greyscale images, convert to 24-bit if src bitdepth <= 8 (default is a 8-bit greyscale image).
  698. #define FI_RESCALE_OMIT_METADATA 0x02 //! do not copy metadata to the rescaled image
  699. #ifdef __cplusplus
  700. extern "C" {
  701. #endif
  702. // Init / Error routines ----------------------------------------------------
  703. DLL_API void DLL_CALLCONV FreeImage_Initialise(BOOL load_local_plugins_only FI_DEFAULT(FALSE));
  704. DLL_API void DLL_CALLCONV FreeImage_DeInitialise(void);
  705. // Version routines ---------------------------------------------------------
  706. DLL_API const char *DLL_CALLCONV FreeImage_GetVersion(void);
  707. DLL_API const char *DLL_CALLCONV FreeImage_GetCopyrightMessage(void);
  708. // Message output functions -------------------------------------------------
  709. typedef void (*FreeImage_OutputMessageFunction)(FREE_IMAGE_FORMAT fif, const char *msg);
  710. typedef void (DLL_CALLCONV *FreeImage_OutputMessageFunctionStdCall)(FREE_IMAGE_FORMAT fif, const char *msg);
  711. DLL_API void DLL_CALLCONV FreeImage_SetOutputMessageStdCall(FreeImage_OutputMessageFunctionStdCall omf);
  712. DLL_API void DLL_CALLCONV FreeImage_SetOutputMessage(FreeImage_OutputMessageFunction omf);
  713. DLL_API void DLL_CALLCONV FreeImage_OutputMessageProc(int fif, const char *fmt, ...);
  714. // Allocate / Clone / Unload routines ---------------------------------------
  715. 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));
  716. 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));
  717. DLL_API FIBITMAP * DLL_CALLCONV FreeImage_Clone(FIBITMAP *dib);
  718. DLL_API void DLL_CALLCONV FreeImage_Unload(FIBITMAP *dib);
  719. // Header loading routines
  720. DLL_API BOOL DLL_CALLCONV FreeImage_HasPixels(FIBITMAP *dib);
  721. // Load / Save routines -----------------------------------------------------
  722. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Load(FREE_IMAGE_FORMAT fif, const char *filename, int flags FI_DEFAULT(0));
  723. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadU(FREE_IMAGE_FORMAT fif, const wchar_t *filename, int flags FI_DEFAULT(0));
  724. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
  725. DLL_API BOOL DLL_CALLCONV FreeImage_Save(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const char *filename, int flags FI_DEFAULT(0));
  726. DLL_API BOOL DLL_CALLCONV FreeImage_SaveU(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, const wchar_t *filename, int flags FI_DEFAULT(0));
  727. DLL_API BOOL DLL_CALLCONV FreeImage_SaveToHandle(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
  728. // Memory I/O stream routines -----------------------------------------------
  729. DLL_API FIMEMORY *DLL_CALLCONV FreeImage_OpenMemory(BYTE *data FI_DEFAULT(0), DWORD size_in_bytes FI_DEFAULT(0));
  730. DLL_API void DLL_CALLCONV FreeImage_CloseMemory(FIMEMORY *stream);
  731. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_LoadFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
  732. DLL_API BOOL DLL_CALLCONV FreeImage_SaveToMemory(FREE_IMAGE_FORMAT fif, FIBITMAP *dib, FIMEMORY *stream, int flags FI_DEFAULT(0));
  733. DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream);
  734. DLL_API BOOL DLL_CALLCONV FreeImage_SeekMemory(FIMEMORY *stream, long offset, int origin);
  735. DLL_API BOOL DLL_CALLCONV FreeImage_AcquireMemory(FIMEMORY *stream, BYTE **data, DWORD *size_in_bytes);
  736. DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
  737. DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(const void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
  738. DLL_API FIMULTIBITMAP *DLL_CALLCONV FreeImage_LoadMultiBitmapFromMemory(FREE_IMAGE_FORMAT fif, FIMEMORY *stream, int flags FI_DEFAULT(0));
  739. DLL_API BOOL DLL_CALLCONV FreeImage_SaveMultiBitmapToMemory(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, FIMEMORY *stream, int flags);
  740. // Plugin Interface ---------------------------------------------------------
  741. 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));
  742. 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));
  743. DLL_API int DLL_CALLCONV FreeImage_GetFIFCount(void);
  744. DLL_API int DLL_CALLCONV FreeImage_SetPluginEnabled(FREE_IMAGE_FORMAT fif, BOOL enable);
  745. DLL_API int DLL_CALLCONV FreeImage_IsPluginEnabled(FREE_IMAGE_FORMAT fif);
  746. DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFormat(const char *format);
  747. DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromMime(const char *mime);
  748. DLL_API const char *DLL_CALLCONV FreeImage_GetFormatFromFIF(FREE_IMAGE_FORMAT fif);
  749. DLL_API const char *DLL_CALLCONV FreeImage_GetFIFExtensionList(FREE_IMAGE_FORMAT fif);
  750. DLL_API const char *DLL_CALLCONV FreeImage_GetFIFDescription(FREE_IMAGE_FORMAT fif);
  751. DLL_API const char *DLL_CALLCONV FreeImage_GetFIFRegExpr(FREE_IMAGE_FORMAT fif);
  752. DLL_API const char *DLL_CALLCONV FreeImage_GetFIFMimeType(FREE_IMAGE_FORMAT fif);
  753. DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilename(const char *filename);
  754. DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFIFFromFilenameU(const wchar_t *filename);
  755. DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsReading(FREE_IMAGE_FORMAT fif);
  756. DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsWriting(FREE_IMAGE_FORMAT fif);
  757. DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportBPP(FREE_IMAGE_FORMAT fif, int bpp);
  758. DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsExportType(FREE_IMAGE_FORMAT fif, FREE_IMAGE_TYPE type);
  759. DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsICCProfiles(FREE_IMAGE_FORMAT fif);
  760. DLL_API BOOL DLL_CALLCONV FreeImage_FIFSupportsNoPixels(FREE_IMAGE_FORMAT fif);
  761. // Multipaging interface ----------------------------------------------------
  762. 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));
  763. DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmapFromHandle(FREE_IMAGE_FORMAT fif, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
  764. DLL_API BOOL DLL_CALLCONV FreeImage_SaveMultiBitmapToHandle(FREE_IMAGE_FORMAT fif, FIMULTIBITMAP *bitmap, FreeImageIO *io, fi_handle handle, int flags FI_DEFAULT(0));
  765. DLL_API BOOL DLL_CALLCONV FreeImage_CloseMultiBitmap(FIMULTIBITMAP *bitmap, int flags FI_DEFAULT(0));
  766. DLL_API int DLL_CALLCONV FreeImage_GetPageCount(FIMULTIBITMAP *bitmap);
  767. DLL_API void DLL_CALLCONV FreeImage_AppendPage(FIMULTIBITMAP *bitmap, FIBITMAP *data);
  768. DLL_API void DLL_CALLCONV FreeImage_InsertPage(FIMULTIBITMAP *bitmap, int page, FIBITMAP *data);
  769. DLL_API void DLL_CALLCONV FreeImage_DeletePage(FIMULTIBITMAP *bitmap, int page);
  770. DLL_API FIBITMAP * DLL_CALLCONV FreeImage_LockPage(FIMULTIBITMAP *bitmap, int page);
  771. DLL_API void DLL_CALLCONV FreeImage_UnlockPage(FIMULTIBITMAP *bitmap, FIBITMAP *data, BOOL changed);
  772. DLL_API BOOL DLL_CALLCONV FreeImage_MovePage(FIMULTIBITMAP *bitmap, int target, int source);
  773. DLL_API BOOL DLL_CALLCONV FreeImage_GetLockedPageNumbers(FIMULTIBITMAP *bitmap, int *pages, int *count);
  774. // Filetype request routines ------------------------------------------------
  775. DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileType(const char *filename, int size FI_DEFAULT(0));
  776. DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeU(const wchar_t *filename, int size FI_DEFAULT(0));
  777. DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromHandle(FreeImageIO *io, fi_handle handle, int size FI_DEFAULT(0));
  778. DLL_API FREE_IMAGE_FORMAT DLL_CALLCONV FreeImage_GetFileTypeFromMemory(FIMEMORY *stream, int size FI_DEFAULT(0));
  779. // Image type request routine -----------------------------------------------
  780. DLL_API FREE_IMAGE_TYPE DLL_CALLCONV FreeImage_GetImageType(FIBITMAP *dib);
  781. // FreeImage helper routines ------------------------------------------------
  782. DLL_API BOOL DLL_CALLCONV FreeImage_IsLittleEndian(void);
  783. DLL_API BOOL DLL_CALLCONV FreeImage_LookupX11Color(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
  784. DLL_API BOOL DLL_CALLCONV FreeImage_LookupSVGColor(const char *szColor, BYTE *nRed, BYTE *nGreen, BYTE *nBlue);
  785. // Pixel access routines ----------------------------------------------------
  786. DLL_API BYTE *DLL_CALLCONV FreeImage_GetBits(FIBITMAP *dib);
  787. DLL_API BYTE *DLL_CALLCONV FreeImage_GetScanLine(FIBITMAP *dib, int scanline);
  788. DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
  789. DLL_API BOOL DLL_CALLCONV FreeImage_GetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
  790. DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelIndex(FIBITMAP *dib, unsigned x, unsigned y, BYTE *value);
  791. DLL_API BOOL DLL_CALLCONV FreeImage_SetPixelColor(FIBITMAP *dib, unsigned x, unsigned y, RGBQUAD *value);
  792. // DIB info routines --------------------------------------------------------
  793. DLL_API unsigned DLL_CALLCONV FreeImage_GetColorsUsed(FIBITMAP *dib);
  794. DLL_API unsigned DLL_CALLCONV FreeImage_GetBPP(FIBITMAP *dib);
  795. DLL_API unsigned DLL_CALLCONV FreeImage_GetWidth(FIBITMAP *dib);
  796. DLL_API unsigned DLL_CALLCONV FreeImage_GetHeight(FIBITMAP *dib);
  797. DLL_API unsigned DLL_CALLCONV FreeImage_GetLine(FIBITMAP *dib);
  798. DLL_API unsigned DLL_CALLCONV FreeImage_GetPitch(FIBITMAP *dib);
  799. DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib);
  800. DLL_API unsigned DLL_CALLCONV FreeImage_GetMemorySize(FIBITMAP *dib);
  801. DLL_API RGBQUAD *DLL_CALLCONV FreeImage_GetPalette(FIBITMAP *dib);
  802. DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib);
  803. DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterY(FIBITMAP *dib);
  804. DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterX(FIBITMAP *dib, unsigned res);
  805. DLL_API void DLL_CALLCONV FreeImage_SetDotsPerMeterY(FIBITMAP *dib, unsigned res);
  806. DLL_API BITMAPINFOHEADER *DLL_CALLCONV FreeImage_GetInfoHeader(FIBITMAP *dib);
  807. DLL_API BITMAPINFO *DLL_CALLCONV FreeImage_GetInfo(FIBITMAP *dib);
  808. DLL_API FREE_IMAGE_COLOR_TYPE DLL_CALLCONV FreeImage_GetColorType(FIBITMAP *dib);
  809. DLL_API unsigned DLL_CALLCONV FreeImage_GetRedMask(FIBITMAP *dib);
  810. DLL_API unsigned DLL_CALLCONV FreeImage_GetGreenMask(FIBITMAP *dib);
  811. DLL_API unsigned DLL_CALLCONV FreeImage_GetBlueMask(FIBITMAP *dib);
  812. DLL_API unsigned DLL_CALLCONV FreeImage_GetTransparencyCount(FIBITMAP *dib);
  813. DLL_API BYTE * DLL_CALLCONV FreeImage_GetTransparencyTable(FIBITMAP *dib);
  814. DLL_API void DLL_CALLCONV FreeImage_SetTransparent(FIBITMAP *dib, BOOL enabled);
  815. DLL_API void DLL_CALLCONV FreeImage_SetTransparencyTable(FIBITMAP *dib, BYTE *table, int count);
  816. DLL_API BOOL DLL_CALLCONV FreeImage_IsTransparent(FIBITMAP *dib);
  817. DLL_API void DLL_CALLCONV FreeImage_SetTransparentIndex(FIBITMAP *dib, int index);
  818. DLL_API int DLL_CALLCONV FreeImage_GetTransparentIndex(FIBITMAP *dib);
  819. DLL_API BOOL DLL_CALLCONV FreeImage_HasBackgroundColor(FIBITMAP *dib);
  820. DLL_API BOOL DLL_CALLCONV FreeImage_GetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
  821. DLL_API BOOL DLL_CALLCONV FreeImage_SetBackgroundColor(FIBITMAP *dib, RGBQUAD *bkcolor);
  822. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetThumbnail(FIBITMAP *dib);
  823. DLL_API BOOL DLL_CALLCONV FreeImage_SetThumbnail(FIBITMAP *dib, FIBITMAP *thumbnail);
  824. // ICC profile routines -----------------------------------------------------
  825. DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_GetICCProfile(FIBITMAP *dib);
  826. DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib, void *data, long size);
  827. DLL_API void DLL_CALLCONV FreeImage_DestroyICCProfile(FIBITMAP *dib);
  828. // Line conversion routines -------------------------------------------------
  829. DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To4(BYTE *target, BYTE *source, int width_in_pixels);
  830. DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To4(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  831. DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_555(BYTE *target, BYTE *source, int width_in_pixels);
  832. DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To4_565(BYTE *target, BYTE *source, int width_in_pixels);
  833. DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To4(BYTE *target, BYTE *source, int width_in_pixels);
  834. DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To4(BYTE *target, BYTE *source, int width_in_pixels);
  835. DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To8(BYTE *target, BYTE *source, int width_in_pixels);
  836. DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To8(BYTE *target, BYTE *source, int width_in_pixels);
  837. DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_555(BYTE *target, BYTE *source, int width_in_pixels);
  838. DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To8_565(BYTE *target, BYTE *source, int width_in_pixels);
  839. DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To8(BYTE *target, BYTE *source, int width_in_pixels);
  840. DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To8(BYTE *target, BYTE *source, int width_in_pixels);
  841. DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  842. DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  843. DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_555(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  844. DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_565_To16_555(BYTE *target, BYTE *source, int width_in_pixels);
  845. DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_555(BYTE *target, BYTE *source, int width_in_pixels);
  846. DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_555(BYTE *target, BYTE *source, int width_in_pixels);
  847. DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  848. DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  849. DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To16_565(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  850. DLL_API void DLL_CALLCONV FreeImage_ConvertLine16_555_To16_565(BYTE *target, BYTE *source, int width_in_pixels);
  851. DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To16_565(BYTE *target, BYTE *source, int width_in_pixels);
  852. DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To16_565(BYTE *target, BYTE *source, int width_in_pixels);
  853. DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  854. DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  855. DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To24(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  856. DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_555(BYTE *target, BYTE *source, int width_in_pixels);
  857. DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To24_565(BYTE *target, BYTE *source, int width_in_pixels);
  858. DLL_API void DLL_CALLCONV FreeImage_ConvertLine32To24(BYTE *target, BYTE *source, int width_in_pixels);
  859. DLL_API void DLL_CALLCONV FreeImage_ConvertLine1To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  860. DLL_API void DLL_CALLCONV FreeImage_ConvertLine4To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  861. DLL_API void DLL_CALLCONV FreeImage_ConvertLine8To32(BYTE *target, BYTE *source, int width_in_pixels, RGBQUAD *palette);
  862. DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_555(BYTE *target, BYTE *source, int width_in_pixels);
  863. DLL_API void DLL_CALLCONV FreeImage_ConvertLine16To32_565(BYTE *target, BYTE *source, int width_in_pixels);
  864. DLL_API void DLL_CALLCONV FreeImage_ConvertLine24To32(BYTE *target, BYTE *source, int width_in_pixels);
  865. // Smart conversion routines ------------------------------------------------
  866. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo4Bits(FIBITMAP *dib);
  867. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo8Bits(FIBITMAP *dib);
  868. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToGreyscale(FIBITMAP *dib);
  869. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits555(FIBITMAP *dib);
  870. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo16Bits565(FIBITMAP *dib);
  871. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo24Bits(FIBITMAP *dib);
  872. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertTo32Bits(FIBITMAP *dib);
  873. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ColorQuantize(FIBITMAP *dib, FREE_IMAGE_QUANTIZE quantize);
  874. 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));
  875. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Threshold(FIBITMAP *dib, BYTE T);
  876. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Dither(FIBITMAP *dib, FREE_IMAGE_DITHER algorithm);
  877. 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));
  878. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertFromRawBitsEx(BOOL copySource, BYTE *bits, FREE_IMAGE_TYPE type, int width, int height, int pitch, unsigned bpp, unsigned red_mask, unsigned green_mask, unsigned blue_mask, BOOL topdown FI_DEFAULT(FALSE));
  879. 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));
  880. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToFloat(FIBITMAP *dib);
  881. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBF(FIBITMAP *dib);
  882. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBAF(FIBITMAP *dib);
  883. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToUINT16(FIBITMAP *dib);
  884. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGB16(FIBITMAP *dib);
  885. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToRGBA16(FIBITMAP *dib);
  886. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToStandardType(FIBITMAP *src, BOOL scale_linear FI_DEFAULT(TRUE));
  887. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_ConvertToType(FIBITMAP *src, FREE_IMAGE_TYPE dst_type, BOOL scale_linear FI_DEFAULT(TRUE));
  888. // Tone mapping operators ---------------------------------------------------
  889. 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));
  890. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoDrago03(FIBITMAP *src, double gamma FI_DEFAULT(2.2), double exposure FI_DEFAULT(0));
  891. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoReinhard05(FIBITMAP *src, double intensity FI_DEFAULT(0), double contrast FI_DEFAULT(0));
  892. 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));
  893. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_TmoFattal02(FIBITMAP *src, double color_saturation FI_DEFAULT(0.5), double attenuation FI_DEFAULT(0.85));
  894. // ZLib interface -----------------------------------------------------------
  895. DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
  896. DLL_API DWORD DLL_CALLCONV FreeImage_ZLibUncompress(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
  897. DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGZip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
  898. DLL_API DWORD DLL_CALLCONV FreeImage_ZLibGUnzip(BYTE *target, DWORD target_size, BYTE *source, DWORD source_size);
  899. DLL_API DWORD DLL_CALLCONV FreeImage_ZLibCRC32(DWORD crc, BYTE *source, DWORD source_size);
  900. // --------------------------------------------------------------------------
  901. // Metadata routines
  902. // --------------------------------------------------------------------------
  903. // tag creation / destruction
  904. DLL_API FITAG *DLL_CALLCONV FreeImage_CreateTag(void);
  905. DLL_API void DLL_CALLCONV FreeImage_DeleteTag(FITAG *tag);
  906. DLL_API FITAG *DLL_CALLCONV FreeImage_CloneTag(FITAG *tag);
  907. // tag getters and setters
  908. DLL_API const char *DLL_CALLCONV FreeImage_GetTagKey(FITAG *tag);
  909. DLL_API const char *DLL_CALLCONV FreeImage_GetTagDescription(FITAG *tag);
  910. DLL_API WORD DLL_CALLCONV FreeImage_GetTagID(FITAG *tag);
  911. DLL_API FREE_IMAGE_MDTYPE DLL_CALLCONV FreeImage_GetTagType(FITAG *tag);
  912. DLL_API DWORD DLL_CALLCONV FreeImage_GetTagCount(FITAG *tag);
  913. DLL_API DWORD DLL_CALLCONV FreeImage_GetTagLength(FITAG *tag);
  914. DLL_API const void *DLL_CALLCONV FreeImage_GetTagValue(FITAG *tag);
  915. DLL_API BOOL DLL_CALLCONV FreeImage_SetTagKey(FITAG *tag, const char *key);
  916. DLL_API BOOL DLL_CALLCONV FreeImage_SetTagDescription(FITAG *tag, const char *description);
  917. DLL_API BOOL DLL_CALLCONV FreeImage_SetTagID(FITAG *tag, WORD id);
  918. DLL_API BOOL DLL_CALLCONV FreeImage_SetTagType(FITAG *tag, FREE_IMAGE_MDTYPE type);
  919. DLL_API BOOL DLL_CALLCONV FreeImage_SetTagCount(FITAG *tag, DWORD count);
  920. DLL_API BOOL DLL_CALLCONV FreeImage_SetTagLength(FITAG *tag, DWORD length);
  921. DLL_API BOOL DLL_CALLCONV FreeImage_SetTagValue(FITAG *tag, const void *value);
  922. // iterator
  923. DLL_API FIMETADATA *DLL_CALLCONV FreeImage_FindFirstMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, FITAG **tag);
  924. DLL_API BOOL DLL_CALLCONV FreeImage_FindNextMetadata(FIMETADATA *mdhandle, FITAG **tag);
  925. DLL_API void DLL_CALLCONV FreeImage_FindCloseMetadata(FIMETADATA *mdhandle);
  926. // metadata setter and getter
  927. DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG *tag);
  928. DLL_API BOOL DLL_CALLCONV FreeImage_GetMetadata(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, FITAG **tag);
  929. DLL_API BOOL DLL_CALLCONV FreeImage_SetMetadataKeyValue(FREE_IMAGE_MDMODEL model, FIBITMAP *dib, const char *key, const char *value);
  930. // helpers
  931. DLL_API unsigned DLL_CALLCONV FreeImage_GetMetadataCount(FREE_IMAGE_MDMODEL model, FIBITMAP *dib);
  932. DLL_API BOOL DLL_CALLCONV FreeImage_CloneMetadata(FIBITMAP *dst, FIBITMAP *src);
  933. // tag to C string conversion
  934. DLL_API const char* DLL_CALLCONV FreeImage_TagToString(FREE_IMAGE_MDMODEL model, FITAG *tag, char *Make FI_DEFAULT(NULL));
  935. // --------------------------------------------------------------------------
  936. // JPEG lossless transformation routines
  937. // --------------------------------------------------------------------------
  938. DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransform(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, BOOL perfect FI_DEFAULT(TRUE));
  939. 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(TRUE));
  940. DLL_API BOOL DLL_CALLCONV FreeImage_JPEGCrop(const char *src_file, const char *dst_file, int left, int top, int right, int bottom);
  941. 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);
  942. DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformFromHandle(FreeImageIO* src_io, fi_handle src_handle, FreeImageIO* dst_io, fi_handle dst_handle, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
  943. DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombined(const char *src_file, const char *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
  944. DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedU(const wchar_t *src_file, const wchar_t *dst_file, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
  945. DLL_API BOOL DLL_CALLCONV FreeImage_JPEGTransformCombinedFromMemory(FIMEMORY* src_stream, FIMEMORY* dst_stream, FREE_IMAGE_JPEG_OPERATION operation, int* left, int* top, int* right, int* bottom, BOOL perfect FI_DEFAULT(TRUE));
  946. // --------------------------------------------------------------------------
  947. // Image manipulation toolkit
  948. // --------------------------------------------------------------------------
  949. // rotation and flipping
  950. /// @deprecated see FreeImage_Rotate
  951. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RotateClassic(FIBITMAP *dib, double angle);
  952. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rotate(FIBITMAP *dib, double angle, const void *bkcolor FI_DEFAULT(NULL));
  953. 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);
  954. DLL_API BOOL DLL_CALLCONV FreeImage_FlipHorizontal(FIBITMAP *dib);
  955. DLL_API BOOL DLL_CALLCONV FreeImage_FlipVertical(FIBITMAP *dib);
  956. // upsampling / downsampling
  957. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Rescale(FIBITMAP *dib, int dst_width, int dst_height, FREE_IMAGE_FILTER filter FI_DEFAULT(FILTER_CATMULLROM));
  958. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MakeThumbnail(FIBITMAP *dib, int max_pixel_size, BOOL convert FI_DEFAULT(TRUE));
  959. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_RescaleRect(FIBITMAP *dib, int dst_width, int dst_height, int left, int top, int right, int bottom, FREE_IMAGE_FILTER filter FI_DEFAULT(FILTER_CATMULLROM), unsigned flags FI_DEFAULT(0));
  960. // color manipulation routines (point operations)
  961. DLL_API BOOL DLL_CALLCONV FreeImage_AdjustCurve(FIBITMAP *dib, BYTE *LUT, FREE_IMAGE_COLOR_CHANNEL channel);
  962. DLL_API BOOL DLL_CALLCONV FreeImage_AdjustGamma(FIBITMAP *dib, double gamma);
  963. DLL_API BOOL DLL_CALLCONV FreeImage_AdjustBrightness(FIBITMAP *dib, double percentage);
  964. DLL_API BOOL DLL_CALLCONV FreeImage_AdjustContrast(FIBITMAP *dib, double percentage);
  965. DLL_API BOOL DLL_CALLCONV FreeImage_Invert(FIBITMAP *dib);
  966. DLL_API BOOL DLL_CALLCONV FreeImage_GetHistogram(FIBITMAP *dib, DWORD *histo, FREE_IMAGE_COLOR_CHANNEL channel FI_DEFAULT(FICC_BLACK));
  967. DLL_API int DLL_CALLCONV FreeImage_GetAdjustColorsLookupTable(BYTE *LUT, double brightness, double contrast, double gamma, BOOL invert);
  968. DLL_API BOOL DLL_CALLCONV FreeImage_AdjustColors(FIBITMAP *dib, double brightness, double contrast, double gamma, BOOL invert FI_DEFAULT(FALSE));
  969. DLL_API unsigned DLL_CALLCONV FreeImage_ApplyColorMapping(FIBITMAP *dib, RGBQUAD *srccolors, RGBQUAD *dstcolors, unsigned count, BOOL ignore_alpha, BOOL swap);
  970. DLL_API unsigned DLL_CALLCONV FreeImage_SwapColors(FIBITMAP *dib, RGBQUAD *color_a, RGBQUAD *color_b, BOOL ignore_alpha);
  971. DLL_API unsigned DLL_CALLCONV FreeImage_ApplyPaletteIndexMapping(FIBITMAP *dib, BYTE *srcindices, BYTE *dstindices, unsigned count, BOOL swap);
  972. DLL_API unsigned DLL_CALLCONV FreeImage_SwapPaletteIndices(FIBITMAP *dib, BYTE *index_a, BYTE *index_b);
  973. // channel processing routines
  974. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetChannel(FIBITMAP *dib, FREE_IMAGE_COLOR_CHANNEL channel);
  975. DLL_API BOOL DLL_CALLCONV FreeImage_SetChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
  976. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_GetComplexChannel(FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
  977. DLL_API BOOL DLL_CALLCONV FreeImage_SetComplexChannel(FIBITMAP *dst, FIBITMAP *src, FREE_IMAGE_COLOR_CHANNEL channel);
  978. // copy / paste / composite routines
  979. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Copy(FIBITMAP *dib, int left, int top, int right, int bottom);
  980. DLL_API BOOL DLL_CALLCONV FreeImage_Paste(FIBITMAP *dst, FIBITMAP *src, int left, int top, int alpha);
  981. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_CreateView(FIBITMAP *dib, unsigned left, unsigned top, unsigned right, unsigned bottom);
  982. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_Composite(FIBITMAP *fg, BOOL useFileBkg FI_DEFAULT(FALSE), RGBQUAD *appBkColor FI_DEFAULT(NULL), FIBITMAP *bg FI_DEFAULT(NULL));
  983. DLL_API BOOL DLL_CALLCONV FreeImage_PreMultiplyWithAlpha(FIBITMAP *dib);
  984. // background filling routines
  985. DLL_API BOOL DLL_CALLCONV FreeImage_FillBackground(FIBITMAP *dib, const void *color, int options FI_DEFAULT(0));
  986. 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));
  987. 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));
  988. 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));
  989. // miscellaneous algorithms
  990. DLL_API FIBITMAP *DLL_CALLCONV FreeImage_MultigridPoissonSolver(FIBITMAP *Laplacian, int ncycle FI_DEFAULT(3));
  991. // restore the borland-specific enum size option
  992. #if defined(__BORLANDC__)
  993. #pragma option pop
  994. #endif
  995. #ifdef __cplusplus
  996. }
  997. #endif
  998. #endif // FREEIMAGE_H