home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / evbl0627.zip / everblue_20010627.zip / x11 / Xcms_SetCCC.c < prev    next >
C/C++ Source or Header  |  1999-11-02  |  4KB  |  156 lines

  1. /* $XConsortium: SetCCC.c,v 1.5 93/09/07 21:32:37 rws 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.  
  37. #include "Xlib_private.h"
  38. #include "Xcms.h"
  39.  
  40.  
  41.  
  42. /************************************************************************
  43.  *                                    *
  44.  *            PUBLIC INTERFACES                *
  45.  *                                    *
  46.  ************************************************************************/
  47.  
  48. /*
  49.  *    NAME
  50.  *        XcmsSetWhitePoint
  51.  *
  52.  *    SYNOPSIS
  53.  */
  54.  
  55. Status
  56. XcmsSetWhitePoint(ccc, pColor)
  57.     XcmsCCC ccc;
  58.     XcmsColor *pColor;
  59. /*
  60.  *    DESCRIPTION
  61.  *        Sets the Client White Point in the specified CCC.
  62.  *
  63.  *    RETURNS
  64.  *        Returns XcmsSuccess if succeeded; otherwise XcmsFailure.
  65.  *
  66.  */
  67. {
  68.     DBUG_ENTER("XcmsSetWhitePoint")
  69.     if (pColor == NULL || pColor->format == XcmsUndefinedFormat) {
  70.     ccc->clientWhitePt.format = XcmsUndefinedFormat;
  71.     } else if (pColor->format != XcmsCIEXYZFormat &&
  72.         pColor->format != XcmsCIEuvYFormat &&
  73.         pColor->format != XcmsCIExyYFormat) {
  74.     DBUG_RETURN(XcmsFailure);
  75.     } else {
  76.     memcpy((char *)&ccc->clientWhitePt, (char *)pColor, sizeof(XcmsColor));
  77.     }
  78.     DBUG_RETURN(XcmsSuccess);
  79. }
  80.  
  81.  
  82. /*
  83.  *    NAME
  84.  *        XcmsSetCompressionProc
  85.  *
  86.  *    SYNOPSIS
  87.  */
  88.  
  89. XcmsCompressionProc
  90. #if NeedFunctionPrototypes
  91. XcmsSetCompressionProc(
  92.     XcmsCCC ccc,
  93.     XcmsCompressionProc compression_proc,
  94.     XPointer client_data)
  95. #else
  96. XcmsSetCompressionProc(ccc, compression_proc, client_data)
  97.     XcmsCCC ccc;
  98.     XcmsCompressionProc compression_proc;
  99.     XPointer client_data;
  100. #endif
  101. /*
  102.  *    DESCRIPTION
  103.  *        Set the specified CCC's compression function and client data.
  104.  *
  105.  *    RETURNS
  106.  *        Returns the old compression function.
  107.  *
  108.  */
  109. {
  110.     DBUG_ENTER("XcmsSetCompressionProc")
  111.     XcmsCompressionProc old;
  112.     old = ccc->gamutCompProc;
  113.  
  114.     ccc->gamutCompProc = compression_proc;
  115.     ccc->gamutCompClientData = client_data;
  116.     DBUG_RETURN(old);
  117. }
  118.  
  119.  
  120. /*
  121.  *    NAME
  122.  *        XcmsSetWhiteAdjustProc
  123.  *
  124.  *    SYNOPSIS
  125.  */
  126.  
  127. XcmsWhiteAdjustProc
  128. #if NeedFunctionPrototypes
  129. XcmsSetWhiteAdjustProc(
  130.     XcmsCCC ccc,
  131.     XcmsWhiteAdjustProc white_adjust_proc,
  132.     XPointer client_data )
  133. #else
  134. XcmsSetWhiteAdjustProc(ccc, white_adjust_proc, client_data)
  135.     XcmsCCC ccc;
  136.     XcmsWhiteAdjustProc white_adjust_proc;
  137.     XPointer client_data;
  138. #endif
  139. /*
  140.  *    DESCRIPTION
  141.  *        Set the specified CCC's white_adjust function and client data.
  142.  *
  143.  *    RETURNS
  144.  *        Returns the old white_adjust function.
  145.  *
  146.  */
  147. {
  148.     DBUG_ENTER("XcmsSetWhiteAdjustProc")
  149.     XcmsWhiteAdjustProc old;
  150.     old = ccc->whitePtAdjProc;
  151.  
  152.     ccc->whitePtAdjProc = white_adjust_proc;
  153.     ccc->whitePtAdjClientData = client_data;
  154.     DBUG_RETURN(old);
  155. }
  156.