Path: blob/master/src/java.desktop/share/native/liblcms/lcms2_plugin.h
41149 views
/*1* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.2*3* This code is free software; you can redistribute it and/or modify it4* under the terms of the GNU General Public License version 2 only, as5* published by the Free Software Foundation. Oracle designates this6* particular file as subject to the "Classpath" exception as provided7* by Oracle in the LICENSE file that accompanied this code.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 2 along with this work; if not, write to the Free Software Foundation,17* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18*19* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*/2324// This file is available under and governed by the GNU General Public25// License version 2 only, as published by the Free Software Foundation.26// However, the following notice accompanied the original version of this27// file:28//29//---------------------------------------------------------------------------------30//31// Little Color Management System32// Copyright (c) 1998-2020 Marti Maria Saguer33//34// Permission is hereby granted, free of charge, to any person obtaining35// a copy of this software and associated documentation files (the "Software"),36// to deal in the Software without restriction, including without limitation37// the rights to use, copy, modify, merge, publish, distribute, sublicense,38// and/or sell copies of the Software, and to permit persons to whom the Software39// is furnished to do so, subject to the following conditions:40//41// The above copyright notice and this permission notice shall be included in42// all copies or substantial portions of the Software.43//44// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,45// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO46// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND47// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE48// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION49// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION50// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.51//52//---------------------------------------------------------------------------------53//54// This is the plug-in header file. Normal LittleCMS clients should not use it.55// It is provided for plug-in writters that may want to access the support56// functions to do low level operations. All plug-in related structures57// are defined here. Including this file forces to include the standard API too.5859#ifndef _lcms_plugin_H6061// Deal with Microsoft's attempt at deprecating C standard runtime functions62#ifdef _MSC_VER63# if (_MSC_VER >= 1400)64# ifndef _CRT_SECURE_NO_DEPRECATE65# define _CRT_SECURE_NO_DEPRECATE66# endif67# ifndef _CRT_SECURE_NO_WARNINGS68# define _CRT_SECURE_NO_WARNINGS69# endif70# endif71#endif7273#ifndef _lcms2_H74#include "lcms2.h"75#endif7677// We need some standard C functions.78#include <stdlib.h>79#include <math.h>80#include <stdarg.h>81#include <memory.h>82#include <string.h>838485#ifndef CMS_USE_CPP_API86# ifdef __cplusplus87extern "C" {88# endif89#endif9091// Vector & Matrix operations -----------------------------------------------------------------------9293// Axis of the matrix/array. No specific meaning at all.94#define VX 095#define VY 196#define VZ 29798// Vectors99typedef struct {100cmsFloat64Number n[3];101102} cmsVEC3;103104// 3x3 Matrix105typedef struct {106cmsVEC3 v[3];107108} cmsMAT3;109110CMSAPI void CMSEXPORT _cmsVEC3init(cmsVEC3* r, cmsFloat64Number x, cmsFloat64Number y, cmsFloat64Number z);111CMSAPI void CMSEXPORT _cmsVEC3minus(cmsVEC3* r, const cmsVEC3* a, const cmsVEC3* b);112CMSAPI void CMSEXPORT _cmsVEC3cross(cmsVEC3* r, const cmsVEC3* u, const cmsVEC3* v);113CMSAPI cmsFloat64Number CMSEXPORT _cmsVEC3dot(const cmsVEC3* u, const cmsVEC3* v);114CMSAPI cmsFloat64Number CMSEXPORT _cmsVEC3length(const cmsVEC3* a);115CMSAPI cmsFloat64Number CMSEXPORT _cmsVEC3distance(const cmsVEC3* a, const cmsVEC3* b);116117CMSAPI void CMSEXPORT _cmsMAT3identity(cmsMAT3* a);118CMSAPI cmsBool CMSEXPORT _cmsMAT3isIdentity(const cmsMAT3* a);119CMSAPI void CMSEXPORT _cmsMAT3per(cmsMAT3* r, const cmsMAT3* a, const cmsMAT3* b);120CMSAPI cmsBool CMSEXPORT _cmsMAT3inverse(const cmsMAT3* a, cmsMAT3* b);121CMSAPI cmsBool CMSEXPORT _cmsMAT3solve(cmsVEC3* x, cmsMAT3* a, cmsVEC3* b);122CMSAPI void CMSEXPORT _cmsMAT3eval(cmsVEC3* r, const cmsMAT3* a, const cmsVEC3* v);123124125// MD5 low level -------------------------------------------------------------------------------------126127CMSAPI cmsHANDLE CMSEXPORT cmsMD5alloc(cmsContext ContextID);128CMSAPI void CMSEXPORT cmsMD5add(cmsHANDLE Handle, const cmsUInt8Number* buf, cmsUInt32Number len);129CMSAPI void CMSEXPORT cmsMD5finish(cmsProfileID* ProfileID, cmsHANDLE Handle);130131// Error logging -------------------------------------------------------------------------------------132133CMSAPI void CMSEXPORT cmsSignalError(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *ErrorText, ...);134135// Memory management ----------------------------------------------------------------------------------136137CMSAPI void* CMSEXPORT _cmsMalloc(cmsContext ContextID, cmsUInt32Number size);138CMSAPI void* CMSEXPORT _cmsMallocZero(cmsContext ContextID, cmsUInt32Number size);139CMSAPI void* CMSEXPORT _cmsCalloc(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size);140CMSAPI void* CMSEXPORT _cmsRealloc(cmsContext ContextID, void* Ptr, cmsUInt32Number NewSize);141CMSAPI void CMSEXPORT _cmsFree(cmsContext ContextID, void* Ptr);142CMSAPI void* CMSEXPORT _cmsDupMem(cmsContext ContextID, const void* Org, cmsUInt32Number size);143144// I/O handler ----------------------------------------------------------------------------------145146struct _cms_io_handler {147148void* stream; // Associated stream, which is implemented differently depending on media.149150cmsContext ContextID;151cmsUInt32Number UsedSpace;152cmsUInt32Number ReportedSize;153char PhysicalFile[cmsMAX_PATH];154155cmsUInt32Number (* Read)(struct _cms_io_handler* iohandler, void *Buffer,156cmsUInt32Number size,157cmsUInt32Number count);158cmsBool (* Seek)(struct _cms_io_handler* iohandler, cmsUInt32Number offset);159cmsBool (* Close)(struct _cms_io_handler* iohandler);160cmsUInt32Number (* Tell)(struct _cms_io_handler* iohandler);161cmsBool (* Write)(struct _cms_io_handler* iohandler, cmsUInt32Number size,162const void* Buffer);163};164165// Endianness adjust functions166CMSAPI cmsUInt16Number CMSEXPORT _cmsAdjustEndianess16(cmsUInt16Number Word);167CMSAPI cmsUInt32Number CMSEXPORT _cmsAdjustEndianess32(cmsUInt32Number Value);168CMSAPI void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord);169170// Helper IO functions171CMSAPI cmsBool CMSEXPORT _cmsReadUInt8Number(cmsIOHANDLER* io, cmsUInt8Number* n);172CMSAPI cmsBool CMSEXPORT _cmsReadUInt16Number(cmsIOHANDLER* io, cmsUInt16Number* n);173CMSAPI cmsBool CMSEXPORT _cmsReadUInt32Number(cmsIOHANDLER* io, cmsUInt32Number* n);174CMSAPI cmsBool CMSEXPORT _cmsReadFloat32Number(cmsIOHANDLER* io, cmsFloat32Number* n);175CMSAPI cmsBool CMSEXPORT _cmsReadUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n);176CMSAPI cmsBool CMSEXPORT _cmsRead15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number* n);177CMSAPI cmsBool CMSEXPORT _cmsReadXYZNumber(cmsIOHANDLER* io, cmsCIEXYZ* XYZ);178CMSAPI cmsBool CMSEXPORT _cmsReadUInt16Array(cmsIOHANDLER* io, cmsUInt32Number n, cmsUInt16Number* Array);179180CMSAPI cmsBool CMSEXPORT _cmsWriteUInt8Number(cmsIOHANDLER* io, cmsUInt8Number n);181CMSAPI cmsBool CMSEXPORT _cmsWriteUInt16Number(cmsIOHANDLER* io, cmsUInt16Number n);182CMSAPI cmsBool CMSEXPORT _cmsWriteUInt32Number(cmsIOHANDLER* io, cmsUInt32Number n);183CMSAPI cmsBool CMSEXPORT _cmsWriteFloat32Number(cmsIOHANDLER* io, cmsFloat32Number n);184CMSAPI cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n);185CMSAPI cmsBool CMSEXPORT _cmsWrite15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number n);186CMSAPI cmsBool CMSEXPORT _cmsWriteXYZNumber(cmsIOHANDLER* io, const cmsCIEXYZ* XYZ);187CMSAPI cmsBool CMSEXPORT _cmsWriteUInt16Array(cmsIOHANDLER* io, cmsUInt32Number n, const cmsUInt16Number* Array);188189// ICC base tag190typedef struct {191cmsTagTypeSignature sig;192cmsInt8Number reserved[4];193194} _cmsTagBase;195196// Type base helper functions197CMSAPI cmsTagTypeSignature CMSEXPORT _cmsReadTypeBase(cmsIOHANDLER* io);198CMSAPI cmsBool CMSEXPORT _cmsWriteTypeBase(cmsIOHANDLER* io, cmsTagTypeSignature sig);199200// Alignment functions201CMSAPI cmsBool CMSEXPORT _cmsReadAlignment(cmsIOHANDLER* io);202CMSAPI cmsBool CMSEXPORT _cmsWriteAlignment(cmsIOHANDLER* io);203204// To deal with text streams. 2K at most205CMSAPI cmsBool CMSEXPORT _cmsIOPrintf(cmsIOHANDLER* io, const char* frm, ...);206207// Fixed point helper functions208CMSAPI cmsFloat64Number CMSEXPORT _cms8Fixed8toDouble(cmsUInt16Number fixed8);209CMSAPI cmsUInt16Number CMSEXPORT _cmsDoubleTo8Fixed8(cmsFloat64Number val);210211CMSAPI cmsFloat64Number CMSEXPORT _cms15Fixed16toDouble(cmsS15Fixed16Number fix32);212CMSAPI cmsS15Fixed16Number CMSEXPORT _cmsDoubleTo15Fixed16(cmsFloat64Number v);213214// Date/time helper functions215CMSAPI void CMSEXPORT _cmsEncodeDateTimeNumber(cmsDateTimeNumber *Dest, const struct tm *Source);216CMSAPI void CMSEXPORT _cmsDecodeDateTimeNumber(const cmsDateTimeNumber *Source, struct tm *Dest);217218//----------------------------------------------------------------------------------------------------------219220// Shared callbacks for user data221typedef void (* _cmsFreeUserDataFn)(cmsContext ContextID, void* Data);222typedef void* (* _cmsDupUserDataFn)(cmsContext ContextID, const void* Data);223224//----------------------------------------------------------------------------------------------------------225226// Plug-in foundation227#define cmsPluginMagicNumber 0x61637070 // 'acpp'228229#define cmsPluginMemHandlerSig 0x6D656D48 // 'memH'230#define cmsPluginInterpolationSig 0x696E7048 // 'inpH'231#define cmsPluginParametricCurveSig 0x70617248 // 'parH'232#define cmsPluginFormattersSig 0x66726D48 // 'frmH233#define cmsPluginTagTypeSig 0x74797048 // 'typH'234#define cmsPluginTagSig 0x74616748 // 'tagH'235#define cmsPluginRenderingIntentSig 0x696E7448 // 'intH'236#define cmsPluginMultiProcessElementSig 0x6D706548 // 'mpeH'237#define cmsPluginOptimizationSig 0x6F707448 // 'optH'238#define cmsPluginTransformSig 0x7A666D48 // 'xfmH'239#define cmsPluginMutexSig 0x6D747A48 // 'mtxH'240241typedef struct _cmsPluginBaseStruct {242243cmsUInt32Number Magic; // 'acpp' signature244cmsUInt32Number ExpectedVersion; // Expected version of LittleCMS245cmsUInt32Number Type; // Type of plug-in246struct _cmsPluginBaseStruct* Next; // For multiple plugin definition. NULL for end of list.247248} cmsPluginBase;249250// Maximum number of types in a plugin array251#define MAX_TYPES_IN_LCMS_PLUGIN 20252253//----------------------------------------------------------------------------------------------------------254255// Memory handler. Each new plug-in type replaces current behaviour256257typedef void* (* _cmsMallocFnPtrType)(cmsContext ContextID, cmsUInt32Number size);258typedef void (* _cmsFreeFnPtrType)(cmsContext ContextID, void *Ptr);259typedef void* (* _cmsReallocFnPtrType)(cmsContext ContextID, void* Ptr, cmsUInt32Number NewSize);260261typedef void* (* _cmsMalloZerocFnPtrType)(cmsContext ContextID, cmsUInt32Number size);262typedef void* (* _cmsCallocFnPtrType)(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size);263typedef void* (* _cmsDupFnPtrType)(cmsContext ContextID, const void* Org, cmsUInt32Number size);264265typedef struct {266267cmsPluginBase base;268269// Required270_cmsMallocFnPtrType MallocPtr;271_cmsFreeFnPtrType FreePtr;272_cmsReallocFnPtrType ReallocPtr;273274// Optional275_cmsMalloZerocFnPtrType MallocZeroPtr;276_cmsCallocFnPtrType CallocPtr;277_cmsDupFnPtrType DupPtr;278279} cmsPluginMemHandler;280281282// ------------------------------------------------------------------------------------------------------------------283284// Interpolation. 16 bits and floating point versions.285struct _cms_interp_struc;286287// Interpolation callbacks288289// 16 bits forward interpolation. This function performs precision-limited linear interpolation290// and is supposed to be quite fast. Implementation may be tetrahedral or trilinear, and plug-ins may291// choose to implement any other interpolation algorithm.292typedef void (* _cmsInterpFn16)(CMSREGISTER const cmsUInt16Number Input[],293CMSREGISTER cmsUInt16Number Output[],294CMSREGISTER const struct _cms_interp_struc* p);295296// Floating point forward interpolation. Full precision interpolation using floats. This is not a297// time critical function. Implementation may be tetrahedral or trilinear, and plug-ins may298// choose to implement any other interpolation algorithm.299typedef void (* _cmsInterpFnFloat)(cmsFloat32Number const Input[],300cmsFloat32Number Output[],301const struct _cms_interp_struc* p);302303304305// This type holds a pointer to an interpolator that can be either 16 bits or float306typedef union {307_cmsInterpFn16 Lerp16; // Forward interpolation in 16 bits308_cmsInterpFnFloat LerpFloat; // Forward interpolation in floating point309} cmsInterpFunction;310311// Flags for interpolator selection312#define CMS_LERP_FLAGS_16BITS 0x0000 // The default313#define CMS_LERP_FLAGS_FLOAT 0x0001 // Requires different implementation314#define CMS_LERP_FLAGS_TRILINEAR 0x0100 // Hint only315316317#define MAX_INPUT_DIMENSIONS 15318319typedef struct _cms_interp_struc { // Used on all interpolations. Supplied by lcms2 when calling the interpolation function320321cmsContext ContextID; // The calling thread322323cmsUInt32Number dwFlags; // Keep original flags324cmsUInt32Number nInputs; // != 1 only in 3D interpolation325cmsUInt32Number nOutputs; // != 1 only in 3D interpolation326327cmsUInt32Number nSamples[MAX_INPUT_DIMENSIONS]; // Valid on all kinds of tables328cmsUInt32Number Domain[MAX_INPUT_DIMENSIONS]; // Domain = nSamples - 1329330cmsUInt32Number opta[MAX_INPUT_DIMENSIONS]; // Optimization for 3D CLUT. This is the number of nodes premultiplied for each331// dimension. For example, in 7 nodes, 7, 7^2 , 7^3, 7^4, etc. On non-regular332// Samplings may vary according of the number of nodes for each dimension.333334const void *Table; // Points to the actual interpolation table335cmsInterpFunction Interpolation; // Points to the function to do the interpolation336337} cmsInterpParams;338339// Interpolators factory340typedef cmsInterpFunction (* cmsInterpFnFactory)(cmsUInt32Number nInputChannels, cmsUInt32Number nOutputChannels, cmsUInt32Number dwFlags);341342// The plug-in343typedef struct {344cmsPluginBase base;345346// Points to a user-supplied function which implements the factory347cmsInterpFnFactory InterpolatorsFactory;348349} cmsPluginInterpolation;350351//----------------------------------------------------------------------------------------------------------352353// Parametric curves. A negative type means same function but analytically inverted. Max. number of params is 10354355// Evaluator callback for user-supplied parametric curves. May implement more than one type356typedef cmsFloat64Number (* cmsParametricCurveEvaluator)(cmsInt32Number Type, const cmsFloat64Number Params[10], cmsFloat64Number R);357358// Plug-in may implement an arbitrary number of parametric curves359typedef struct {360cmsPluginBase base;361362cmsUInt32Number nFunctions; // Number of supported functions363cmsUInt32Number FunctionTypes[MAX_TYPES_IN_LCMS_PLUGIN]; // The identification types364cmsUInt32Number ParameterCount[MAX_TYPES_IN_LCMS_PLUGIN]; // Number of parameters for each function365366cmsParametricCurveEvaluator Evaluator; // The evaluator367368} cmsPluginParametricCurves;369//----------------------------------------------------------------------------------------------------------370371// Formatters. This plug-in adds new handlers, replacing them if they already exist. Formatters dealing with372// cmsFloat32Number (bps = 4) or double (bps = 0) types are requested via FormatterFloat callback. Others come across373// Formatter16 callback374375struct _cmstransform_struct;376377typedef cmsUInt8Number* (* cmsFormatter16)(CMSREGISTER struct _cmstransform_struct* CMMcargo,378CMSREGISTER cmsUInt16Number Values[],379CMSREGISTER cmsUInt8Number* Buffer,380CMSREGISTER cmsUInt32Number Stride);381382typedef cmsUInt8Number* (* cmsFormatterFloat)(struct _cmstransform_struct* CMMcargo,383cmsFloat32Number Values[],384cmsUInt8Number* Buffer,385cmsUInt32Number Stride);386387// This type holds a pointer to a formatter that can be either 16 bits or cmsFloat32Number388typedef union {389cmsFormatter16 Fmt16;390cmsFormatterFloat FmtFloat;391392} cmsFormatter;393394#define CMS_PACK_FLAGS_16BITS 0x0000395#define CMS_PACK_FLAGS_FLOAT 0x0001396397typedef enum { cmsFormatterInput=0, cmsFormatterOutput=1 } cmsFormatterDirection;398399typedef cmsFormatter (* cmsFormatterFactory)(cmsUInt32Number Type, // Specific type, i.e. TYPE_RGB_8400cmsFormatterDirection Dir,401cmsUInt32Number dwFlags); // precision402403// Plug-in may implement an arbitrary number of formatters404typedef struct {405cmsPluginBase base;406cmsFormatterFactory FormattersFactory;407408} cmsPluginFormatters;409410//----------------------------------------------------------------------------------------------------------411412// Tag type handler. Each type is free to return anything it wants, and it is up to the caller to413// know in advance what is the type contained in the tag.414typedef struct _cms_typehandler_struct {415416cmsTagTypeSignature Signature; // The signature of the type417418// Allocates and reads items419void * (* ReadPtr)(struct _cms_typehandler_struct* self,420cmsIOHANDLER* io,421cmsUInt32Number* nItems,422cmsUInt32Number SizeOfTag);423424// Writes n Items425cmsBool (* WritePtr)(struct _cms_typehandler_struct* self,426cmsIOHANDLER* io,427void* Ptr,428cmsUInt32Number nItems);429430// Duplicate an item or array of items431void* (* DupPtr)(struct _cms_typehandler_struct* self,432const void *Ptr,433cmsUInt32Number n);434435// Free all resources436void (* FreePtr)(struct _cms_typehandler_struct* self,437void *Ptr);438439// Additional parameters used by the calling thread440cmsContext ContextID;441cmsUInt32Number ICCVersion;442443} cmsTagTypeHandler;444445// Each plug-in implements a single type446typedef struct {447cmsPluginBase base;448cmsTagTypeHandler Handler;449450} cmsPluginTagType;451452//----------------------------------------------------------------------------------------------------------453454// This is the tag plugin, which identifies tags. For writing, a pointer to function is provided.455// This function should return the desired type for this tag, given the version of profile456// and the data being serialized.457typedef struct {458459cmsUInt32Number ElemCount; // If this tag needs an array, how many elements should keep460461// For reading.462cmsUInt32Number nSupportedTypes; // In how many types this tag can come (MAX_TYPES_IN_LCMS_PLUGIN maximum)463cmsTagTypeSignature SupportedTypes[MAX_TYPES_IN_LCMS_PLUGIN];464465// For writing466cmsTagTypeSignature (* DecideType)(cmsFloat64Number ICCVersion, const void *Data);467468} cmsTagDescriptor;469470// Plug-in implements a single tag471typedef struct {472cmsPluginBase base;473474cmsTagSignature Signature;475cmsTagDescriptor Descriptor;476477} cmsPluginTag;478479//----------------------------------------------------------------------------------------------------------480481// Custom intents. This function should join all profiles specified in the array in482// a single LUT. Any custom intent in the chain redirects to custom function. If more than483// one custom intent is found, the one located first is invoked. Usually users should use only one484// custom intent, so mixing custom intents in same multiprofile transform is not supported.485486typedef cmsPipeline* (* cmsIntentFn)( cmsContext ContextID,487cmsUInt32Number nProfiles,488cmsUInt32Number Intents[],489cmsHPROFILE hProfiles[],490cmsBool BPC[],491cmsFloat64Number AdaptationStates[],492cmsUInt32Number dwFlags);493494495// Each plug-in defines a single intent number.496typedef struct {497cmsPluginBase base;498cmsUInt32Number Intent;499cmsIntentFn Link;500char Description[256];501502} cmsPluginRenderingIntent;503504505// The default ICC intents (perceptual, saturation, rel.col and abs.col)506CMSAPI cmsPipeline* CMSEXPORT _cmsDefaultICCintents(cmsContext ContextID,507cmsUInt32Number nProfiles,508cmsUInt32Number Intents[],509cmsHPROFILE hProfiles[],510cmsBool BPC[],511cmsFloat64Number AdaptationStates[],512cmsUInt32Number dwFlags);513514515//----------------------------------------------------------------------------------------------------------516517// Pipelines, Multi Process Elements.518519typedef void (* _cmsStageEvalFn) (const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsStage* mpe);520typedef void*(* _cmsStageDupElemFn) (cmsStage* mpe);521typedef void (* _cmsStageFreeElemFn) (cmsStage* mpe);522523524// This function allocates a generic MPE525CMSAPI cmsStage* CMSEXPORT _cmsStageAllocPlaceholder(cmsContext ContextID,526cmsStageSignature Type,527cmsUInt32Number InputChannels,528cmsUInt32Number OutputChannels,529_cmsStageEvalFn EvalPtr, // Points to fn that evaluates the element (always in floating point)530_cmsStageDupElemFn DupElemPtr, // Points to a fn that duplicates the stage531_cmsStageFreeElemFn FreePtr, // Points to a fn that sets the element free532void* Data); // A generic pointer to whatever memory needed by the element533typedef struct {534cmsPluginBase base;535cmsTagTypeHandler Handler;536537} cmsPluginMultiProcessElement;538539540// Data kept in "Element" member of cmsStage541542// Curves543typedef struct {544cmsUInt32Number nCurves;545cmsToneCurve** TheCurves;546547} _cmsStageToneCurvesData;548549// Matrix550typedef struct {551cmsFloat64Number* Double; // floating point for the matrix552cmsFloat64Number* Offset; // The offset553554} _cmsStageMatrixData;555556// CLUT557typedef struct {558559union { // Can have only one of both representations at same time560cmsUInt16Number* T; // Points to the table 16 bits table561cmsFloat32Number* TFloat; // Points to the cmsFloat32Number table562563} Tab;564565cmsInterpParams* Params;566cmsUInt32Number nEntries;567cmsBool HasFloatValues;568569} _cmsStageCLutData;570571572//----------------------------------------------------------------------------------------------------------573// Optimization. Using this plug-in, additional optimization strategies may be implemented.574// The function should return TRUE if any optimization is done on the LUT, this terminates575// the optimization search. Or FALSE if it is unable to optimize and want to give a chance576// to the rest of optimizers.577578typedef cmsBool (* _cmsOPToptimizeFn)(cmsPipeline** Lut,579cmsUInt32Number Intent,580cmsUInt32Number* InputFormat,581cmsUInt32Number* OutputFormat,582cmsUInt32Number* dwFlags);583584// Pipeline Evaluator (in 16 bits)585typedef void (* _cmsPipelineEval16Fn)(CMSREGISTER const cmsUInt16Number In[],586CMSREGISTER cmsUInt16Number Out[],587const void* Data);588589// Pipeline Evaluator (in floating point)590typedef void (* _cmsPipelineEvalFloatFn)(const cmsFloat32Number In[],591cmsFloat32Number Out[],592const void* Data);593594595// This function may be used to set the optional evaluator and a block of private data. If private data is being used, an optional596// duplicator and free functions should also be specified in order to duplicate the LUT construct. Use NULL to inhibit such functionality.597598CMSAPI void CMSEXPORT _cmsPipelineSetOptimizationParameters(cmsPipeline* Lut,599_cmsPipelineEval16Fn Eval16,600void* PrivateData,601_cmsFreeUserDataFn FreePrivateDataFn,602_cmsDupUserDataFn DupPrivateDataFn);603604typedef struct {605cmsPluginBase base;606607// Optimize entry point608_cmsOPToptimizeFn OptimizePtr;609610} cmsPluginOptimization;611612//----------------------------------------------------------------------------------------------------------613// Full xform614615typedef struct {616cmsUInt32Number BytesPerLineIn;617cmsUInt32Number BytesPerLineOut;618cmsUInt32Number BytesPerPlaneIn;619cmsUInt32Number BytesPerPlaneOut;620621} cmsStride;622623typedef void (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo, // Legacy function, handles just ONE scanline.624const void* InputBuffer,625void* OutputBuffer,626cmsUInt32Number Size,627cmsUInt32Number Stride); // Stride in bytes to the next plana in planar formats628629630typedef void (*_cmsTransform2Fn)(struct _cmstransform_struct *CMMcargo,631const void* InputBuffer,632void* OutputBuffer,633cmsUInt32Number PixelsPerLine,634cmsUInt32Number LineCount,635const cmsStride* Stride);636637typedef cmsBool (* _cmsTransformFactory)(_cmsTransformFn* xform,638void** UserData,639_cmsFreeUserDataFn* FreePrivateDataFn,640cmsPipeline** Lut,641cmsUInt32Number* InputFormat,642cmsUInt32Number* OutputFormat,643cmsUInt32Number* dwFlags);644645typedef cmsBool (* _cmsTransform2Factory)(_cmsTransform2Fn* xform,646void** UserData,647_cmsFreeUserDataFn* FreePrivateDataFn,648cmsPipeline** Lut,649cmsUInt32Number* InputFormat,650cmsUInt32Number* OutputFormat,651cmsUInt32Number* dwFlags);652653654// Retrieve user data as specified by the factory655CMSAPI void CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn);656CMSAPI void * CMSEXPORT _cmsGetTransformUserData(struct _cmstransform_struct *CMMcargo);657658659// Retrieve formatters660CMSAPI void CMSEXPORT _cmsGetTransformFormatters16 (struct _cmstransform_struct *CMMcargo, cmsFormatter16* FromInput, cmsFormatter16* ToOutput);661CMSAPI void CMSEXPORT _cmsGetTransformFormattersFloat(struct _cmstransform_struct *CMMcargo, cmsFormatterFloat* FromInput, cmsFormatterFloat* ToOutput);662663// Retrieve original flags664CMSAPI cmsUInt32Number CMSEXPORT _cmsGetTransformFlags(struct _cmstransform_struct* CMMcargo);665666typedef struct {667cmsPluginBase base;668669// Transform entry point670union {671_cmsTransformFactory legacy_xform;672_cmsTransform2Factory xform;673} factories;674675} cmsPluginTransform;676677//----------------------------------------------------------------------------------------------------------678// Mutex679680typedef void* (* _cmsCreateMutexFnPtrType)(cmsContext ContextID);681typedef void (* _cmsDestroyMutexFnPtrType)(cmsContext ContextID, void* mtx);682typedef cmsBool (* _cmsLockMutexFnPtrType)(cmsContext ContextID, void* mtx);683typedef void (* _cmsUnlockMutexFnPtrType)(cmsContext ContextID, void* mtx);684685typedef struct {686cmsPluginBase base;687688_cmsCreateMutexFnPtrType CreateMutexPtr;689_cmsDestroyMutexFnPtrType DestroyMutexPtr;690_cmsLockMutexFnPtrType LockMutexPtr;691_cmsUnlockMutexFnPtrType UnlockMutexPtr;692693} cmsPluginMutex;694695CMSAPI void* CMSEXPORT _cmsCreateMutex(cmsContext ContextID);696CMSAPI void CMSEXPORT _cmsDestroyMutex(cmsContext ContextID, void* mtx);697CMSAPI cmsBool CMSEXPORT _cmsLockMutex(cmsContext ContextID, void* mtx);698CMSAPI void CMSEXPORT _cmsUnlockMutex(cmsContext ContextID, void* mtx);699700701#ifndef CMS_USE_CPP_API702# ifdef __cplusplus703}704# endif705#endif706707#define _lcms_plugin_H708#endif709710711