📄 lcms.h
字号:
// Intents#define INTENT_PERCEPTUAL 0#define INTENT_RELATIVE_COLORIMETRIC 1#define INTENT_SATURATION 2#define INTENT_ABSOLUTE_COLORIMETRIC 3// Flags#define cmsFLAGS_MATRIXINPUT 0x0001#define cmsFLAGS_MATRIXOUTPUT 0x0002#define cmsFLAGS_MATRIXONLY (cmsFLAGS_MATRIXINPUT|cmsFLAGS_MATRIXOUTPUT)#define cmsFLAGS_NOWHITEONWHITEFIXUP 0x0004 // Don't hot fix scum dot #define cmsFLAGS_NOPRELINEARIZATION 0x0010 // Don't create prelinearization tables // on precalculated transforms (internal use)#define cmsFLAGS_GUESSDEVICECLASS 0x0020 // Guess device class (for transform2devicelink)#define cmsFLAGS_NOTCACHE 0x0040 // Inhibit 1-pixel cache#define cmsFLAGS_NOTPRECALC 0x0100 #define cmsFLAGS_NULLTRANSFORM 0x0200 // Don't transform anyway#define cmsFLAGS_HIGHRESPRECALC 0x0400 // Use more memory to give better accurancy#define cmsFLAGS_LOWRESPRECALC 0x0800 // Use less memory to minimize resouces#define cmsFLAGS_WHITEBLACKCOMPENSATION 0x2000 #define cmsFLAGS_BLACKPOINTCOMPENSATION cmsFLAGS_WHITEBLACKCOMPENSATION // Proofing flags#define cmsFLAGS_GAMUTCHECK 0x1000 // Out of Gamut alarm#define cmsFLAGS_SOFTPROOFING 0x4000 // Do softproofing// Black preservation#define cmsFLAGS_PRESERVEBLACK 0x8000 // CRD special#define cmsFLAGS_NODEFAULTRESOURCEDEF 0x00010000// Gridpoints#define cmsFLAGS_GRIDPOINTS(n) (((n) & 0xFF) << 16)// TransformsLCMSAPI cmsHTRANSFORM LCMSEXPORT cmsCreateTransform(cmsHPROFILE Input, DWORD InputFormat, cmsHPROFILE Output, DWORD OutputFormat, int Intent, DWORD dwFlags);LCMSAPI cmsHTRANSFORM LCMSEXPORT cmsCreateProofingTransform(cmsHPROFILE Input, DWORD InputFormat, cmsHPROFILE Output, DWORD OutputFormat, cmsHPROFILE Proofing, int Intent, int ProofingIntent, DWORD dwFlags);LCMSAPI cmsHTRANSFORM LCMSEXPORT cmsCreateMultiprofileTransform(cmsHPROFILE hProfiles[], int nProfiles, DWORD InputFormat, DWORD OutputFormat, int Intent, DWORD dwFlags);LCMSAPI void LCMSEXPORT cmsDeleteTransform(cmsHTRANSFORM hTransform);LCMSAPI void LCMSEXPORT cmsDoTransform(cmsHTRANSFORM Transform, LPVOID InputBuffer, LPVOID OutputBuffer, unsigned int Size);LCMSAPI void LCMSEXPORT cmsChangeBuffersFormat(cmsHTRANSFORM hTransform, DWORD InputFormat, DWORD dwOutputFormat);LCMSAPI void LCMSEXPORT cmsSetAlarmCodes(int r, int g, int b);LCMSAPI void LCMSEXPORT cmsGetAlarmCodes(int *r, int *g, int *b);// Adaptation state for absolute colorimetric intentLCMSAPI double LCMSEXPORT cmsSetAdaptationState(double d);// Named color supporttypedef struct { char Name[MAX_PATH]; WORD PCS[3]; WORD DeviceColorant[MAXCHANNELS]; } cmsNAMEDCOLOR, FAR* LPcmsNAMEDCOLOR;typedef struct { int nColors; int Allocated; int ColorantCount; char Prefix[33]; char Suffix[33]; cmsNAMEDCOLOR List[1]; } cmsNAMEDCOLORLIST, FAR* LPcmsNAMEDCOLORLIST;// Named color supportLCMSAPI int LCMSEXPORT cmsNamedColorCount(cmsHTRANSFORM xform);LCMSAPI BOOL LCMSEXPORT cmsNamedColorInfo(cmsHTRANSFORM xform, int nColor, char* Name, char* Prefix, char* Suffix);LCMSAPI int LCMSEXPORT cmsNamedColorIndex(cmsHTRANSFORM xform, const char* Name);// Colorant tablesLCMSAPI LPcmsNAMEDCOLORLIST LCMSEXPORT cmsReadColorantTable(cmsHPROFILE hProfile, icTagSignature sig);// Profile creation LCMSAPI BOOL LCMSEXPORT cmsAddTag(cmsHPROFILE hProfile, icTagSignature sig, void* data);// Converts a transform to a devicelink profileLCMSAPI cmsHPROFILE LCMSEXPORT cmsTransform2DeviceLink(cmsHTRANSFORM hTransform, DWORD dwFlags);// Set the 'save as 8-bit' flagLCMSAPI void LCMSEXPORT _cmsSetLUTdepth(cmsHPROFILE hProfile, int depth);// Save profileLCMSAPI BOOL LCMSEXPORT _cmsSaveProfile(cmsHPROFILE hProfile, const char* FileName);LCMSAPI BOOL LCMSEXPORT _cmsSaveProfileToMem(cmsHPROFILE hProfile, void *MemPtr, size_t* BytesNeeded);// PostScript ColorRenderingDictionary and ColorSpaceArrayLCMSAPI DWORD LCMSEXPORT cmsGetPostScriptCSA(cmsHPROFILE hProfile, int Intent, LPVOID Buffer, DWORD dwBufferLen);LCMSAPI DWORD LCMSEXPORT cmsGetPostScriptCRD(cmsHPROFILE hProfile, int Intent, LPVOID Buffer, DWORD dwBufferLen);LCMSAPI DWORD LCMSEXPORT cmsGetPostScriptCRDEx(cmsHPROFILE hProfile, int Intent, DWORD dwFlags, LPVOID Buffer, DWORD dwBufferLen);// Error handling#define LCMS_ERROR_ABORT 0#define LCMS_ERROR_SHOW 1#define LCMS_ERROR_IGNORE 2LCMSAPI int LCMSEXPORT cmsErrorAction(int nAction);#define LCMS_ERRC_WARNING 0x1000#define LCMS_ERRC_RECOVERABLE 0x2000#define LCMS_ERRC_ABORTED 0x3000typedef int (* cmsErrorHandlerFunction)(int ErrorCode, const char *ErrorText);LCMSAPI void LCMSEXPORT cmsSetErrorHandler(cmsErrorHandlerFunction Fn);// LUT manipulationtypedef struct _lcms_LUT_struc LUT, FAR* LPLUT; // opaque pointerLCMSAPI LPLUT LCMSEXPORT cmsAllocLUT(void);LCMSAPI LPLUT LCMSEXPORT cmsAllocLinearTable(LPLUT NewLUT, LPGAMMATABLE Tables[], int nTable);LCMSAPI LPLUT LCMSEXPORT cmsAlloc3DGrid(LPLUT Lut, int clutPoints, int inputChan, int outputChan);LCMSAPI LPLUT LCMSEXPORT cmsSetMatrixLUT(LPLUT Lut, LPMAT3 M);LCMSAPI LPLUT LCMSEXPORT cmsSetMatrixLUT4(LPLUT Lut, LPMAT3 M, LPVEC3 off, DWORD dwFlags);LCMSAPI void LCMSEXPORT cmsFreeLUT(LPLUT Lut);LCMSAPI void LCMSEXPORT cmsEvalLUT(LPLUT Lut, WORD In[], WORD Out[]);LCMSAPI double LCMSEXPORT cmsEvalLUTreverse(LPLUT Lut, WORD Target[], WORD Result[], LPWORD Hint);LCMSAPI LPLUT LCMSEXPORT cmsReadICCLut(cmsHPROFILE hProfile, icTagSignature sig);LCMSAPI LPLUT LCMSEXPORT cmsDupLUT(LPLUT Orig);// LUT Samplingtypedef int (* _cmsSAMPLER)(register WORD In[], register WORD Out[], register LPVOID Cargo);#define SAMPLER_HASTL1 LUT_HASTL1#define SAMPLER_HASTL2 LUT_HASTL2#define SAMPLER_INSPECT 0x01000000LCMSAPI int LCMSEXPORT cmsSample3DGrid(LPLUT Lut, _cmsSAMPLER Sampler, LPVOID Cargo, DWORD dwFlags);// Formatterstypedef unsigned char* (* cmsFORMATTER)(register void* CMMcargo, register WORD ToUnroll[], register LPBYTE Buffer);LCMSAPI void LCMSEXPORT cmsSetUserFormatters(cmsHTRANSFORM hTransform, DWORD dwInput, cmsFORMATTER Input, DWORD dwOutput, cmsFORMATTER Output);LCMSAPI void LCMSEXPORT cmsGetUserFormatters(cmsHTRANSFORM hTransform, LPDWORD InputFormat, cmsFORMATTER* Input, LPDWORD OutputFormat, cmsFORMATTER* Output);// IT8.7 / CGATS.17-200x handlingLCMSAPI LCMSHANDLE LCMSEXPORT cmsIT8Alloc(void);LCMSAPI void LCMSEXPORT cmsIT8Free(LCMSHANDLE IT8);// TablesLCMSAPI int LCMSEXPORT cmsIT8TableCount(LCMSHANDLE IT8);LCMSAPI int LCMSEXPORT cmsIT8SetTable(LCMSHANDLE IT8, int nTable);// PersistenceLCMSAPI LCMSHANDLE LCMSEXPORT cmsIT8LoadFromFile(const char* cFileName);LCMSAPI LCMSHANDLE LCMSEXPORT cmsIT8LoadFromMem(void *Ptr, size_t len);LCMSAPI BOOL LCMSEXPORT cmsIT8SaveToFile(LCMSHANDLE IT8, const char* cFileName);LCMSAPI BOOL LCMSEXPORT cmsIT8SaveToMem(LCMSHANDLE hIT8, void *MemPtr, size_t* BytesNeeded);// PropertiesLCMSAPI const char* LCMSEXPORT cmsIT8GetSheetType(LCMSHANDLE hIT8);LCMSAPI BOOL LCMSEXPORT cmsIT8SetSheetType(LCMSHANDLE hIT8, const char* Type);LCMSAPI BOOL LCMSEXPORT cmsIT8SetComment(LCMSHANDLE hIT8, const char* cComment);LCMSAPI BOOL LCMSEXPORT cmsIT8SetPropertyStr(LCMSHANDLE hIT8, const char* cProp, const char *Str);LCMSAPI BOOL LCMSEXPORT cmsIT8SetPropertyDbl(LCMSHANDLE hIT8, const char* cProp, double Val);LCMSAPI BOOL LCMSEXPORT cmsIT8SetPropertyHex(LCMSHANDLE hIT8, const char* cProp, int Val);LCMSAPI BOOL LCMSEXPORT cmsIT8SetPropertyUncooked(LCMSHANDLE hIT8, const char* Key, const char* Buffer);LCMSAPI const char* LCMSEXPORT cmsIT8GetProperty(LCMSHANDLE hIT8, const char* cProp);LCMSAPI double LCMSEXPORT cmsIT8GetPropertyDbl(LCMSHANDLE hIT8, const char* cProp);LCMSAPI int LCMSEXPORT cmsIT8EnumProperties(LCMSHANDLE IT8, char ***PropertyNames);// DatasetsLCMSAPI const char* LCMSEXPORT cmsIT8GetDataRowCol(LCMSHANDLE IT8, int row, int col); LCMSAPI double LCMSEXPORT cmsIT8GetDataRowColDbl(LCMSHANDLE IT8, int row, int col);LCMSAPI BOOL LCMSEXPORT cmsIT8SetDataRowCol(LCMSHANDLE hIT8, int row, int col, const char* Val);LCMSAPI BOOL LCMSEXPORT cmsIT8SetDataRowColDbl(LCMSHANDLE hIT8, int row, int col, double Val);LCMSAPI const char* LCMSEXPORT cmsIT8GetData(LCMSHANDLE IT8, const char* cPatch, const char* cSample); LCMSAPI double LCMSEXPORT cmsIT8GetDataDbl(LCMSHANDLE IT8, const char* cPatch, const char* cSample);LCMSAPI BOOL LCMSEXPORT cmsIT8SetData(LCMSHANDLE IT8, const char* cPatch, const char* cSample, const char *Val);LCMSAPI BOOL LCMSEXPORT cmsIT8SetDataDbl(LCMSHANDLE hIT8, const char* cPatch, const char* cSample, double Val);LCMSAPI int LCMSEXPORT cmsIT8GetDataFormat(LCMSHANDLE hIT8, const char* cSample);LCMSAPI BOOL LCMSEXPORT cmsIT8SetDataFormat(LCMSHANDLE IT8, int n, const char *Sample);LCMSAPI int LCMSEXPORT cmsIT8EnumDataFormat(LCMSHANDLE IT8, char ***SampleNames);LCMSAPI const char* LCMSEXPORT cmsIT8GetPatchName(LCMSHANDLE hIT8, int nPatch, char* buffer);// The LABEL extensionLCMSAPI int LCMSEXPORT cmsIT8SetTableByLabel(LCMSHANDLE hIT8, const char* cSet, const char* cField, const char* ExpectedType);// Formatter for doubleLCMSAPI void LCMSEXPORT cmsIT8DefineDblFormat(LCMSHANDLE IT8, const char* Formatter);// ***************************************************************************// End of Little cms API From here functions are private// You can use them only if using static libraries, and at your own risk of// be stripped or changed at futures releases.#ifndef LCMS_APIONLY// Compatibility with anterior versions-- not needed anymore// -- MorgeLCMSAPI void LCMSEXPORT cmsLabEncoded2Float(LPcmsCIELab Lab, const WORD wLab[3]);LCMSAPI void LCMSEXPORT cmsLabEncoded2Float4(LPcmsCIELab Lab, const WORD wLab[3]);LCMSAPI void LCMSEXPORT cmsFloat2LabEncoded(WORD wLab[3], const cmsCIELab* Lab);LCMSAPI void LCMSEXPORT cmsFloat2LabEncoded4(WORD wLab[3], const cmsCIELab* Lab);LCMSAPI void LCMSEXPORT cmsXYZEncoded2Float(LPcmsCIEXYZ fxyz, const WORD XYZ[3]);LCMSAPI void LCMSEXPORT cmsFloat2XYZEncoded(WORD XYZ[3], const cmsCIEXYZ* fXYZ);// Profiling Extensions --- Would be removed from API in future revisionsLCMSAPI BOOL LCMSEXPORT _cmsAddTextTag(cmsHPROFILE hProfile, icTagSignature sig, const char* Text);LCMSAPI BOOL LCMSEXPORT _cmsAddXYZTag(cmsHPROFILE hProfile, icTagSignature sig, const cmsCIEXYZ* XYZ);LCMSAPI BOOL LCMSEXPORT _cmsAddLUTTag(cmsHPROFILE hProfile, icTagSignature sig, void* lut);LCMSAPI BOOL LCMSEXPORT _cmsAddGammaTag(cmsHPROFILE hProfile, icTagSignature sig, LPGAMMATABLE TransferFunction);LCMSAPI BOOL LCMSEXPORT _cmsAddChromaticityTag(cmsHPROFILE hProfile, icTagSignature sig, LPcmsCIExyYTRIPLE Chrm);LCMSAPI BOOL LCMSEXPORT _cmsAddSequenceDescriptionTag(cmsHPROFILE hProfile, icTagSignature sig, LPcmsSEQ PSeq);LCMSAPI BOOL LCMSEXPORT _cmsAddNamedColorTag(cmsHPROFILE hProfile, icTagSignature sig, LPcmsNAMEDCOLORLIST nc);LCMSAPI BOOL LCMSEXPORT _cmsAddDateTimeTag(cmsHPROFILE hProfile, icTagSignature sig, struct tm *DateTime);LCMSAPI BOOL LCMSEXPORT _cmsAddColorantTableTag(cmsHPROFILE hProfile, icTagSignature sig, LPcmsNAMEDCOLORLIST nc);// --------------------------------------------------------------------------------------------------- Inline functions// Fast floor conversion logic. Thanks to Sree Kotay and Stuart Nixon // note than this only works in the range ..-32767...+32767 because // mantissa is interpreted as 15.16 fixed point.// The union is to avoid pointer aliasing overoptimization.LCMS_INLINE int _cmsQuickFloor(double val){#if USE_DEFAULT_FLOOR_CONVERSION return (int) floor(val);#else const double _lcms_double2fixmagic = 68719476736.0 * 1.5; // 2^36 * 1.5, (52-16=36) uses limited precision to floor union { double val; int halves[2]; } temp; temp.val = val + _lcms_double2fixmagic; #if USE_BIG_ENDIAN return temp.halves[1] >> 16;#else return temp.halves[0] >> 16;#endif#endif}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -