13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25 // This file is available under and governed by the GNU General Public
26 // License version 2 only, as published by the Free Software Foundation.
27 // However, the following notice accompanied the original version of this
28 // file:
29 //
30 //---------------------------------------------------------------------------------
31 //
32 // Little Color Management System
33 // Copyright (c) 1998-2011 Marti Maria Saguer
34 //
35 // Permission is hereby granted, free of charge, to any person obtaining
36 // a copy of this software and associated documentation files (the "Software"),
37 // to deal in the Software without restriction, including without limitation
38 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
39 // and/or sell copies of the Software, and to permit persons to whom the Software
40 // is furnished to do so, subject to the following conditions:
41 //
42 // The above copyright notice and this permission notice shall be included in
43 // all copies or substantial portions of the Software.
44 //
45 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
46 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
47 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
48 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
49 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
50 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
51 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52 //
53 //---------------------------------------------------------------------------------
140
141 struct _cms_io_handler {
142
143 void* stream; // Associated stream, which is implemented differently depending on media.
144
145 cmsContext ContextID;
146 cmsUInt32Number UsedSpace;
147 cmsUInt32Number ReportedSize;
148 char PhysicalFile[cmsMAX_PATH];
149
150 cmsUInt32Number (* Read)(struct _cms_io_handler* iohandler, void *Buffer,
151 cmsUInt32Number size,
152 cmsUInt32Number count);
153 cmsBool (* Seek)(struct _cms_io_handler* iohandler, cmsUInt32Number offset);
154 cmsBool (* Close)(struct _cms_io_handler* iohandler);
155 cmsUInt32Number (* Tell)(struct _cms_io_handler* iohandler);
156 cmsBool (* Write)(struct _cms_io_handler* iohandler, cmsUInt32Number size,
157 const void* Buffer);
158 };
159
160 // Endianess adjust functions
161 CMSAPI cmsUInt16Number CMSEXPORT _cmsAdjustEndianess16(cmsUInt16Number Word);
162 CMSAPI cmsUInt32Number CMSEXPORT _cmsAdjustEndianess32(cmsUInt32Number Value);
163 CMSAPI void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord);
164
165 // Helper IO functions
166 CMSAPI cmsBool CMSEXPORT _cmsReadUInt8Number(cmsIOHANDLER* io, cmsUInt8Number* n);
167 CMSAPI cmsBool CMSEXPORT _cmsReadUInt16Number(cmsIOHANDLER* io, cmsUInt16Number* n);
168 CMSAPI cmsBool CMSEXPORT _cmsReadUInt32Number(cmsIOHANDLER* io, cmsUInt32Number* n);
169 CMSAPI cmsBool CMSEXPORT _cmsReadFloat32Number(cmsIOHANDLER* io, cmsFloat32Number* n);
170 CMSAPI cmsBool CMSEXPORT _cmsReadUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n);
171 CMSAPI cmsBool CMSEXPORT _cmsRead15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number* n);
172 CMSAPI cmsBool CMSEXPORT _cmsReadXYZNumber(cmsIOHANDLER* io, cmsCIEXYZ* XYZ);
173 CMSAPI cmsBool CMSEXPORT _cmsReadUInt16Array(cmsIOHANDLER* io, cmsUInt32Number n, cmsUInt16Number* Array);
174
175 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt8Number(cmsIOHANDLER* io, cmsUInt8Number n);
176 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt16Number(cmsIOHANDLER* io, cmsUInt16Number n);
177 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt32Number(cmsIOHANDLER* io, cmsUInt32Number n);
178 CMSAPI cmsBool CMSEXPORT _cmsWriteFloat32Number(cmsIOHANDLER* io, cmsFloat32Number n);
179 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n);
180 CMSAPI cmsBool CMSEXPORT _cmsWrite15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number n);
583
584 // This function may be used to set the optional evaluator and a block of private data. If private data is being used, an optional
585 // duplicator and free functions should also be specified in order to duplicate the LUT construct. Use NULL to inhibit such functionality.
586
587 CMSAPI void CMSEXPORT _cmsPipelineSetOptimizationParameters(cmsPipeline* Lut,
588 _cmsOPTeval16Fn Eval16,
589 void* PrivateData,
590 _cmsFreeUserDataFn FreePrivateDataFn,
591 _cmsDupUserDataFn DupPrivateDataFn);
592
593 typedef struct {
594 cmsPluginBase base;
595
596 // Optimize entry point
597 _cmsOPToptimizeFn OptimizePtr;
598
599 } cmsPluginOptimization;
600
601 //----------------------------------------------------------------------------------------------------------
602 // Full xform
603 typedef void (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo,
604 const void* InputBuffer,
605 void* OutputBuffer,
606 cmsUInt32Number Size,
607 cmsUInt32Number Stride);
608
609 typedef cmsBool (* _cmsTransformFactory)(_cmsTransformFn* xform,
610 void** UserData,
611 _cmsFreeUserDataFn* FreePrivateDataFn,
612 cmsPipeline** Lut,
613 cmsUInt32Number* InputFormat,
614 cmsUInt32Number* OutputFormat,
615 cmsUInt32Number* dwFlags);
616
617
618 // Retrieve user data as specified by the factory
619 CMSAPI void CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn);
620 CMSAPI void * CMSEXPORT _cmsGetTransformUserData(struct _cmstransform_struct *CMMcargo);
621
622
623 // Retrieve formatters
624 CMSAPI void CMSEXPORT _cmsGetTransformFormatters16 (struct _cmstransform_struct *CMMcargo, cmsFormatter16* FromInput, cmsFormatter16* ToOutput);
625 CMSAPI void CMSEXPORT _cmsGetTransformFormattersFloat(struct _cmstransform_struct *CMMcargo, cmsFormatterFloat* FromInput, cmsFormatterFloat* ToOutput);
626
627 typedef struct {
628 cmsPluginBase base;
629
630 // Transform entry point
631 _cmsTransformFactory Factory;
632
633 } cmsPluginTransform;
634
635 //----------------------------------------------------------------------------------------------------------
636 // Mutex
637
638 typedef void* (* _cmsCreateMutexFnPtrType)(cmsContext ContextID);
639 typedef void (* _cmsDestroyMutexFnPtrType)(cmsContext ContextID, void* mtx);
640 typedef cmsBool (* _cmsLockMutexFnPtrType)(cmsContext ContextID, void* mtx);
641 typedef void (* _cmsUnlockMutexFnPtrType)(cmsContext ContextID, void* mtx);
642
643 typedef struct {
644 cmsPluginBase base;
645
646 _cmsCreateMutexFnPtrType CreateMutexPtr;
647 _cmsDestroyMutexFnPtrType DestroyMutexPtr;
648 _cmsLockMutexFnPtrType LockMutexPtr;
649 _cmsUnlockMutexFnPtrType UnlockMutexPtr;
650
651 } cmsPluginMutex;
|
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 */
24
25 // This file is available under and governed by the GNU General Public
26 // License version 2 only, as published by the Free Software Foundation.
27 // However, the following notice accompanied the original version of this
28 // file:
29 //
30 //---------------------------------------------------------------------------------
31 //
32 // Little Color Management System
33 // Copyright (c) 1998-2016 Marti Maria Saguer
34 //
35 // Permission is hereby granted, free of charge, to any person obtaining
36 // a copy of this software and associated documentation files (the "Software"),
37 // to deal in the Software without restriction, including without limitation
38 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
39 // and/or sell copies of the Software, and to permit persons to whom the Software
40 // is furnished to do so, subject to the following conditions:
41 //
42 // The above copyright notice and this permission notice shall be included in
43 // all copies or substantial portions of the Software.
44 //
45 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
46 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
47 // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
48 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
49 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
50 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
51 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52 //
53 //---------------------------------------------------------------------------------
140
141 struct _cms_io_handler {
142
143 void* stream; // Associated stream, which is implemented differently depending on media.
144
145 cmsContext ContextID;
146 cmsUInt32Number UsedSpace;
147 cmsUInt32Number ReportedSize;
148 char PhysicalFile[cmsMAX_PATH];
149
150 cmsUInt32Number (* Read)(struct _cms_io_handler* iohandler, void *Buffer,
151 cmsUInt32Number size,
152 cmsUInt32Number count);
153 cmsBool (* Seek)(struct _cms_io_handler* iohandler, cmsUInt32Number offset);
154 cmsBool (* Close)(struct _cms_io_handler* iohandler);
155 cmsUInt32Number (* Tell)(struct _cms_io_handler* iohandler);
156 cmsBool (* Write)(struct _cms_io_handler* iohandler, cmsUInt32Number size,
157 const void* Buffer);
158 };
159
160 // Endianness adjust functions
161 CMSAPI cmsUInt16Number CMSEXPORT _cmsAdjustEndianess16(cmsUInt16Number Word);
162 CMSAPI cmsUInt32Number CMSEXPORT _cmsAdjustEndianess32(cmsUInt32Number Value);
163 CMSAPI void CMSEXPORT _cmsAdjustEndianess64(cmsUInt64Number* Result, cmsUInt64Number* QWord);
164
165 // Helper IO functions
166 CMSAPI cmsBool CMSEXPORT _cmsReadUInt8Number(cmsIOHANDLER* io, cmsUInt8Number* n);
167 CMSAPI cmsBool CMSEXPORT _cmsReadUInt16Number(cmsIOHANDLER* io, cmsUInt16Number* n);
168 CMSAPI cmsBool CMSEXPORT _cmsReadUInt32Number(cmsIOHANDLER* io, cmsUInt32Number* n);
169 CMSAPI cmsBool CMSEXPORT _cmsReadFloat32Number(cmsIOHANDLER* io, cmsFloat32Number* n);
170 CMSAPI cmsBool CMSEXPORT _cmsReadUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n);
171 CMSAPI cmsBool CMSEXPORT _cmsRead15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number* n);
172 CMSAPI cmsBool CMSEXPORT _cmsReadXYZNumber(cmsIOHANDLER* io, cmsCIEXYZ* XYZ);
173 CMSAPI cmsBool CMSEXPORT _cmsReadUInt16Array(cmsIOHANDLER* io, cmsUInt32Number n, cmsUInt16Number* Array);
174
175 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt8Number(cmsIOHANDLER* io, cmsUInt8Number n);
176 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt16Number(cmsIOHANDLER* io, cmsUInt16Number n);
177 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt32Number(cmsIOHANDLER* io, cmsUInt32Number n);
178 CMSAPI cmsBool CMSEXPORT _cmsWriteFloat32Number(cmsIOHANDLER* io, cmsFloat32Number n);
179 CMSAPI cmsBool CMSEXPORT _cmsWriteUInt64Number(cmsIOHANDLER* io, cmsUInt64Number* n);
180 CMSAPI cmsBool CMSEXPORT _cmsWrite15Fixed16Number(cmsIOHANDLER* io, cmsFloat64Number n);
583
584 // This function may be used to set the optional evaluator and a block of private data. If private data is being used, an optional
585 // duplicator and free functions should also be specified in order to duplicate the LUT construct. Use NULL to inhibit such functionality.
586
587 CMSAPI void CMSEXPORT _cmsPipelineSetOptimizationParameters(cmsPipeline* Lut,
588 _cmsOPTeval16Fn Eval16,
589 void* PrivateData,
590 _cmsFreeUserDataFn FreePrivateDataFn,
591 _cmsDupUserDataFn DupPrivateDataFn);
592
593 typedef struct {
594 cmsPluginBase base;
595
596 // Optimize entry point
597 _cmsOPToptimizeFn OptimizePtr;
598
599 } cmsPluginOptimization;
600
601 //----------------------------------------------------------------------------------------------------------
602 // Full xform
603
604 typedef struct {
605 cmsUInt32Number BytesPerLineIn;
606 cmsUInt32Number BytesPerLineOut;
607 cmsUInt32Number BytesPerPlaneIn;
608 cmsUInt32Number BytesPerPlaneOut;
609
610 } cmsStride;
611
612 typedef void (* _cmsTransformFn)(struct _cmstransform_struct *CMMcargo, // Legacy function, handles just ONE scanline.
613 const void* InputBuffer,
614 void* OutputBuffer,
615 cmsUInt32Number Size,
616 cmsUInt32Number Stride); // Stride in bytes to the next plana in planar formats
617
618
619 typedef void (*_cmsTransform2Fn)(struct _cmstransform_struct *CMMcargo,
620 const void* InputBuffer,
621 void* OutputBuffer,
622 cmsUInt32Number PixelsPerLine,
623 cmsUInt32Number LineCount,
624 const cmsStride* Stride);
625
626 typedef cmsBool (* _cmsTransformFactory)(_cmsTransformFn* xform,
627 void** UserData,
628 _cmsFreeUserDataFn* FreePrivateDataFn,
629 cmsPipeline** Lut,
630 cmsUInt32Number* InputFormat,
631 cmsUInt32Number* OutputFormat,
632 cmsUInt32Number* dwFlags);
633
634 typedef cmsBool (* _cmsTransform2Factory)(_cmsTransform2Fn* xform,
635 void** UserData,
636 _cmsFreeUserDataFn* FreePrivateDataFn,
637 cmsPipeline** Lut,
638 cmsUInt32Number* InputFormat,
639 cmsUInt32Number* OutputFormat,
640 cmsUInt32Number* dwFlags);
641
642
643 // Retrieve user data as specified by the factory
644 CMSAPI void CMSEXPORT _cmsSetTransformUserData(struct _cmstransform_struct *CMMcargo, void* ptr, _cmsFreeUserDataFn FreePrivateDataFn);
645 CMSAPI void * CMSEXPORT _cmsGetTransformUserData(struct _cmstransform_struct *CMMcargo);
646
647
648 // Retrieve formatters
649 CMSAPI void CMSEXPORT _cmsGetTransformFormatters16 (struct _cmstransform_struct *CMMcargo, cmsFormatter16* FromInput, cmsFormatter16* ToOutput);
650 CMSAPI void CMSEXPORT _cmsGetTransformFormattersFloat(struct _cmstransform_struct *CMMcargo, cmsFormatterFloat* FromInput, cmsFormatterFloat* ToOutput);
651
652 typedef struct {
653 cmsPluginBase base;
654
655 // Transform entry point
656 union {
657 _cmsTransformFactory legacy_xform;
658 _cmsTransform2Factory xform;
659 } factories;
660
661 } cmsPluginTransform;
662
663 //----------------------------------------------------------------------------------------------------------
664 // Mutex
665
666 typedef void* (* _cmsCreateMutexFnPtrType)(cmsContext ContextID);
667 typedef void (* _cmsDestroyMutexFnPtrType)(cmsContext ContextID, void* mtx);
668 typedef cmsBool (* _cmsLockMutexFnPtrType)(cmsContext ContextID, void* mtx);
669 typedef void (* _cmsUnlockMutexFnPtrType)(cmsContext ContextID, void* mtx);
670
671 typedef struct {
672 cmsPluginBase base;
673
674 _cmsCreateMutexFnPtrType CreateMutexPtr;
675 _cmsDestroyMutexFnPtrType DestroyMutexPtr;
676 _cmsLockMutexFnPtrType LockMutexPtr;
677 _cmsUnlockMutexFnPtrType UnlockMutexPtr;
678
679 } cmsPluginMutex;
|