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