grub2: bring back build of aros-side grub2 tools
[AROS.git] / workbench / libs / lcms2 / include / lcms2_plugin.h
blob10e61cbb31ec529c402904e4f70beb2b25368d22
1 //---------------------------------------------------------------------------------
2 //
3 // Little Color Management System
4 // Copyright (c) 1998-2011 Marti Maria Saguer
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining
7 // a copy of this software and associated documentation files (the "Software"),
8 // to deal in the Software without restriction, including without limitation
9 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 // and/or sell copies of the Software, and to permit persons to whom the Software
11 // is furnished to do so, subject to the following conditions:
13 // The above copyright notice and this permission notice shall be included in
14 // all copies or substantial portions of the Software.
16 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
18 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 //---------------------------------------------------------------------------------
26 // This is the plug-in header file. Normal LittleCMS clients should not use it.
27 // It is provided for plug-in writters that may want to access the support
28 // functions to do low level operations. All plug-in related structures
29 // are defined here. Including this file forces to include the standard API too.
31 #ifndef _lcms_plugin_H
33 // Deal with Microsoft's attempt at deprecating C standard runtime functions
34 #ifdef _MSC_VER
35 # if (_MSC_VER >= 1400)
36 # ifndef _CRT_SECURE_NO_DEPRECATE
37 # define _CRT_SECURE_NO_DEPRECATE
38 # endif
39 # ifndef _CRT_SECURE_NO_WARNINGS
40 # define _CRT_SECURE_NO_WARNINGS
41 # endif
42 # endif
43 #endif
45 #ifndef _lcms2_H
46 #include "lcms2.h"
47 #endif
49 // We need some standard C functions.
50 #include <stdlib.h>
51 #include <math.h>
52 #include <stdarg.h>
53 #include <memory.h>
54 #include <string.h>
57 #ifndef CMS_USE_CPP_API
58 # ifdef __cplusplus
59 extern "C" {
60 # endif
61 #endif
63 // Vector & Matrix operations -----------------------------------------------------------------------
65 // Axis of the matrix/array. No specific meaning at all.
66 #define VX 0
67 #define VY 1
68 #define VZ 2
70 // Vectors
71 typedef struct {
72 cmsFloat64Number n[3];
74 } cmsVEC3;
76 // 3x3 Matrix
77 typedef struct {
78 cmsVEC3 v[3];
80 } cmsMAT3;
82 CMSAPI void CMSEXPORT _cmsVEC3init(cmsVEC3* r, cmsFloat64Number x, cmsFloat64Number y, cmsFloat64Number z);
83 CMSAPI void CMSEXPORT _cmsVEC3minus(cmsVEC3* r, const cmsVEC3* a, const cmsVEC3* b);
84 CMSAPI void CMSEXPORT _cmsVEC3cross(cmsVEC3* r, const cmsVEC3* u, const cmsVEC3* v);
85 CMSAPI cmsFloat64Number CMSEXPORT _cmsVEC3dot(const cmsVEC3* u, const cmsVEC3* v);
86 CMSAPI cmsFloat64Number CMSEXPORT _cmsVEC3length(const cmsVEC3* a);
87 CMSAPI cmsFloat64Number CMSEXPORT _cmsVEC3distance(const cmsVEC3* a, const cmsVEC3* b);
89 CMSAPI void CMSEXPORT _cmsMAT3identity(cmsMAT3* a);
90 CMSAPI cmsBool CMSEXPORT _cmsMAT3isIdentity(const cmsMAT3* a);
91 CMSAPI void CMSEXPORT _cmsMAT3per(cmsMAT3* r, const cmsMAT3* a, const cmsMAT3* b);
92 CMSAPI cmsBool CMSEXPORT _cmsMAT3inverse(const cmsMAT3* a, cmsMAT3* b);
93 CMSAPI cmsBool CMSEXPORT _cmsMAT3solve(cmsVEC3* x, cmsMAT3* a, cmsVEC3* b);
94 CMSAPI void CMSEXPORT _cmsMAT3eval(cmsVEC3* r, const cmsMAT3* a, const cmsVEC3* v);
97 // Error logging -------------------------------------------------------------------------------------
99 CMSAPI void CMSEXPORT cmsSignalError(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *ErrorText, ...);
101 // Memory management ----------------------------------------------------------------------------------
103 CMSAPI void* CMSEXPORT _cmsMalloc(cmsContext ContextID, cmsUInt32Number size);
104 CMSAPI void* CMSEXPORT _cmsMallocZero(cmsContext ContextID, cmsUInt32Number size);
105 CMSAPI void* CMSEXPORT _cmsCalloc(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size);
106 CMSAPI void* CMSEXPORT _cmsRealloc(cmsContext ContextID, void* Ptr, cmsUInt32Number NewSize);
107 CMSAPI void CMSEXPORT _cmsFree(cmsContext ContextID, void* Ptr);
108 CMSAPI void* CMSEXPORT _cmsDupMem(cmsContext ContextID, const void* Org, cmsUInt32Number size);
110 // I/O handler ----------------------------------------------------------------------------------
112 struct _cms_io_handler {
114 void* stream; // Associated stream, which is implemented differently depending on media.
116 cmsContext ContextID;
117 cmsUInt32Number UsedSpace;
118 cmsUInt32Number ReportedSize;
119 char PhysicalFile[cmsMAX_PATH];
121 cmsUInt32Number (* Read)(struct _cms_io_handler* iohandler, void *Buffer,
122 cmsUInt32Number size,
123 cmsUInt32Number count);
124 cmsBool (* Seek)(struct _cms_io_handler* iohandler, cmsUInt32Number offset);
125 cmsBool (* Close)(struct _cms_io_handler* iohandler);
126 cmsUInt32Number (* Tell)(struct _cms_io_handler* iohandler);
127 cmsBool (* Write)(struct _cms_io_handler* iohandler, cmsUInt32Number size,
128 const void* Buffer);
131 // Endianess adjust functions
132 CMSAPI cmsUInt16Number CMSEXPORT _cmsAdjustEndianess16(cmsUInt16Number Word);
133 CMSAPI cmsUInt32Number CMSEXPORT _cmsAdjustEndianess32(cmsUInt32Number Value);
134 CMSAPI void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord);
136 // Helper IO functions
137 CMSAPI cmsBool CMSEXPORT _cmsReadUInt8Number(cmsIOHANDLER* io, cmsUInt8Number* n);
138 CMSAPI cmsBool CMSEXPORT _cmsReadUInt16Number(cmsIOHANDLER* io, cmsUInt16Number* n);
139 CMSAPI cmsBool CMSEXPORT _cmsReadUInt32Number(cmsIOHANDLER* io, cmsUInt32Number* n);
140 CMSAPI cmsBool CMSEXPORT _cmsReadFloat32Number(cmsIOHANDLER* io, cmsFloat32Number* n);
141 CMSAPI cmsBool CMSEXPORT _cmsReadUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n);
142 CMSAPI cmsBool CMSEXPORT _cmsRead15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number* n);
143 CMSAPI cmsBool CMSEXPORT _cmsReadXYZNumber(cmsIOHANDLER* io, cmsCIEXYZ* XYZ);
144 CMSAPI cmsBool CMSEXPORT _cmsReadUInt16Array(cmsIOHANDLER* io, cmsUInt32Number n, cmsUInt16Number* Array);
146 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt8Number(cmsIOHANDLER* io, cmsUInt8Number n);
147 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt16Number(cmsIOHANDLER* io, cmsUInt16Number n);
148 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt32Number(cmsIOHANDLER* io, cmsUInt32Number n);
149 CMSAPI cmsBool CMSEXPORT _cmsWriteFloat32Number(cmsIOHANDLER* io, cmsFloat32Number n);
150 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n);
151 CMSAPI cmsBool CMSEXPORT _cmsWrite15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number n);
152 CMSAPI cmsBool CMSEXPORT _cmsWriteXYZNumber(cmsIOHANDLER* io, const cmsCIEXYZ* XYZ);
153 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt16Array(cmsIOHANDLER* io, cmsUInt32Number n, const cmsUInt16Number* Array);
155 // ICC base tag
156 typedef struct {
157 cmsTagTypeSignature sig;
158 cmsInt8Number reserved[4];
160 } _cmsTagBase;
162 // Type base helper functions
163 CMSAPI cmsTagTypeSignature CMSEXPORT _cmsReadTypeBase(cmsIOHANDLER* io);
164 CMSAPI cmsBool CMSEXPORT _cmsWriteTypeBase(cmsIOHANDLER* io, cmsTagTypeSignature sig);
166 // Alignment functions
167 CMSAPI cmsBool CMSEXPORT _cmsReadAlignment(cmsIOHANDLER* io);
168 CMSAPI cmsBool CMSEXPORT _cmsWriteAlignment(cmsIOHANDLER* io);
170 // To deal with text streams. 2K at most
171 CMSAPI cmsBool CMSEXPORT _cmsIOPrintf(cmsIOHANDLER* io, const char* frm, ...);
173 // Fixed point helper functions
174 CMSAPI cmsFloat64Number CMSEXPORT _cms8Fixed8toDouble(cmsUInt16Number fixed8);
175 CMSAPI cmsUInt16Number CMSEXPORT _cmsDoubleTo8Fixed8(cmsFloat64Number val);
177 CMSAPI cmsFloat64Number CMSEXPORT _cms15Fixed16toDouble(cmsS15Fixed16Number fix32);
178 CMSAPI cmsS15Fixed16Number CMSEXPORT _cmsDoubleTo15Fixed16(cmsFloat64Number v);
180 // Date/time helper functions
181 CMSAPI void CMSEXPORT _cmsEncodeDateTimeNumber(cmsDateTimeNumber *Dest, const struct tm *Source);
182 CMSAPI void CMSEXPORT _cmsDecodeDateTimeNumber(const cmsDateTimeNumber *Source, struct tm *Dest);
184 //----------------------------------------------------------------------------------------------------------
186 // Shared callbacks for user data
187 typedef void (* _cmsFreeUserDataFn)(cmsContext ContextID, void* Data);
188 typedef void* (* _cmsDupUserDataFn)(cmsContext ContextID, const void* Data);
190 //----------------------------------------------------------------------------------------------------------
192 // Plug-in foundation
193 #define cmsPluginMagicNumber 0x61637070 // 'acpp'
195 #define cmsPluginMemHandlerSig 0x6D656D48 // 'memH'
196 #define cmsPluginInterpolationSig 0x696E7048 // 'inpH'
197 #define cmsPluginParametricCurveSig 0x70617248 // 'parH'
198 #define cmsPluginFormattersSig 0x66726D48 // 'frmH
199 #define cmsPluginTagTypeSig 0x74797048 // 'typH'
200 #define cmsPluginTagSig 0x74616748 // 'tagH'
201 #define cmsPluginRenderingIntentSig 0x696E7448 // 'intH'
202 #define cmsPluginMultiProcessElementSig 0x6D706548 // 'mpeH'
203 #define cmsPluginOptimizationSig 0x6F707448 // 'optH'
204 #define cmsPluginTransformSig 0x7A666D48 // 'xfmH'
206 typedef struct _cmsPluginBaseStruct {
208 cmsUInt32Number Magic; // 'acpp' signature
209 cmsUInt32Number ExpectedVersion; // Expected version of LittleCMS
210 cmsUInt32Number Type; // Type of plug-in
211 struct _cmsPluginBaseStruct* Next; // For multiple plugin definition. NULL for end of list.
213 } cmsPluginBase;
215 // Maximum number of types in a plugin array
216 #define MAX_TYPES_IN_LCMS_PLUGIN 20
218 //----------------------------------------------------------------------------------------------------------
220 // Memory handler. Each new plug-in type replaces current behaviour
221 typedef struct {
223 cmsPluginBase base;
225 // Required
226 void * (* MallocPtr)(cmsContext ContextID, cmsUInt32Number size);
227 void (* FreePtr)(cmsContext ContextID, void *Ptr);
228 void * (* ReallocPtr)(cmsContext ContextID, void* Ptr, cmsUInt32Number NewSize);
230 // Optional
231 void * (* MallocZeroPtr)(cmsContext ContextID, cmsUInt32Number size);
232 void * (* CallocPtr)(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size);
233 void * (* DupPtr)(cmsContext ContextID, const void* Org, cmsUInt32Number size);
235 } cmsPluginMemHandler;
238 // ------------------------------------------------------------------------------------------------------------------
240 // Interpolation. 16 bits and floating point versions.
241 struct _cms_interp_struc;
243 // Interpolation callbacks
245 // 16 bits forward interpolation. This function performs precision-limited linear interpolation
246 // and is supposed to be quite fast. Implementation may be tetrahedral or trilinear, and plug-ins may
247 // choose to implement any other interpolation algorithm.
248 typedef void (* _cmsInterpFn16)(register const cmsUInt16Number Input[],
249 register cmsUInt16Number Output[],
250 register const struct _cms_interp_struc* p);
252 // Floating point forward interpolation. Full precision interpolation using floats. This is not a
253 // time critical function. Implementation may be tetrahedral or trilinear, and plug-ins may
254 // choose to implement any other interpolation algorithm.
255 typedef void (* _cmsInterpFnFloat)(cmsFloat32Number const Input[],
256 cmsFloat32Number Output[],
257 const struct _cms_interp_struc* p);
261 // This type holds a pointer to an interpolator that can be either 16 bits or float
262 typedef union {
263 _cmsInterpFn16 Lerp16; // Forward interpolation in 16 bits
264 _cmsInterpFnFloat LerpFloat; // Forward interpolation in floating point
265 } cmsInterpFunction;
267 // Flags for interpolator selection
268 #define CMS_LERP_FLAGS_16BITS 0x0000 // The default
269 #define CMS_LERP_FLAGS_FLOAT 0x0001 // Requires different implementation
270 #define CMS_LERP_FLAGS_TRILINEAR 0x0100 // Hint only
273 #define MAX_INPUT_DIMENSIONS 8
275 typedef struct _cms_interp_struc { // Used on all interpolations. Supplied by lcms2 when calling the interpolation function
277 cmsContext ContextID; // The calling thread
279 cmsUInt32Number dwFlags; // Keep original flags
280 cmsUInt32Number nInputs; // != 1 only in 3D interpolation
281 cmsUInt32Number nOutputs; // != 1 only in 3D interpolation
283 cmsUInt32Number nSamples[MAX_INPUT_DIMENSIONS]; // Valid on all kinds of tables
284 cmsUInt32Number Domain[MAX_INPUT_DIMENSIONS]; // Domain = nSamples - 1
286 cmsUInt32Number opta[MAX_INPUT_DIMENSIONS]; // Optimization for 3D CLUT. This is the number of nodes premultiplied for each
287 // dimension. For example, in 7 nodes, 7, 7^2 , 7^3, 7^4, etc. On non-regular
288 // Samplings may vary according of the number of nodes for each dimension.
290 const void *Table; // Points to the actual interpolation table
291 cmsInterpFunction Interpolation; // Points to the function to do the interpolation
293 } cmsInterpParams;
295 // Interpolators factory
296 typedef cmsInterpFunction (* cmsInterpFnFactory)(cmsUInt32Number nInputChannels, cmsUInt32Number nOutputChannels, cmsUInt32Number dwFlags);
298 // The plug-in
299 typedef struct {
300 cmsPluginBase base;
302 // Points to a user-supplied function which implements the factory
303 cmsInterpFnFactory InterpolatorsFactory;
305 } cmsPluginInterpolation;
307 //----------------------------------------------------------------------------------------------------------
309 // Parametric curves. A negative type means same function but analytically inverted. Max. number of params is 10
311 // Evaluator callback for user-suplied parametric curves. May implement more than one type
312 typedef cmsFloat64Number (* cmsParametricCurveEvaluator)(cmsInt32Number Type, const cmsFloat64Number Params[10], cmsFloat64Number R);
314 // Plug-in may implement an arbitrary number of parametric curves
315 typedef struct {
316 cmsPluginBase base;
318 cmsUInt32Number nFunctions; // Number of supported functions
319 cmsUInt32Number FunctionTypes[MAX_TYPES_IN_LCMS_PLUGIN]; // The identification types
320 cmsUInt32Number ParameterCount[MAX_TYPES_IN_LCMS_PLUGIN]; // Number of parameters for each function
322 cmsParametricCurveEvaluator Evaluator; // The evaluator
324 } cmsPluginParametricCurves;
325 //----------------------------------------------------------------------------------------------------------
327 // Formatters. This plug-in adds new handlers, replacing them if they already exist. Formatters dealing with
328 // cmsFloat32Number (bps = 4) or double (bps = 0) types are requested via FormatterFloat callback. Others come across
329 // Formatter16 callback
331 struct _cmstransform_struct;
333 typedef cmsUInt8Number* (* cmsFormatter16)(register struct _cmstransform_struct* CMMcargo,
334 register cmsUInt16Number Values[],
335 register cmsUInt8Number* Buffer,
336 register cmsUInt32Number Stride);
338 typedef cmsUInt8Number* (* cmsFormatterFloat)(struct _cmstransform_struct* CMMcargo,
339 cmsFloat32Number Values[],
340 cmsUInt8Number* Buffer,
341 cmsUInt32Number Stride);
343 // This type holds a pointer to a formatter that can be either 16 bits or cmsFloat32Number
344 typedef union {
345 cmsFormatter16 Fmt16;
346 cmsFormatterFloat FmtFloat;
348 } cmsFormatter;
350 #define CMS_PACK_FLAGS_16BITS 0x0000
351 #define CMS_PACK_FLAGS_FLOAT 0x0001
353 typedef enum { cmsFormatterInput=0, cmsFormatterOutput=1 } cmsFormatterDirection;
355 typedef cmsFormatter (* cmsFormatterFactory)(cmsUInt32Number Type, // Specific type, i.e. TYPE_RGB_8
356 cmsFormatterDirection Dir,
357 cmsUInt32Number dwFlags); // precision
359 // Plug-in may implement an arbitrary number of formatters
360 typedef struct {
361 cmsPluginBase base;
362 cmsFormatterFactory FormattersFactory;
364 } cmsPluginFormatters;
366 //----------------------------------------------------------------------------------------------------------
368 // Tag type handler. Each type is free to return anything it wants, and it is up to the caller to
369 // know in advance what is the type contained in the tag.
370 typedef struct _cms_typehandler_struct {
372 cmsTagTypeSignature Signature; // The signature of the type
374 // Allocates and reads items
375 void * (* ReadPtr)(struct _cms_typehandler_struct* self,
376 cmsIOHANDLER* io,
377 cmsUInt32Number* nItems,
378 cmsUInt32Number SizeOfTag);
380 // Writes n Items
381 cmsBool (* WritePtr)(struct _cms_typehandler_struct* self,
382 cmsIOHANDLER* io,
383 void* Ptr,
384 cmsUInt32Number nItems);
386 // Duplicate an item or array of items
387 void* (* DupPtr)(struct _cms_typehandler_struct* self,
388 const void *Ptr,
389 cmsUInt32Number n);
391 // Free all resources
392 void (* FreePtr)(struct _cms_typehandler_struct* self,
393 void *Ptr);
395 // Additional parameters used by the calling thread
396 cmsContext ContextID;
397 cmsUInt32Number ICCVersion;
399 } cmsTagTypeHandler;
401 // Each plug-in implements a single type
402 typedef struct {
403 cmsPluginBase base;
404 cmsTagTypeHandler Handler;
406 } cmsPluginTagType;
408 //----------------------------------------------------------------------------------------------------------
410 // This is the tag plugin, which identifies tags. For writing, a pointer to function is provided.
411 // This function should return the desired type for this tag, given the version of profile
412 // and the data being serialized.
413 typedef struct {
415 cmsUInt32Number ElemCount; // If this tag needs an array, how many elements should keep
417 // For reading.
418 cmsUInt32Number nSupportedTypes; // In how many types this tag can come (MAX_TYPES_IN_LCMS_PLUGIN maximum)
419 cmsTagTypeSignature SupportedTypes[MAX_TYPES_IN_LCMS_PLUGIN];
421 // For writting
422 cmsTagTypeSignature (* DecideType)(cmsFloat64Number ICCVersion, const void *Data);
424 } cmsTagDescriptor;
426 // Plug-in implements a single tag
427 typedef struct {
428 cmsPluginBase base;
430 cmsTagSignature Signature;
431 cmsTagDescriptor Descriptor;
433 } cmsPluginTag;
435 //----------------------------------------------------------------------------------------------------------
437 // Custom intents. This function should join all profiles specified in the array in
438 // a single LUT. Any custom intent in the chain redirects to custom function. If more than
439 // one custom intent is found, the one located first is invoked. Usually users should use only one
440 // custom intent, so mixing custom intents in same multiprofile transform is not supported.
442 typedef cmsPipeline* (* cmsIntentFn)( cmsContext ContextID,
443 cmsUInt32Number nProfiles,
444 cmsUInt32Number Intents[],
445 cmsHPROFILE hProfiles[],
446 cmsBool BPC[],
447 cmsFloat64Number AdaptationStates[],
448 cmsUInt32Number dwFlags);
451 // Each plug-in defines a single intent number.
452 typedef struct {
453 cmsPluginBase base;
454 cmsUInt32Number Intent;
455 cmsIntentFn Link;
456 char Description[256];
458 } cmsPluginRenderingIntent;
461 // The default ICC intents (perceptual, saturation, rel.col and abs.col)
462 CMSAPI cmsPipeline* CMSEXPORT _cmsDefaultICCintents(cmsContext ContextID,
463 cmsUInt32Number nProfiles,
464 cmsUInt32Number Intents[],
465 cmsHPROFILE hProfiles[],
466 cmsBool BPC[],
467 cmsFloat64Number AdaptationStates[],
468 cmsUInt32Number dwFlags);
471 //----------------------------------------------------------------------------------------------------------
473 // Pipelines, Multi Process Elements.
475 typedef void (* _cmsStageEvalFn) (const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsStage* mpe);
476 typedef void*(* _cmsStageDupElemFn) (cmsStage* mpe);
477 typedef void (* _cmsStageFreeElemFn) (cmsStage* mpe);
480 // This function allocates a generic MPE
481 CMSAPI cmsStage* CMSEXPORT _cmsStageAllocPlaceholder(cmsContext ContextID,
482 cmsStageSignature Type,
483 cmsUInt32Number InputChannels,
484 cmsUInt32Number OutputChannels,
485 _cmsStageEvalFn EvalPtr, // Points to fn that evaluates the element (always in floating point)
486 _cmsStageDupElemFn DupElemPtr, // Points to a fn that duplicates the stage
487 _cmsStageFreeElemFn FreePtr, // Points to a fn that sets the element free
488 void* Data); // A generic pointer to whatever memory needed by the element
489 typedef struct {
490 cmsPluginBase base;
491 cmsTagTypeHandler Handler;
493 } cmsPluginMultiProcessElement;
496 // Data kept in "Element" member of cmsStage
498 // Curves
499 typedef struct {
500 cmsUInt32Number nCurves;
501 cmsToneCurve** TheCurves;
503 } _cmsStageToneCurvesData;
505 // Matrix
506 typedef struct {
507 cmsFloat64Number* Double; // floating point for the matrix
508 cmsFloat64Number* Offset; // The offset
510 } _cmsStageMatrixData;
512 // CLUT
513 typedef struct {
515 union { // Can have only one of both representations at same time
516 cmsUInt16Number* T; // Points to the table 16 bits table
517 cmsFloat32Number* TFloat; // Points to the cmsFloat32Number table
519 } Tab;
521 cmsInterpParams* Params;
522 cmsUInt32Number nEntries;
523 cmsBool HasFloatValues;
525 } _cmsStageCLutData;
528 //----------------------------------------------------------------------------------------------------------
529 // Optimization. Using this plug-in, additional optimization strategies may be implemented.
530 // The function should return TRUE if any optimization is done on the LUT, this terminates
531 // the optimization search. Or FALSE if it is unable to optimize and want to give a chance
532 // to the rest of optimizers.
534 typedef void (* _cmsOPTeval16Fn)(register const cmsUInt16Number In[],
535 register cmsUInt16Number Out[],
536 register const void* Data);
539 typedef cmsBool (* _cmsOPToptimizeFn)(cmsPipeline** Lut,
540 cmsUInt32Number Intent,
541 cmsUInt32Number* InputFormat,
542 cmsUInt32Number* OutputFormat,
543 cmsUInt32Number* dwFlags);
545 // This function may be used to set the optional evaluator and a block of private data. If private data is being used, an optional
546 // duplicator and free functions should also be specified in order to duplicate the LUT construct. Use NULL to inhibit such functionality.
548 CMSAPI void CMSEXPORT _cmsPipelineSetOptimizationParameters(cmsPipeline* Lut,
549 _cmsOPTeval16Fn Eval16,
550 void* PrivateData,
551 _cmsFreeUserDataFn FreePrivateDataFn,
552 _cmsDupUserDataFn DupPrivateDataFn);
554 typedef struct {
555 cmsPluginBase base;
557 // Optimize entry point
558 _cmsOPToptimizeFn OptimizePtr;
560 } cmsPluginOptimization;
562 //----------------------------------------------------------------------------------------------------------
563 // Full xform
564 typedef void (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo,
565 const void* InputBuffer,
566 void* OutputBuffer,
567 cmsUInt32Number Size,
568 cmsUInt32Number Stride);
570 typedef cmsBool (* _cmsTransformFactory)(_cmsTransformFn* xform,
571 void** UserData,
572 _cmsFreeUserDataFn* FreePrivateDataFn,
573 cmsPipeline** Lut,
574 cmsUInt32Number* InputFormat,
575 cmsUInt32Number* OutputFormat,
576 cmsUInt32Number* dwFlags);
579 // Retrieve user data as specified by the factory
580 CMSAPI void CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn);
581 CMSAPI void * CMSEXPORT _cmsGetTransformUserData(struct _cmstransform_struct *CMMcargo);
584 // Retrieve formatters
585 CMSAPI void CMSEXPORT _cmsGetTransformFormatters16 (struct _cmstransform_struct *CMMcargo, cmsFormatter16* FromInput, cmsFormatter16* ToOutput);
586 CMSAPI void CMSEXPORT _cmsGetTransformFormattersFloat(struct _cmstransform_struct *CMMcargo, cmsFormatterFloat* FromInput, cmsFormatterFloat* ToOutput);
588 typedef struct {
589 cmsPluginBase base;
591 // Transform entry point
592 _cmsTransformFactory Factory;
594 } cmsPluginTransform;
597 #ifndef CMS_USE_CPP_API
598 # ifdef __cplusplus
600 # endif
601 #endif
603 #define _lcms_plugin_H
604 #endif