📄 lcms.h
字号:
//// Little cms// Copyright (C) 1998-2005 Marti Maria//// Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the Software // is furnished to do so, subject to the following conditions://// The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software.//// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.// Version 1.15#ifndef __cms_H// ********** Configuration toggles ****************************************// Optimization mode.//// Note that USE_ASSEMBLER Is fastest by far, but it is limited to Pentium.// USE_FLOAT are the generic floating-point routines. USE_C should work on// virtually any machine.//#define USE_FLOAT 1// #define USE_C 1#define USE_ASSEMBLER 1// Define this if you are using this package as a DLL (windows only)// #define LCMS_DLL 1// #define LCMS_DLL_BUILD 1// Uncomment if you are trying the engine in a non-windows environment// like linux, SGI, VAX, FreeBSD, BeOS, etc. #define NON_WINDOWS 1// Uncomment this one if you are using big endian machines (only meaningful// when NON_WINDOWS is used)// #define USE_BIG_ENDIAN 1// Uncomment this one if your compiler/machine does support the// "long long" type This will speedup fixed point math. (USE_C only)#define USE_INT64 1// Some machines does not have a reliable 'swab' function. Usually// leave commented unless the testbed diagnoses the contrary.// #define USE_CUSTOM_SWAB 1// Uncomment this if your compiler supports inline#define USE_INLINE 1// Uncomment this if your compiler doesn't work with fast floor function// #define USE_DEFAULT_FLOOR_CONVERSION 1// ********** End of configuration toggles ******************************#define LCMS_VERSION 115#include <stdio.h>#include <stdlib.h>#include <math.h>#include <assert.h>#include <stdarg.h>#include <time.h>// Metroworks CodeWarrior#ifdef __MWERKS__ # define unlink remove# if WIN32 # define USE_CUSTOM_SWAB 1# else# define NON_WINDOWS 1# endif#endif// Borland C #ifdef __BORLANDC__# undef NON_WINDOWS#endif// Microsoft VisualC++#ifdef _MSC_VER# undef NON_WINDOWS#endif// Here comes the Non-Windows settings#ifdef NON_WINDOWS// Non windows environments. Also avoid indentation on includes.#undef LCMS_DLL#ifdef USE_ASSEMBLER# undef USE_ASSEMBLER# define USE_C 1#endif#ifdef _HOST_BIG_ENDIAN# define USE_BIG_ENDIAN 1#endif#if defined(__sgi__) || defined(__sgi) || defined(__powerpc__) || defined(sparc) || defined(__ppc__)# define USE_BIG_ENDIAN 1#endif#ifdef TARGET_CPU_PPC# define USE_BIG_ENDIAN 1#endif#ifdef macintosh# define USE_BIG_ENDIAN 1#endif#ifdef WORDS_BIGENDIAN# define USE_BIG_ENDIAN 1#endif#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)# include <sys/types.h># define USE_INT64 1# define LCMSSLONGLONG int64_t# define LCMSULONGLONG u_int64_t#endif#ifdef USE_INT64# ifndef LCMSULONGLONG# define LCMSULONGLONG unsigned long long# define LCMSSLONGLONG long long# endif#endif#if !defined(__INTEGRITY)# include <memory.h>#endif#include <string.h>#if defined(__GNUC__) || defined(__FreeBSD__)# include <unistd.h>#endif#ifndef LCMS_WIN_TYPES_ALREADY_DEFINEDtypedef unsigned char BYTE, *LPBYTE; typedef unsigned short WORD, *LPWORD;typedef unsigned int DWORD, *LPDWORD;typedef int BOOL;typedef char *LPSTR;typedef void *LPVOID;typedef void* LCMSHANDLE;#define ZeroMemory(p,l) memset((p),0,(l))#define CopyMemory(d,s,l) memcpy((d),(s),(l))#define FAR#ifndef stricmp# define stricmp strcasecmp#endif#ifndef FALSE# define FALSE 0#endif#ifndef TRUE# define TRUE 1#endif#define LOWORD(l) ((WORD)(l))#define HIWORD(l) ((WORD)((DWORD)(l) >> 16))#define MAX_PATH (256)#define cdecl#endif// The specification for "inline" is section 6.7.4 of the C99 standard (ISO/IEC 9899:1999). #define LCMS_INLINE static inline#else// Win32 stuff#ifndef WIN32_LEAN_AND_MEAN# define WIN32_LEAN_AND_MEAN#endif#include <windows.h>typedef HANDLE LCMSHANDLE;#ifdef USE_INT64# ifndef LCMSULONGLONG# define LCMSULONGLONG unsigned __int64# define LCMSSLONGLONG __int64# endif#endif// This works for both VC & BorlandC#define LCMS_INLINE __inline#endif#include "icc34.h" // ICC header file// Some tag & type additions#define lcmsSignature ((icSignature) 0x6c636d73L)#define icSigLuvKData ((icColorSpaceSignature) 0x4C75764BL) // 'LuvK'#define icSigHexachromeData ((icColorSpaceSignature) 0x4d434836L) // MCH6#define icSigHeptachromeData ((icColorSpaceSignature) 0x4d434837L) // MCH7#define icSigOctachromeData ((icColorSpaceSignature) 0x4d434838L) // MCH8#define icSigMCH5Data ((icColorSpaceSignature) 0x4d434835L) // MCH5#define icSigMCH6Data ((icColorSpaceSignature) 0x4d434836L) // MCH6#define icSigMCH7Data ((icColorSpaceSignature) 0x4d434837L) // MCH7#define icSigMCH8Data ((icColorSpaceSignature) 0x4d434838L) // MCH8#define icSigMCH9Data ((icColorSpaceSignature) 0x4d434839L) // MCH9#define icSigMCHAData ((icColorSpaceSignature) 0x4d434841L) // MCHA#define icSigMCHBData ((icColorSpaceSignature) 0x4d434842L) // MCHB#define icSigMCHCData ((icColorSpaceSignature) 0x4d434843L) // MCHC#define icSigMCHDData ((icColorSpaceSignature) 0x4d434844L) // MCHD#define icSigMCHEData ((icColorSpaceSignature) 0x4d434845L) // MCHE#define icSigMCHFData ((icColorSpaceSignature) 0x4d434846L) // MCHF#define icSigCAM97JABData ((icColorSpaceSignature) 0x4A616231L) // 'Jab1' H. Zeng#define icSigCAM02JABData ((icColorSpaceSignature) 0x4A616232L) // 'Jab2' H. Zeng#define icSigCAM02JCHData ((icColorSpaceSignature) 0x4A636A32L) // 'Jch2' H. Zeng#define icSigChromaticityTag ((icTagSignature) 0x6368726dL) // As per Addendum 2 to Spec. ICC.1:1998-09#define icSigChromaticAdaptationTag ((icTagSignature) 0x63686164L) // 'chad'#define icSigColorantTableTag ((icTagSignature) 0x636c7274L) // 'clrt'#define icSigColorantTableOutTag ((icTagSignature) 0x636c6f74L) // 'clot'#define icSigHPGamutDescTag ((icTagSignature) 0x676D7441L) // 'gmtA' H. Zeng #define icSigParametricCurveType ((icTagTypeSignature) 0x70617261L) // parametric (ICC 4.0)#define icSigMultiLocalizedUnicodeType ((icTagTypeSignature) 0x6D6C7563L)#define icSigS15Fixed16ArrayType ((icTagTypeSignature) 0x73663332L) #define icSigChromaticityType ((icTagTypeSignature) 0x6368726dL)#define icSiglutAtoBType ((icTagTypeSignature) 0x6d414220L) // mAB #define icSiglutBtoAType ((icTagTypeSignature) 0x6d424120L) // mBA #define icSigColorantTableType ((icTagTypeSignature) 0x636c7274L) // clrt#define icSigHPGamutDescType ((icTagTypeSignature) 0x676D7441L) // gmtA H. Zeng typedef struct { icUInt8Number gridPoints[16]; // Number of grid points in each dimension. icUInt8Number prec; // Precision of data elements in bytes. icUInt8Number pad1; icUInt8Number pad2; icUInt8Number pad3; /*icUInt8Number data[icAny]; Data follows see spec for size */} icCLutStruct;// icLutAtoB typedef struct { icUInt8Number inputChan; // Number of input channels icUInt8Number outputChan; // Number of output channels icUInt8Number pad1; icUInt8Number pad2; icUInt32Number offsetB; // Offset to first "B" curve icUInt32Number offsetMat; // Offset to matrix icUInt32Number offsetM; // Offset to first "M" curve icUInt32Number offsetC; // Offset to CLUT icUInt32Number offsetA; // Offset to first "A" curve /*icUInt8Number data[icAny]; Data follows see spec for size */} icLutAtoB;// icLutBtoA typedef struct { icUInt8Number inputChan; // Number of input channels icUInt8Number outputChan; // Number of output channels icUInt8Number pad1; icUInt8Number pad2; icUInt32Number offsetB; // Offset to first "B" curve icUInt32Number offsetMat; // Offset to matrix icUInt32Number offsetM; // Offset to first "M" curve icUInt32Number offsetC; // Offset to CLUT icUInt32Number offsetA; // Offset to first "A" curve /*icUInt8Number data[icAny]; Data follows see spec for size */} icLutBtoA;#ifdef __cplusplusextern "C" {#endif// Calling convention#ifdef NON_WINDOWS# define LCMSEXPORT# define LCMSAPI#else# ifdef LCMS_DLL# ifdef __BORLANDC__# define LCMSEXPORT __stdcall _export# define LCMSAPI# else // VC++# define LCMSEXPORT _stdcall# ifdef LCMS_DLL_BUILD# define LCMSAPI __declspec(dllexport)# else# define LCMSAPI __declspec(dllimport)# endif# endif# else# define LCMSEXPORT cdecl# define LCMSAPI# endif#endif#ifdef USE_ASSEMBLER#ifdef __BORLANDC__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -