SetCCC.c revision 61b2299d
1/* $Xorg: SetCCC.c,v 1.3 2000/08/17 19:44:52 cpqbld Exp $ */ 2 3/* 4 * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. 5 * All Rights Reserved 6 * 7 * This file is a component of an X Window System-specific implementation 8 * of Xcms based on the TekColor Color Management System. Permission is 9 * hereby granted to use, copy, modify, sell, and otherwise distribute this 10 * software and its documentation for any purpose and without fee, provided 11 * that this copyright, permission, and disclaimer notice is reproduced in 12 * all copies of this software and in supporting documentation. TekColor 13 * is a trademark of Tektronix, Inc. 14 * 15 * Tektronix makes no representation about the suitability of this software 16 * for any purpose. It is provided "as is" and with all faults. 17 * 18 * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, 19 * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY 21 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER 22 * RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER IN AN ACTION OF 23 * CONTRACT, NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 24 * CONNECTION WITH THE USE OR THE PERFORMANCE OF THIS SOFTWARE. 25 * 26 * 27 * NAME 28 * XcmsSetCCC.c - Color Conversion Context Setting Routines 29 * 30 * DESCRIPTION 31 * Routines to set components of a Color Conversion 32 * Context structure. 33 * 34 * 35 */ 36/* $XFree86$ */ 37 38#ifdef HAVE_CONFIG_H 39#include <config.h> 40#endif 41#include "Xlibint.h" 42#include "Xcms.h" 43 44 45 46/************************************************************************ 47 * * 48 * PUBLIC INTERFACES * 49 * * 50 ************************************************************************/ 51 52/* 53 * NAME 54 * XcmsSetWhitePoint 55 * 56 * SYNOPSIS 57 */ 58 59Status 60XcmsSetWhitePoint( 61 XcmsCCC ccc, 62 XcmsColor *pColor) 63/* 64 * DESCRIPTION 65 * Sets the Client White Point in the specified CCC. 66 * 67 * RETURNS 68 * Returns XcmsSuccess if succeeded; otherwise XcmsFailure. 69 * 70 */ 71{ 72 if (pColor == NULL || pColor->format == XcmsUndefinedFormat) { 73 ccc->clientWhitePt.format = XcmsUndefinedFormat; 74 } else if (pColor->format != XcmsCIEXYZFormat && 75 pColor->format != XcmsCIEuvYFormat && 76 pColor->format != XcmsCIExyYFormat) { 77 return(XcmsFailure); 78 } else { 79 memcpy((char *)&ccc->clientWhitePt, (char *)pColor, sizeof(XcmsColor)); 80 } 81 return(XcmsSuccess); 82} 83 84 85/* 86 * NAME 87 * XcmsSetCompressionProc 88 * 89 * SYNOPSIS 90 */ 91 92XcmsCompressionProc 93XcmsSetCompressionProc( 94 XcmsCCC ccc, 95 XcmsCompressionProc compression_proc, 96 XPointer client_data) 97/* 98 * DESCRIPTION 99 * Set the specified CCC's compression function and client data. 100 * 101 * RETURNS 102 * Returns the old compression function. 103 * 104 */ 105{ 106 XcmsCompressionProc old = ccc->gamutCompProc; 107 108 ccc->gamutCompProc = compression_proc; 109 ccc->gamutCompClientData = client_data; 110 return(old); 111} 112 113 114/* 115 * NAME 116 * XcmsSetWhiteAdjustProc 117 * 118 * SYNOPSIS 119 */ 120 121XcmsWhiteAdjustProc 122XcmsSetWhiteAdjustProc( 123 XcmsCCC ccc, 124 XcmsWhiteAdjustProc white_adjust_proc, 125 XPointer client_data ) 126/* 127 * DESCRIPTION 128 * Set the specified CCC's white_adjust function and client data. 129 * 130 * RETURNS 131 * Returns the old white_adjust function. 132 * 133 */ 134{ 135 XcmsWhiteAdjustProc old = ccc->whitePtAdjProc; 136 137 ccc->whitePtAdjProc = white_adjust_proc; 138 ccc->whitePtAdjClientData = client_data; 139 return(old); 140} 141