// ==========================================================
// FreeImage 3
//
// Design and implementation by
// - Floris van den Berg (flvdberg@wxs.nl)
// - Herv� Drolon (drolon@infonie.fr)
//
// Contributors:
// - see changes log named 'Whatsnew.txt', see header of each .h and .cpp file
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
// ==========================================================
#ifndef FREEIMAGE_H
#define FREEIMAGE_H
// Version information ------------------------------------------------------
#define FREEIMAGE_MAJOR_VERSION 3
#define FREEIMAGE_MINOR_VERSION 15
#define FREEIMAGE_RELEASE_SERIAL 3
// Compiler options ---------------------------------------------------------
#include <wchar.h> // needed for UNICODE functions
#if defined(FREEIMAGE_LIB)
#define DLL_API
#define DLL_CALLCONV
#else
#if defined(_WIN32) || defined(__WIN32__)
#define DLL_CALLCONV __stdcall
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the FREEIMAGE_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// DLL_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported.
#ifdef FREEIMAGE_EXPORTS
#define DLL_API __declspec(dllexport)
#else
#define DLL_API __declspec(dllimport)
#endif // FREEIMAGE_EXPORTS
#else
// try the gcc visibility support (see http://gcc.gnu.org/wiki/Visibility)
#if defined(__GNUC__) && ((__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#ifndef GCC_HASCLASSVISIBILITY
#define GCC_HASCLASSVISIBILITY
#endif
#endif // __GNUC__
#define DLL_CALLCONV
#if defined(GCC_HASCLASSVISIBILITY)
#define DLL_API __attribute__ ((visibility("default")))
#else
#define DLL_API
#endif
#endif // WIN32 / !WIN32
#endif // FREEIMAGE_LIB
// Some versions of gcc may have BYTE_ORDER or __BYTE_ORDER defined
// If your big endian system isn't being detected, add an OS specific check
#if (defined(BYTE_ORDER) && BYTE_ORDER==BIG_ENDIAN) || \
(defined(__BYTE_ORDER) && __BYTE_ORDER==__BIG_ENDIAN) || \
defined(__BIG_ENDIAN__)
#define FREEIMAGE_BIGENDIAN
#endif // BYTE_ORDER
// This really only affects 24 and 32 bit formats, the rest are always RGB order.
#define FREEIMAGE_COLORORDER_BGR 0
#define FREEIMAGE_COLORORDER_RGB 1
#if defined(FREEIMAGE_BIGENDIAN)
#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_RGB
#else
#define FREEIMAGE_COLORORDER FREEIMAGE_COLORORDER_BGR
#endif
// Ensure 4-byte enums if we're using Borland C++ compilers
#if defined(__BORLANDC__)
#pragma option push -b
#endif
// For C compatibility --------------------------------------------------------
#ifdef __cplusplus
#define FI_DEFAULT(x) = x
#define FI_ENUM(x) enum x
#define FI_STRUCT(x) struct x
#else
#define FI_DEFAULT(x)
#define FI_ENUM(x) typedef int x; enum x
#define FI_STRUCT(x) typedef struct x x; struct x
#endif
// Bitmap types -------------------------------------------------------------
FI_STRUCT (FIBITMAP) { void *data; };
FI_STRUCT (FIMULTIBITMAP) { void *data; };
// Types used in the library (directly copied from Windows) -----------------
#if defined(__MINGW32__) && defined(_WINDOWS_H)
#define _WINDOWS_ // prevent a bug in MinGW32
#endif // __MINGW32__
#ifndef _WINDOWS_
#define _WINDOWS_
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef SEEK_SET
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#endif
#ifndef _MSC_VER
// define portable types for 32-bit / 64-bit OS
#include <inttypes.h>
typedef int32_t BOOL;
typedef uint8_t BYTE;
typedef uint16_t WORD;
typedef uint32_t DWORD;
typedef int32_t LONG;
typedef int64_t FIINT64;
typedef uint64_t FIUINT64;
#else
// MS is not C99 ISO compliant
typedef long BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef long LONG;
typedef signed __int64 FIINT64;
typedef unsigned __int64 FIUINT64;
#endif // _MSC_VER
#if (defined(_WIN32) || defined(__WIN32__))
#pragma pack(push, 1)
#else
#pragma pack(1)
#endif // WIN32
typedef struct tagRGBQUAD {
#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
BYTE rgbBlue;
BYTE rgbGreen;
BYTE rgbRed;
#else
BYTE rgbRed;
BYTE rgbGreen;
BYTE rgbBlue;
#endif // FREEIMAGE_COLORORDER
BYTE rgbReserved;
} RGBQUAD;
typedef struct tagRGBTRIPLE {
#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
BYTE rgbtBlue;
BYTE rgbtGreen;
BYTE rgbtRed;
#else
BYTE rgbtRed;
BYTE rgbtGreen;
BYTE rgbtBlue;
#endif // FREEIMAGE_COLORORDER
} RGBTRIPLE;
#if (defined(_WIN32) || defined(__WIN32__))
#pragma pack(pop)
#else
#pragma pack()
#endif // WIN32
typedef struct tagBITMAPINFOHEADER{
DWORD biSize;
LONG biWidth;
LONG biHeight;
WORD biPlanes;
WORD biBitCount;
DWORD biCompression;
DWORD biSizeImage;
LONG biXPelsPerMeter;
LONG biYPelsPerMeter;
DWORD biClrUsed;
DWORD biClrImportant;
} BITMAPINFOHEADER, *PBITMAPINFOHEADER;
typedef struct tagBITMAPINFO {
BITMAPINFOHEADER bmiHeader;
RGBQUAD bmiColors[1];
} BITMAPINFO, *PBITMAPINFO;
#endif // _WINDOWS_
// Types used in the library (specific to FreeImage) ------------------------
#if (defined(_WIN32) || defined(__WIN32__))
#pragma pack(push, 1)
#else
#pragma pack(1)
#endif // WIN32
/** 48-bit RGB
*/
typedef struct tagFIRGB16 {
WORD red;
WORD green;
WORD blue;
} FIRGB16;
/** 64-bit RGBA
*/
typedef struct tagFIRGBA16 {
WORD red;
WORD green;
WORD blue;
WORD alpha;
} FIRGBA16;
/** 96-bit RGB Float
*/
typedef struct tagFIRGBF {
float red;
float green;
float blue;
} FIRGBF;
/** 128-bit RGBA Float
*/
typedef struct tagFIRGBAF {
float red;
float green;
float blue;
float alpha;
} FIRGBAF;
/** Data structure for COMPLEX type (complex number)
*/
typedef struct tagFICOMPLEX {
/// real part
double r;
/// imaginary part
double i;
} FICOMPLEX;
#if (defined(_WIN32) || defined(__WIN32__))
#pragma pack(pop)
#else
#pragma pack()
#endif // WIN32
// Indexes for byte arrays, masks and shifts for treating pixels as words ---
// These coincide with the order of RGBQUAD and RGBTRIPLE -------------------
#ifndef FREEIMAGE_BIGENDIAN
#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
// Little Endian (x86 / MS Windows, Linux) : BGR(A) order
#define FI_RGBA_RED 2
#define FI_RGBA_GREEN 1
#define FI_RGBA_BLUE 0
#define FI_RGBA_ALPHA 3
#define FI_RGBA_RED_MASK 0x00FF0000
#define FI_RGBA_GREEN_MASK 0x0000FF00
#define FI_RGBA_BLUE_MASK 0x000000FF
#define FI_RGBA_ALPHA_MASK 0xFF000000
#define FI_RGBA_RED_SHIFT 16
#define FI_RGBA_GREEN_SHIFT 8
#define FI_RGBA_BLUE_SHIFT 0
#define FI_RGBA_ALPHA_SHIFT 24
#else
// Little Endian (x86 / MaxOSX) : RGB(A) order
#define FI_RGBA_RED 0
- 1
- 2
- 3
- 4
- 5
- 6
前往页