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 * XcmsPrOfId.c 28 * 29 * DESCRIPTION 30 * Source for XcmsPrefixOfFormat() 31 * 32 * 33 */ 34 35#ifdef HAVE_CONFIG_H 36#include <config.h> 37#endif 38#include "Xlibint.h" 39#include "Xcmsint.h" 40#include "Cv.h" 41 42 43/* 44 * NAME 45 * XcmsPrefixOfId 46 * 47 * SYNOPSIS 48 */ 49char * 50XcmsPrefixOfFormat( 51 XcmsColorFormat id) 52/* 53 * DESCRIPTION 54 * Returns the color space prefix for the specified color 55 * space ID if the color space is found in the Color 56 * Conversion Context. 57 * 58 * RETURNS 59 * Returns a color space prefix. 60 * 61 * CAVEATS 62 * Space is allocated for the returned string, therefore, 63 * the application is responsible for freeing (using XFree) 64 * the space. 65 * 66 */ 67{ 68 XcmsColorSpace **papColorSpaces; 69 70 /* 71 * First try Device-Independent color spaces 72 */ 73 papColorSpaces = _XcmsDIColorSpaces; 74 if (papColorSpaces != NULL) { 75 while (*papColorSpaces != NULL) { 76 if ((*papColorSpaces)->id == id) { 77 return strdup((*papColorSpaces)->prefix); 78 } 79 papColorSpaces++; 80 } 81 } 82 83 /* 84 * Next try Device-Dependent color spaces 85 */ 86 papColorSpaces = _XcmsDDColorSpaces; 87 if (papColorSpaces != NULL) { 88 while (*papColorSpaces != NULL) { 89 if ((*papColorSpaces)->id == id) { 90 return strdup((*papColorSpaces)->prefix); 91 } 92 papColorSpaces++; 93 } 94 } 95 96 return(NULL); 97} 98