2693N/A/*
2693N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2693N/A *
2693N/A * This code is free software; you can redistribute it and/or modify it
2693N/A * under the terms of the GNU General Public License version 2 only, as
2693N/A * published by the Free Software Foundation. Oracle designates this
2693N/A * particular file as subject to the "Classpath" exception as provided
2693N/A * by Oracle in the LICENSE file that accompanied this code.
2693N/A *
2693N/A * This code is distributed in the hope that it will be useful, but WITHOUT
2693N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2693N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2693N/A * version 2 for more details (a copy is included in the LICENSE file that
2693N/A * accompanied this code).
2693N/A *
2693N/A * You should have received a copy of the GNU General Public License version
2693N/A * 2 along with this work; if not, write to the Free Software Foundation,
2693N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2693N/A *
2693N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2693N/A * or visit www.oracle.com if you need additional information or have any
2693N/A * questions.
2693N/A */
2693N/A
2693N/A// This file is available under and governed by the GNU General Public
2693N/A// License version 2 only, as published by the Free Software Foundation.
2693N/A// However, the following notice accompanied the original version of this
2693N/A// file:
2693N/A//
2693N/A//---------------------------------------------------------------------------------
2693N/A//
2693N/A// Little Color Management System
6271N/A// Copyright (c) 1998-2011 Marti Maria Saguer
2693N/A//
2693N/A// Permission is hereby granted, free of charge, to any person obtaining
2693N/A// a copy of this software and associated documentation files (the "Software"),
2693N/A// to deal in the Software without restriction, including without limitation
2693N/A// the rights to use, copy, modify, merge, publish, distribute, sublicense,
2693N/A// and/or sell copies of the Software, and to permit persons to whom the Software
2693N/A// is furnished to do so, subject to the following conditions:
2693N/A//
2693N/A// The above copyright notice and this permission notice shall be included in
2693N/A// all copies or substantial portions of the Software.
2693N/A//
2693N/A// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2693N/A// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2693N/A// THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2693N/A// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
2693N/A// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
2693N/A// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
2693N/A// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2693N/A//
2693N/A//---------------------------------------------------------------------------------
2693N/A//
2693N/A// This is the plug-in header file. Normal LittleCMS clients should not use it.
2693N/A// It is provided for plug-in writters that may want to access the support
2693N/A// functions to do low level operations. All plug-in related structures
2693N/A// are defined here. Including this file forces to include the standard API too.
2693N/A
2693N/A#ifndef _lcms_plugin_H
2693N/A
2693N/A// Deal with Microsoft's attempt at deprecating C standard runtime functions
2693N/A#ifdef _MSC_VER
2693N/A# if (_MSC_VER >= 1400)
2693N/A# ifndef _CRT_SECURE_NO_DEPRECATE
2693N/A# define _CRT_SECURE_NO_DEPRECATE
2693N/A# endif
2693N/A# ifndef _CRT_SECURE_NO_WARNINGS
2693N/A# define _CRT_SECURE_NO_WARNINGS
2693N/A# endif
2693N/A# endif
2693N/A#endif
2693N/A
2693N/A#ifndef _lcms2_H
2693N/A#include "lcms2.h"
2693N/A#endif
2693N/A
2693N/A// We need some standard C functions.
2693N/A#include <stdlib.h>
2693N/A#include <math.h>
2693N/A#include <stdarg.h>
2693N/A#include <memory.h>
2693N/A#include <string.h>
2693N/A
2693N/A
2693N/A#ifndef CMS_USE_CPP_API
2693N/A# ifdef __cplusplus
2693N/Aextern "C" {
2693N/A# endif
2693N/A#endif
2693N/A
2693N/A// Vector & Matrix operations -----------------------------------------------------------------------
2693N/A
2693N/A// Axis of the matrix/array. No specific meaning at all.
2693N/A#define VX 0
2693N/A#define VY 1
2693N/A#define VZ 2
2693N/A
2693N/A// Vectors
2693N/Atypedef struct {
2693N/A cmsFloat64Number n[3];
2693N/A
2693N/A } cmsVEC3;
2693N/A
2693N/A// 3x3 Matrix
2693N/Atypedef struct {
2693N/A cmsVEC3 v[3];
2693N/A
2693N/A } cmsMAT3;
2693N/A
2693N/ACMSAPI void CMSEXPORT _cmsVEC3init(cmsVEC3* r, cmsFloat64Number x, cmsFloat64Number y, cmsFloat64Number z);
2693N/ACMSAPI void CMSEXPORT _cmsVEC3minus(cmsVEC3* r, const cmsVEC3* a, const cmsVEC3* b);
2693N/ACMSAPI void CMSEXPORT _cmsVEC3cross(cmsVEC3* r, const cmsVEC3* u, const cmsVEC3* v);
2693N/ACMSAPI cmsFloat64Number CMSEXPORT _cmsVEC3dot(const cmsVEC3* u, const cmsVEC3* v);
2693N/ACMSAPI cmsFloat64Number CMSEXPORT _cmsVEC3length(const cmsVEC3* a);
2693N/ACMSAPI cmsFloat64Number CMSEXPORT _cmsVEC3distance(const cmsVEC3* a, const cmsVEC3* b);
2693N/A
2693N/ACMSAPI void CMSEXPORT _cmsMAT3identity(cmsMAT3* a);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsMAT3isIdentity(const cmsMAT3* a);
2693N/ACMSAPI void CMSEXPORT _cmsMAT3per(cmsMAT3* r, const cmsMAT3* a, const cmsMAT3* b);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsMAT3inverse(const cmsMAT3* a, cmsMAT3* b);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsMAT3solve(cmsVEC3* x, cmsMAT3* a, cmsVEC3* b);
2693N/ACMSAPI void CMSEXPORT _cmsMAT3eval(cmsVEC3* r, const cmsMAT3* a, const cmsVEC3* v);
2693N/A
2693N/A
2693N/A// Error logging -------------------------------------------------------------------------------------
2693N/A
2693N/ACMSAPI void CMSEXPORT cmsSignalError(cmsContext ContextID, cmsUInt32Number ErrorCode, const char *ErrorText, ...);
2693N/A
2693N/A// Memory management ----------------------------------------------------------------------------------
2693N/A
2693N/ACMSAPI void* CMSEXPORT _cmsMalloc(cmsContext ContextID, cmsUInt32Number size);
2693N/ACMSAPI void* CMSEXPORT _cmsMallocZero(cmsContext ContextID, cmsUInt32Number size);
2693N/ACMSAPI void* CMSEXPORT _cmsCalloc(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size);
2693N/ACMSAPI void* CMSEXPORT _cmsRealloc(cmsContext ContextID, void* Ptr, cmsUInt32Number NewSize);
2693N/ACMSAPI void CMSEXPORT _cmsFree(cmsContext ContextID, void* Ptr);
2693N/ACMSAPI void* CMSEXPORT _cmsDupMem(cmsContext ContextID, const void* Org, cmsUInt32Number size);
2693N/A
2693N/A// I/O handler ----------------------------------------------------------------------------------
2693N/A
2693N/Astruct _cms_io_handler {
2693N/A
2693N/A void* stream; // Associated stream, which is implemented differently depending on media.
2693N/A
2693N/A cmsContext ContextID;
2693N/A cmsUInt32Number UsedSpace;
6271N/A cmsUInt32Number ReportedSize;
2693N/A char PhysicalFile[cmsMAX_PATH];
2693N/A
2693N/A cmsUInt32Number (* Read)(struct _cms_io_handler* iohandler, void *Buffer,
2693N/A cmsUInt32Number size,
2693N/A cmsUInt32Number count);
2693N/A cmsBool (* Seek)(struct _cms_io_handler* iohandler, cmsUInt32Number offset);
2693N/A cmsBool (* Close)(struct _cms_io_handler* iohandler);
2693N/A cmsUInt32Number (* Tell)(struct _cms_io_handler* iohandler);
2693N/A cmsBool (* Write)(struct _cms_io_handler* iohandler, cmsUInt32Number size,
2693N/A const void* Buffer);
2693N/A};
2693N/A
2693N/A// Endianess adjust functions
2693N/ACMSAPI cmsUInt16Number CMSEXPORT _cmsAdjustEndianess16(cmsUInt16Number Word);
2693N/ACMSAPI cmsUInt32Number CMSEXPORT _cmsAdjustEndianess32(cmsUInt32Number Value);
6271N/ACMSAPI void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord);
2693N/A
2693N/A// Helper IO functions
2693N/ACMSAPI cmsBool CMSEXPORT _cmsReadUInt8Number(cmsIOHANDLER* io, cmsUInt8Number* n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsReadUInt16Number(cmsIOHANDLER* io, cmsUInt16Number* n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsReadUInt32Number(cmsIOHANDLER* io, cmsUInt32Number* n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsReadFloat32Number(cmsIOHANDLER* io, cmsFloat32Number* n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsReadUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsRead15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number* n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsReadXYZNumber(cmsIOHANDLER* io, cmsCIEXYZ* XYZ);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsReadUInt16Array(cmsIOHANDLER* io, cmsUInt32Number n, cmsUInt16Number* Array);
2693N/A
2693N/ACMSAPI cmsBool CMSEXPORT _cmsWriteUInt8Number(cmsIOHANDLER* io, cmsUInt8Number n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsWriteUInt16Number(cmsIOHANDLER* io, cmsUInt16Number n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsWriteUInt32Number(cmsIOHANDLER* io, cmsUInt32Number n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsWriteFloat32Number(cmsIOHANDLER* io, cmsFloat32Number n);
6271N/ACMSAPI cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsWrite15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number n);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsWriteXYZNumber(cmsIOHANDLER* io, const cmsCIEXYZ* XYZ);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsWriteUInt16Array(cmsIOHANDLER* io, cmsUInt32Number n, const cmsUInt16Number* Array);
2693N/A
2693N/A// ICC base tag
2693N/Atypedef struct {
2693N/A cmsTagTypeSignature sig;
2693N/A cmsInt8Number reserved[4];
2693N/A
2693N/A} _cmsTagBase;
2693N/A
2693N/A// Type base helper functions
2693N/ACMSAPI cmsTagTypeSignature CMSEXPORT _cmsReadTypeBase(cmsIOHANDLER* io);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsWriteTypeBase(cmsIOHANDLER* io, cmsTagTypeSignature sig);
2693N/A
2693N/A// Alignment functions
2693N/ACMSAPI cmsBool CMSEXPORT _cmsReadAlignment(cmsIOHANDLER* io);
2693N/ACMSAPI cmsBool CMSEXPORT _cmsWriteAlignment(cmsIOHANDLER* io);
2693N/A
2693N/A// To deal with text streams. 2K at most
2693N/ACMSAPI cmsBool CMSEXPORT _cmsIOPrintf(cmsIOHANDLER* io, const char* frm, ...);
2693N/A
2693N/A// Fixed point helper functions
2693N/ACMSAPI cmsFloat64Number CMSEXPORT _cms8Fixed8toDouble(cmsUInt16Number fixed8);
2693N/ACMSAPI cmsUInt16Number CMSEXPORT _cmsDoubleTo8Fixed8(cmsFloat64Number val);
2693N/A
2693N/ACMSAPI cmsFloat64Number CMSEXPORT _cms15Fixed16toDouble(cmsS15Fixed16Number fix32);
2693N/ACMSAPI cmsS15Fixed16Number CMSEXPORT _cmsDoubleTo15Fixed16(cmsFloat64Number v);
2693N/A
2693N/A// Date/time helper functions
2693N/ACMSAPI void CMSEXPORT _cmsEncodeDateTimeNumber(cmsDateTimeNumber *Dest, const struct tm *Source);
2693N/ACMSAPI void CMSEXPORT _cmsDecodeDateTimeNumber(const cmsDateTimeNumber *Source, struct tm *Dest);
2693N/A
6271N/A//----------------------------------------------------------------------------------------------------------
6271N/A
6271N/A// Shared callbacks for user data
6271N/Atypedef void (* _cmsFreeUserDataFn)(cmsContext ContextID, void* Data);
6271N/Atypedef void* (* _cmsDupUserDataFn)(cmsContext ContextID, const void* Data);
2693N/A
2693N/A//----------------------------------------------------------------------------------------------------------
2693N/A
2693N/A// Plug-in foundation
2693N/A#define cmsPluginMagicNumber 0x61637070 // 'acpp'
2693N/A
2693N/A#define cmsPluginMemHandlerSig 0x6D656D48 // 'memH'
2693N/A#define cmsPluginInterpolationSig 0x696E7048 // 'inpH'
2693N/A#define cmsPluginParametricCurveSig 0x70617248 // 'parH'
2693N/A#define cmsPluginFormattersSig 0x66726D48 // 'frmH
2693N/A#define cmsPluginTagTypeSig 0x74797048 // 'typH'
2693N/A#define cmsPluginTagSig 0x74616748 // 'tagH'
2693N/A#define cmsPluginRenderingIntentSig 0x696E7448 // 'intH'
2693N/A#define cmsPluginMultiProcessElementSig 0x6D706548 // 'mpeH'
2693N/A#define cmsPluginOptimizationSig 0x6F707448 // 'optH'
6271N/A#define cmsPluginTransformSig 0x7A666D48 // 'xfmH'
2693N/A
2693N/Atypedef struct _cmsPluginBaseStruct {
2693N/A
2693N/A cmsUInt32Number Magic; // 'acpp' signature
2693N/A cmsUInt32Number ExpectedVersion; // Expected version of LittleCMS
2693N/A cmsUInt32Number Type; // Type of plug-in
2693N/A struct _cmsPluginBaseStruct* Next; // For multiple plugin definition. NULL for end of list.
2693N/A
2693N/A} cmsPluginBase;
2693N/A
2693N/A// Maximum number of types in a plugin array
2693N/A#define MAX_TYPES_IN_LCMS_PLUGIN 20
2693N/A
2693N/A//----------------------------------------------------------------------------------------------------------
2693N/A
2693N/A// Memory handler. Each new plug-in type replaces current behaviour
2693N/Atypedef struct {
2693N/A
2693N/A cmsPluginBase base;
2693N/A
2693N/A // Required
2693N/A void * (* MallocPtr)(cmsContext ContextID, cmsUInt32Number size);
2693N/A void (* FreePtr)(cmsContext ContextID, void *Ptr);
2693N/A void * (* ReallocPtr)(cmsContext ContextID, void* Ptr, cmsUInt32Number NewSize);
2693N/A
2693N/A // Optional
2693N/A void * (* MallocZeroPtr)(cmsContext ContextID, cmsUInt32Number size);
2693N/A void * (* CallocPtr)(cmsContext ContextID, cmsUInt32Number num, cmsUInt32Number size);
2693N/A void * (* DupPtr)(cmsContext ContextID, const void* Org, cmsUInt32Number size);
2693N/A
2693N/A} cmsPluginMemHandler;
2693N/A
2693N/A
2693N/A// ------------------------------------------------------------------------------------------------------------------
2693N/A
2693N/A// Interpolation. 16 bits and floating point versions.
2693N/Astruct _cms_interp_struc;
2693N/A
2693N/A// Interpolation callbacks
2693N/A
2693N/A// 16 bits forward interpolation. This function performs precision-limited linear interpolation
2693N/A// and is supposed to be quite fast. Implementation may be tetrahedral or trilinear, and plug-ins may
2693N/A// choose to implement any other interpolation algorithm.
2693N/Atypedef void (* _cmsInterpFn16)(register const cmsUInt16Number Input[],
2693N/A register cmsUInt16Number Output[],
2693N/A register const struct _cms_interp_struc* p);
2693N/A
2693N/A// Floating point forward interpolation. Full precision interpolation using floats. This is not a
2693N/A// time critical function. Implementation may be tetrahedral or trilinear, and plug-ins may
2693N/A// choose to implement any other interpolation algorithm.
2693N/Atypedef void (* _cmsInterpFnFloat)(cmsFloat32Number const Input[],
2693N/A cmsFloat32Number Output[],
2693N/A const struct _cms_interp_struc* p);
2693N/A
2693N/A
2693N/A
2693N/A// This type holds a pointer to an interpolator that can be either 16 bits or float
2693N/Atypedef union {
2693N/A _cmsInterpFn16 Lerp16; // Forward interpolation in 16 bits
2693N/A _cmsInterpFnFloat LerpFloat; // Forward interpolation in floating point
2693N/A} cmsInterpFunction;
2693N/A
2693N/A// Flags for interpolator selection
2693N/A#define CMS_LERP_FLAGS_16BITS 0x0000 // The default
2693N/A#define CMS_LERP_FLAGS_FLOAT 0x0001 // Requires different implementation
2693N/A#define CMS_LERP_FLAGS_TRILINEAR 0x0100 // Hint only
2693N/A
2693N/A
2693N/A#define MAX_INPUT_DIMENSIONS 8
2693N/A
2693N/Atypedef struct _cms_interp_struc { // Used on all interpolations. Supplied by lcms2 when calling the interpolation function
2693N/A
2693N/A cmsContext ContextID; // The calling thread
2693N/A
2693N/A cmsUInt32Number dwFlags; // Keep original flags
2693N/A cmsUInt32Number nInputs; // != 1 only in 3D interpolation
2693N/A cmsUInt32Number nOutputs; // != 1 only in 3D interpolation
2693N/A
2693N/A cmsUInt32Number nSamples[MAX_INPUT_DIMENSIONS]; // Valid on all kinds of tables
2693N/A cmsUInt32Number Domain[MAX_INPUT_DIMENSIONS]; // Domain = nSamples - 1
2693N/A
2693N/A cmsUInt32Number opta[MAX_INPUT_DIMENSIONS]; // Optimization for 3D CLUT. This is the number of nodes premultiplied for each
2693N/A // dimension. For example, in 7 nodes, 7, 7^2 , 7^3, 7^4, etc. On non-regular
2693N/A // Samplings may vary according of the number of nodes for each dimension.
2693N/A
2693N/A const void *Table; // Points to the actual interpolation table
2693N/A cmsInterpFunction Interpolation; // Points to the function to do the interpolation
2693N/A
2693N/A } cmsInterpParams;
2693N/A
2693N/A// Interpolators factory
2693N/Atypedef cmsInterpFunction (* cmsInterpFnFactory)(cmsUInt32Number nInputChannels, cmsUInt32Number nOutputChannels, cmsUInt32Number dwFlags);
2693N/A
2693N/A// The plug-in
2693N/Atypedef struct {
2693N/A cmsPluginBase base;
2693N/A
2693N/A // Points to a user-supplied function which implements the factory
2693N/A cmsInterpFnFactory InterpolatorsFactory;
2693N/A
2693N/A} cmsPluginInterpolation;
2693N/A
2693N/A//----------------------------------------------------------------------------------------------------------
2693N/A
2693N/A// Parametric curves. A negative type means same function but analytically inverted. Max. number of params is 10
2693N/A
2693N/A// Evaluator callback for user-suplied parametric curves. May implement more than one type
2693N/Atypedef cmsFloat64Number (* cmsParametricCurveEvaluator)(cmsInt32Number Type, const cmsFloat64Number Params[10], cmsFloat64Number R);
2693N/A
2693N/A// Plug-in may implement an arbitrary number of parametric curves
2693N/Atypedef struct {
2693N/A cmsPluginBase base;
2693N/A
2693N/A cmsUInt32Number nFunctions; // Number of supported functions
2693N/A cmsUInt32Number FunctionTypes[MAX_TYPES_IN_LCMS_PLUGIN]; // The identification types
2693N/A cmsUInt32Number ParameterCount[MAX_TYPES_IN_LCMS_PLUGIN]; // Number of parameters for each function
2693N/A
2693N/A cmsParametricCurveEvaluator Evaluator; // The evaluator
2693N/A
2693N/A} cmsPluginParametricCurves;
2693N/A//----------------------------------------------------------------------------------------------------------
2693N/A
2693N/A// Formatters. This plug-in adds new handlers, replacing them if they already exist. Formatters dealing with
2693N/A// cmsFloat32Number (bps = 4) or double (bps = 0) types are requested via FormatterFloat callback. Others come across
2693N/A// Formatter16 callback
2693N/A
2693N/Astruct _cmstransform_struct;
2693N/A
2693N/Atypedef cmsUInt8Number* (* cmsFormatter16)(register struct _cmstransform_struct* CMMcargo,
2693N/A register cmsUInt16Number Values[],
2693N/A register cmsUInt8Number* Buffer,
2693N/A register cmsUInt32Number Stride);
2693N/A
2693N/Atypedef cmsUInt8Number* (* cmsFormatterFloat)(struct _cmstransform_struct* CMMcargo,
2693N/A cmsFloat32Number Values[],
2693N/A cmsUInt8Number* Buffer,
2693N/A cmsUInt32Number Stride);
2693N/A
2693N/A// This type holds a pointer to a formatter that can be either 16 bits or cmsFloat32Number
2693N/Atypedef union {
2693N/A cmsFormatter16 Fmt16;
2693N/A cmsFormatterFloat FmtFloat;
2693N/A
2693N/A} cmsFormatter;
2693N/A
2693N/A#define CMS_PACK_FLAGS_16BITS 0x0000
2693N/A#define CMS_PACK_FLAGS_FLOAT 0x0001
2693N/A
2693N/Atypedef enum { cmsFormatterInput=0, cmsFormatterOutput=1 } cmsFormatterDirection;
2693N/A
2693N/Atypedef cmsFormatter (* cmsFormatterFactory)(cmsUInt32Number Type, // Specific type, i.e. TYPE_RGB_8
2693N/A cmsFormatterDirection Dir,
2693N/A cmsUInt32Number dwFlags); // precision
2693N/A
2693N/A// Plug-in may implement an arbitrary number of formatters
2693N/Atypedef struct {
2693N/A cmsPluginBase base;
2693N/A cmsFormatterFactory FormattersFactory;
2693N/A
2693N/A} cmsPluginFormatters;
2693N/A
2693N/A//----------------------------------------------------------------------------------------------------------
2693N/A
2693N/A// Tag type handler. Each type is free to return anything it wants, and it is up to the caller to
2693N/A// know in advance what is the type contained in the tag.
2693N/Atypedef struct _cms_typehandler_struct {
2693N/A
2693N/A cmsTagTypeSignature Signature; // The signature of the type
2693N/A
2693N/A // Allocates and reads items
2693N/A void * (* ReadPtr)(struct _cms_typehandler_struct* self,
2693N/A cmsIOHANDLER* io,
2693N/A cmsUInt32Number* nItems,
2693N/A cmsUInt32Number SizeOfTag);
2693N/A
2693N/A // Writes n Items
2693N/A cmsBool (* WritePtr)(struct _cms_typehandler_struct* self,
2693N/A cmsIOHANDLER* io,
2693N/A void* Ptr,
2693N/A cmsUInt32Number nItems);
2693N/A
2693N/A // Duplicate an item or array of items
2693N/A void* (* DupPtr)(struct _cms_typehandler_struct* self,
2693N/A const void *Ptr,
2693N/A cmsUInt32Number n);
2693N/A
2693N/A // Free all resources
2693N/A void (* FreePtr)(struct _cms_typehandler_struct* self,
2693N/A void *Ptr);
2693N/A
6271N/A // Additional parameters used by the calling thread
6271N/A cmsContext ContextID;
6271N/A cmsUInt32Number ICCVersion;
2693N/A
2693N/A} cmsTagTypeHandler;
2693N/A
2693N/A// Each plug-in implements a single type
2693N/Atypedef struct {
2693N/A cmsPluginBase base;
2693N/A cmsTagTypeHandler Handler;
2693N/A
2693N/A} cmsPluginTagType;
2693N/A
2693N/A//----------------------------------------------------------------------------------------------------------
2693N/A
2693N/A// This is the tag plugin, which identifies tags. For writing, a pointer to function is provided.
2693N/A// This function should return the desired type for this tag, given the version of profile
2693N/A// and the data being serialized.
2693N/Atypedef struct {
2693N/A
2693N/A cmsUInt32Number ElemCount; // If this tag needs an array, how many elements should keep
2693N/A
2693N/A // For reading.
2693N/A cmsUInt32Number nSupportedTypes; // In how many types this tag can come (MAX_TYPES_IN_LCMS_PLUGIN maximum)
2693N/A cmsTagTypeSignature SupportedTypes[MAX_TYPES_IN_LCMS_PLUGIN];
2693N/A
2693N/A // For writting
2693N/A cmsTagTypeSignature (* DecideType)(cmsFloat64Number ICCVersion, const void *Data);
2693N/A
2693N/A} cmsTagDescriptor;
2693N/A
2693N/A// Plug-in implements a single tag
2693N/Atypedef struct {
2693N/A cmsPluginBase base;
2693N/A
2693N/A cmsTagSignature Signature;
2693N/A cmsTagDescriptor Descriptor;
2693N/A
2693N/A} cmsPluginTag;
2693N/A
2693N/A//----------------------------------------------------------------------------------------------------------
2693N/A
2693N/A// Custom intents. This function should join all profiles specified in the array in
2693N/A// a single LUT. Any custom intent in the chain redirects to custom function. If more than
2693N/A// one custom intent is found, the one located first is invoked. Usually users should use only one
2693N/A// custom intent, so mixing custom intents in same multiprofile transform is not supported.
2693N/A
2693N/Atypedef cmsPipeline* (* cmsIntentFn)( cmsContext ContextID,
2693N/A cmsUInt32Number nProfiles,
2693N/A cmsUInt32Number Intents[],
2693N/A cmsHPROFILE hProfiles[],
2693N/A cmsBool BPC[],
2693N/A cmsFloat64Number AdaptationStates[],
2693N/A cmsUInt32Number dwFlags);
2693N/A
2693N/A
2693N/A// Each plug-in defines a single intent number.
2693N/Atypedef struct {
2693N/A cmsPluginBase base;
2693N/A cmsUInt32Number Intent;
2693N/A cmsIntentFn Link;
2693N/A char Description[256];
2693N/A
2693N/A} cmsPluginRenderingIntent;
2693N/A
2693N/A
2693N/A// The default ICC intents (perceptual, saturation, rel.col and abs.col)
2693N/ACMSAPI cmsPipeline* CMSEXPORT _cmsDefaultICCintents(cmsContext ContextID,
2693N/A cmsUInt32Number nProfiles,
2693N/A cmsUInt32Number Intents[],
2693N/A cmsHPROFILE hProfiles[],
2693N/A cmsBool BPC[],
2693N/A cmsFloat64Number AdaptationStates[],
2693N/A cmsUInt32Number dwFlags);
2693N/A
2693N/A
2693N/A//----------------------------------------------------------------------------------------------------------
2693N/A
2693N/A// Pipelines, Multi Process Elements.
2693N/A
2693N/Atypedef void (* _cmsStageEvalFn) (const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsStage* mpe);
2693N/Atypedef void*(* _cmsStageDupElemFn) (cmsStage* mpe);
2693N/Atypedef void (* _cmsStageFreeElemFn) (cmsStage* mpe);
2693N/A
2693N/A
2693N/A// This function allocates a generic MPE
2693N/ACMSAPI cmsStage* CMSEXPORT _cmsStageAllocPlaceholder(cmsContext ContextID,
2693N/A cmsStageSignature Type,
2693N/A cmsUInt32Number InputChannels,
2693N/A cmsUInt32Number OutputChannels,
2693N/A _cmsStageEvalFn EvalPtr, // Points to fn that evaluates the element (always in floating point)
2693N/A _cmsStageDupElemFn DupElemPtr, // Points to a fn that duplicates the stage
2693N/A _cmsStageFreeElemFn FreePtr, // Points to a fn that sets the element free
2693N/A void* Data); // A generic pointer to whatever memory needed by the element
2693N/Atypedef struct {
2693N/A cmsPluginBase base;
2693N/A cmsTagTypeHandler Handler;
2693N/A
2693N/A} cmsPluginMultiProcessElement;
2693N/A
6271N/A
6271N/A// Data kept in "Element" member of cmsStage
6271N/A
6271N/A// Curves
6271N/Atypedef struct {
6271N/A cmsUInt32Number nCurves;
6271N/A cmsToneCurve** TheCurves;
6271N/A
6271N/A} _cmsStageToneCurvesData;
6271N/A
6271N/A// Matrix
6271N/Atypedef struct {
6271N/A cmsFloat64Number* Double; // floating point for the matrix
6271N/A cmsFloat64Number* Offset; // The offset
6271N/A
6271N/A} _cmsStageMatrixData;
6271N/A
6271N/A// CLUT
6271N/Atypedef struct {
6271N/A
6271N/A union { // Can have only one of both representations at same time
6271N/A cmsUInt16Number* T; // Points to the table 16 bits table
6271N/A cmsFloat32Number* TFloat; // Points to the cmsFloat32Number table
6271N/A
6271N/A } Tab;
6271N/A
6271N/A cmsInterpParams* Params;
6271N/A cmsUInt32Number nEntries;
6271N/A cmsBool HasFloatValues;
6271N/A
6271N/A} _cmsStageCLutData;
6271N/A
6271N/A
2693N/A//----------------------------------------------------------------------------------------------------------
2693N/A// Optimization. Using this plug-in, additional optimization strategies may be implemented.
2693N/A// The function should return TRUE if any optimization is done on the LUT, this terminates
2693N/A// the optimization search. Or FALSE if it is unable to optimize and want to give a chance
2693N/A// to the rest of optimizers.
2693N/A
2693N/Atypedef void (* _cmsOPTeval16Fn)(register const cmsUInt16Number In[],
2693N/A register cmsUInt16Number Out[],
2693N/A register const void* Data);
2693N/A
2693N/A
2693N/Atypedef cmsBool (* _cmsOPToptimizeFn)(cmsPipeline** Lut,
2693N/A cmsUInt32Number Intent,
2693N/A cmsUInt32Number* InputFormat,
2693N/A cmsUInt32Number* OutputFormat,
2693N/A cmsUInt32Number* dwFlags);
2693N/A
2693N/A// This function may be used to set the optional evaluator and a block of private data. If private data is being used, an optional
2693N/A// duplicator and free functions should also be specified in order to duplicate the LUT construct. Use NULL to inhibit such functionality.
2693N/A
2693N/ACMSAPI void CMSEXPORT _cmsPipelineSetOptimizationParameters(cmsPipeline* Lut,
2693N/A _cmsOPTeval16Fn Eval16,
2693N/A void* PrivateData,
6271N/A _cmsFreeUserDataFn FreePrivateDataFn,
6271N/A _cmsDupUserDataFn DupPrivateDataFn);
2693N/A
2693N/Atypedef struct {
2693N/A cmsPluginBase base;
2693N/A
2693N/A // Optimize entry point
2693N/A _cmsOPToptimizeFn OptimizePtr;
2693N/A
2693N/A} cmsPluginOptimization;
2693N/A
2693N/A//----------------------------------------------------------------------------------------------------------
6271N/A// Full xform
6271N/Atypedef void (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo,
6271N/A const void* InputBuffer,
6271N/A void* OutputBuffer,
6271N/A cmsUInt32Number Size,
6271N/A cmsUInt32Number Stride);
6271N/A
6271N/Atypedef cmsBool (* _cmsTransformFactory)(_cmsTransformFn* xform,
6271N/A void** UserData,
6271N/A _cmsFreeUserDataFn* FreePrivateDataFn,
6271N/A cmsPipeline** Lut,
6271N/A cmsUInt32Number* InputFormat,
6271N/A cmsUInt32Number* OutputFormat,
6271N/A cmsUInt32Number* dwFlags);
6271N/A
6271N/A
6271N/A// Retrieve user data as specified by the factory
6271N/ACMSAPI void CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn);
6271N/ACMSAPI void * CMSEXPORT _cmsGetTransformUserData(struct _cmstransform_struct *CMMcargo);
6271N/A
6271N/A
6271N/A// Retrieve formatters
6271N/ACMSAPI void CMSEXPORT _cmsGetTransformFormatters16 (struct _cmstransform_struct *CMMcargo, cmsFormatter16* FromInput, cmsFormatter16* ToOutput);
6271N/ACMSAPI void CMSEXPORT _cmsGetTransformFormattersFloat(struct _cmstransform_struct *CMMcargo, cmsFormatterFloat* FromInput, cmsFormatterFloat* ToOutput);
6271N/A
6271N/Atypedef struct {
6271N/A cmsPluginBase base;
6271N/A
6271N/A // Transform entry point
6271N/A _cmsTransformFactory Factory;
6271N/A
6271N/A} cmsPluginTransform;
6271N/A
2693N/A
2693N/A#ifndef CMS_USE_CPP_API
2693N/A# ifdef __cplusplus
2693N/A }
2693N/A# endif
2693N/A#endif
2693N/A
2693N/A#define _lcms_plugin_H
2693N/A#endif