Commit e868fbbf authored by Ulrich Sibiller's avatar Ulrich Sibiller

update xcms files to libX11 1.3.4

parent 27492905
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -55,8 +55,7 @@
* SYNOPSIS
*/
Status
XcmsAddColorSpace(pCS)
XcmsColorSpace *pCS;
XcmsAddColorSpace(XcmsColorSpace *pCS)
/*
* DESCRIPTION
* DI Color Spaces are managed on a global basis.
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -55,8 +55,7 @@
* SYNOPSIS
*/
Status
XcmsAddFunctionSet(pNewFS)
XcmsFunctionSet *pNewFS;
XcmsAddFunctionSet(XcmsFunctionSet *pNewFS)
/*
* DESCRIPTION
* Additional Screen Color Characterization Function Sets are
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -84,17 +84,16 @@ from The Open Group.
* SYNOPSIS
*/
XcmsCCC
XcmsCreateCCC(dpy, screenNumber, visual, clientWhitePt, gamutCompProc,
gamutCompClientData, whitePtAdjProc, whitePtAdjClientData)
Display *dpy;
int screenNumber;
Visual *visual;
XcmsColor *clientWhitePt;
XcmsCompressionProc gamutCompProc;
XPointer gamutCompClientData;
XcmsWhiteAdjustProc whitePtAdjProc;
XPointer whitePtAdjClientData;
XcmsCCC
XcmsCreateCCC(
Display *dpy,
int screenNumber,
Visual *visual,
XcmsColor *clientWhitePt,
XcmsCompressionProc gamutCompProc,
XPointer gamutCompClientData,
XcmsWhiteAdjustProc whitePtAdjProc,
XPointer whitePtAdjClientData)
/*
* DESCRIPTION
* Given a Display, Screen, Visual, etc., this routine creates
......@@ -114,7 +113,7 @@ XcmsCreateCCC(dpy, screenNumber, visual, clientWhitePt, gamutCompProc,
if (pDefaultCCC == NULL ||
!(newccc = (XcmsCCC) Xcalloc(1, (unsigned) sizeof(XcmsCCCRec)))) {
return(NULL);
}
}
/*
* Should inherit the following as result of a memmove():
......@@ -171,10 +170,10 @@ XcmsCreateCCC(dpy, screenNumber, visual, clientWhitePt, gamutCompProc,
*
* SYNOPSIS
*/
XcmsCCC
XcmsDefaultCCC(dpy, screenNumber)
Display *dpy;
int screenNumber;
XcmsCCC
XcmsDefaultCCC(
Display *dpy,
int screenNumber)
/*
* DESCRIPTION
* Given a Display and Screen, this routine creates
......@@ -254,8 +253,7 @@ XcmsDefaultCCC(dpy, screenNumber)
* SYNOPSIS
*/
void
XcmsFreeCCC(ccc)
XcmsCCC ccc;
XcmsFreeCCC(XcmsCCC ccc)
/*
* DESCRIPTION
* Frees memory associated with a Color Conversion Context
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -237,7 +237,7 @@ ConvertMixedColors(
* batches:
* DI to DD
* DD to DI(not CIEXYZ)
*
*
* format_flag:
* 0x01 : convert Device-Dependent only specifications to the
* target format.
......@@ -419,7 +419,7 @@ _XcmsDIConvertColors(
* 3. The calling routine may want to convert only between
* CIExyY <-> CIEXYZ <-> CIEuvY
* therefore, this routine allows pWhitePt to equal NULL.
*
*
*
* RETURNS
* XcmsFailure if failed,
......@@ -505,7 +505,7 @@ Continue:
* complementary, i.e.,
* for an i, 0 <= i < n elements
* from_CIEXYZ[i] is not the inverse of to_CIEXYZ[i]
*
*
* Execute the functions all the way to CIEXYZ
*/
while (*src_to_CIEXYZ) {
......@@ -601,7 +601,7 @@ _XcmsDDConvertColors(
/*
* Its ok if pColors_in_out->format == XcmsCIEXYZFormat
* or
* or
* if newFormat == XcmsCIEXYZFormat
*/
if ( !( ValidDDColorSpaceID(ccc, pColors_in_out->format)
......@@ -668,7 +668,7 @@ Continue:
* complementary, i.e.,
* for an i, 0 <= i < n elements
* from_CIEXYZ[i] is not the inverse of to_CIEXYZ[i]
*
*
* Execute the functions all the way to CIEXYZ
*/
while (*src_to_CIEXYZ) {
......@@ -712,12 +712,12 @@ Continue:
* SYNOPSIS
*/
Status
XcmsConvertColors(ccc, pColors_in_out, nColors, targetFormat, pCompressed)
XcmsCCC ccc;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsColorFormat targetFormat;
Bool *pCompressed;
XcmsConvertColors(
XcmsCCC ccc,
XcmsColor *pColors_in_out,
unsigned int nColors,
XcmsColorFormat targetFormat,
Bool *pCompressed)
/*
* DESCRIPTION
* Convert XcmsColor structures to another format
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. TekColor is a
* trademark of Tektronix, Inc. The term "TekHVC" designates a particular
......@@ -10,10 +10,10 @@
* foreign patents pending). Permission is hereby granted to use, copy,
* modify, sell, and otherwise distribute this software and its
* documentation for any purpose and without fee, provided that:
*
*
* 1. This copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and any modification thereof and in
* supporting documentation;
* supporting documentation;
* 2. Any color-handling application which displays TekHVC color
* cooordinates identifies these as TekHVC color coordinates in any
* interface that displays these coordinates and in any associated
......@@ -23,10 +23,10 @@
* including those provided in this file and any equivalent pathways and
* mathematical derivations, regardless of digital (e.g., floating point
* or integer) representation.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -82,7 +82,7 @@
/*************************************************************************
* Note: The DBL_EPSILON for ANSI is 1e-5 so my checks need to take
* this into account. If your DBL_EPSILON is different then
* adjust this define.
* adjust this define.
*
* Also note that EPS is the error factor in the calculations
* This may need to be the same as XMY_DBL_EPSILON in
......@@ -198,7 +198,24 @@ TekHVC_ParseString(
&pColor->spec.TekHVC.H,
&pColor->spec.TekHVC.V,
&pColor->spec.TekHVC.C) != 3) {
return(XcmsFailure);
char *s; /* Maybe failed due to locale */
int f;
if ((s = strdup(spec))) {
for (f = 0; s[f]; ++f)
if (s[f] == '.')
s[f] = ',';
else if (s[f] == ',')
s[f] = '.';
if (sscanf(s + n + 1, "%lf/%lf/%lf",
&pColor->spec.TekHVC.H,
&pColor->spec.TekHVC.V,
&pColor->spec.TekHVC.C) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure);
}
pColor->format = XcmsTekHVCFormat;
pColor->pixel = 0;
......@@ -299,7 +316,7 @@ XcmsTekHVC_ValidSpec(
}
while (pColor->spec.TekHVC.H >= 360.0) {
pColor->spec.TekHVC.H -= 360.0;
}
}
return(XcmsSuccess);
}
......@@ -310,11 +327,11 @@ XcmsTekHVC_ValidSpec(
* SYNOPSIS
*/
Status
XcmsTekHVCToCIEuvY(ccc, pHVC_WhitePt, pColors_in_out, nColors)
XcmsCCC ccc;
XcmsColor *pHVC_WhitePt;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsTekHVCToCIEuvY(
XcmsCCC ccc,
XcmsColor *pHVC_WhitePt,
XcmsColor *pColors_in_out,
unsigned int nColors)
/*
* DESCRIPTION
* Transforms an array of TekHVC color specifications, given
......@@ -396,9 +413,9 @@ XcmsTekHVCToCIEuvY(ccc, pHVC_WhitePt, pColors_in_out, nColors)
tempHue = radians(tempHue);
/* Calculate u'v' for the obtained hue */
u = (XcmsFloat) ((XCMS_COS(tempHue) * pColor->spec.TekHVC.C) /
u = (XcmsFloat) ((XCMS_COS(tempHue) * pColor->spec.TekHVC.C) /
(pColor->spec.TekHVC.V * (double)CHROMA_SCALE_FACTOR));
v = (XcmsFloat) ((XCMS_SIN(tempHue) * pColor->spec.TekHVC.C) /
v = (XcmsFloat) ((XCMS_SIN(tempHue) * pColor->spec.TekHVC.C) /
(pColor->spec.TekHVC.V * (double)CHROMA_SCALE_FACTOR));
/* Based on the white point get the offset from best red */
......@@ -431,11 +448,11 @@ XcmsTekHVCToCIEuvY(ccc, pHVC_WhitePt, pColors_in_out, nColors)
* SYNOPSIS
*/
Status
XcmsCIEuvYToTekHVC(ccc, pHVC_WhitePt, pColors_in_out, nColors)
XcmsCCC ccc;
XcmsColor *pHVC_WhitePt;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsCIEuvYToTekHVC(
XcmsCCC ccc,
XcmsColor *pHVC_WhitePt,
XcmsColor *pColors_in_out,
unsigned int nColors)
/*
* DESCRIPTION
* Transforms an array of CIECIEuvY.color specifications, given
......@@ -603,6 +620,6 @@ _XcmsTekHVC_CheckModify(
} else if (pColor->spec.TekHVC.H >= 360.0) {
n = pColor->spec.TekHVC.H / 360.0;
pColor->spec.TekHVC.H -= n * 360.0;
}
}
return(1);
}
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. TekColor is a
* trademark of Tektronix, Inc. The term "TekHVC" designates a particular
......@@ -10,10 +10,10 @@
* foreign patents pending). Permission is hereby granted to use, copy,
* modify, sell, and otherwise distribute this software and its
* documentation for any purpose and without fee, provided that:
*
*
* 1. This copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and any modification thereof and in
* supporting documentation;
* supporting documentation;
* 2. Any color-handling application which displays TekHVC color
* cooordinates identifies these as TekHVC color coordinates in any
* interface that displays these coordinates and in any associated
......@@ -23,10 +23,10 @@
* including those provided in this file and any equivalent pathways and
* mathematical derivations, regardless of digital (e.g., floating point
* or integer) representation.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -65,20 +65,20 @@
*/
/* ARGSUSED */
Status
XcmsTekHVCClipC (ccc, pColors_in_out, nColors, i, pCompressed)
XcmsCCC ccc;
XcmsColor *pColors_in_out;
unsigned int nColors;
unsigned int i;
Bool *pCompressed;
XcmsTekHVCClipC (
XcmsCCC ccc,
XcmsColor *pColors_in_out,
unsigned int nColors,
unsigned int i,
Bool *pCompressed)
/*
* DESCRIPTION
* Reduce the Chroma for a specific hue and value to
* to bring the given color into the gamut of the
* to bring the given color into the gamut of the
* specified device. As required of gamut compression
* functions in Xcms, this routine returns pColor_in_out
* in XcmsCIEXYZFormat on successful completion.
*
*
* Since this routine works with the value within
* pColor_in_out intermediate results may be returned
* even though it may be invalid.
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. TekColor is a
* trademark of Tektronix, Inc. The term "TekHVC" designates a particular
......@@ -10,10 +10,10 @@
* foreign patents pending). Permission is hereby granted to use, copy,
* modify, sell, and otherwise distribute this software and its
* documentation for any purpose and without fee, provided that:
*
*
* 1. This copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and any modification thereof and in
* supporting documentation;
* supporting documentation;
* 2. Any color-handling application which displays TekHVC color
* cooordinates identifies these as TekHVC color coordinates in any
* interface that displays these coordinates and in any associated
......@@ -23,10 +23,10 @@
* including those provided in this file and any equivalent pathways and
* mathematical derivations, regardless of digital (e.g., floating point
* or integer) representation.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -65,16 +65,16 @@
*/
/* ARGSUSED */
Status
XcmsTekHVCClipV (ccc, pColors_in_out, nColors, i, pCompressed)
XcmsCCC ccc;
XcmsColor *pColors_in_out;
unsigned int nColors;
unsigned int i;
Bool *pCompressed;
XcmsTekHVCClipV (
XcmsCCC ccc,
XcmsColor *pColors_in_out,
unsigned int nColors,
unsigned int i,
Bool *pCompressed)
/*
* DESCRIPTION
* Return the closest value for a specific hue and chroma.
* This routine takes any color as input and outputs
* This routine takes any color as input and outputs
* a CIE XYZ color.
*
* Since this routine works with the value within
......@@ -114,7 +114,7 @@ XcmsTekHVCClipV (ccc, pColors_in_out, nColors, i, pCompressed)
*/
pColor = pColors_in_out + i;
if (ccc->visual->class < StaticColor &&
FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) {
/*
......@@ -162,7 +162,7 @@ XcmsTekHVCClipV (ccc, pColors_in_out, nColors, i, pCompressed)
/* When the value input is less than the maximum value point */
/* compute the intersection of the line from 0,0 to max_V, max_C */
/* using the chroma input. */
pColor->spec.TekHVC.V = pColor->spec.TekHVC.C *
pColor->spec.TekHVC.V = pColor->spec.TekHVC.C *
hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C;
if (pColor->spec.TekHVC.V >= hvc_max.spec.TekHVC.V) {
pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. TekColor is a
* trademark of Tektronix, Inc. The term "TekHVC" designates a particular
......@@ -10,10 +10,10 @@
* foreign patents pending). Permission is hereby granted to use, copy,
* modify, sell, and otherwise distribute this software and its
* documentation for any purpose and without fee, provided that:
*
*
* 1. This copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and any modification thereof and in
* supporting documentation;
* supporting documentation;
* 2. Any color-handling application which displays TekHVC color
* cooordinates identifies these as TekHVC color coordinates in any
* interface that displays these coordinates and in any associated
......@@ -23,10 +23,10 @@
* including those provided in this file and any equivalent pathways and
* mathematical derivations, regardless of digital (e.g., floating point
* or integer) representation.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -73,15 +73,15 @@
*/
/* ARGSUSED */
Status
XcmsTekHVCClipVC (ccc, pColors_in_out, nColors, i, pCompressed)
XcmsCCC ccc;
XcmsColor *pColors_in_out;
unsigned int nColors;
unsigned int i;
Bool *pCompressed;
XcmsTekHVCClipVC (
XcmsCCC ccc,
XcmsColor *pColors_in_out,
unsigned int nColors,
unsigned int i,
Bool *pCompressed)
/*
* DESCRIPTION
* This routine will find the closest value and chroma
* This routine will find the closest value and chroma
* for a specific hue. The color input is converted to
* HVC format and returned as CIE XYZ format.
*
......@@ -174,7 +174,7 @@ XcmsTekHVCClipVC (ccc, pColors_in_out, nColors, i, pCompressed)
/* the value and chroma given and the line from 0,0 and hvc_max. */
Chroma = pColor->spec.TekHVC.C;
Value = pColor->spec.TekHVC.V;
pColor->spec.TekHVC.C =
pColor->spec.TekHVC.C =
(Value + (hvc_max.spec.TekHVC.C / hvc_max.spec.TekHVC.V * Chroma)) /
((hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C) +
(hvc_max.spec.TekHVC.C / hvc_max.spec.TekHVC.V));
......@@ -221,7 +221,7 @@ XcmsTekHVCClipVC (ccc, pColors_in_out, nColors, i, pCompressed)
if (!_XcmsTekHVC_CheckModify(pColor)) {
return (XcmsFailure);
}
tmpDist = (XcmsFloat) XCMS_SQRT ((double)
tmpDist = (XcmsFloat) XCMS_SQRT ((double)
(((Chroma - pColor->spec.TekHVC.C) *
(Chroma - pColor->spec.TekHVC.C)) +
((Value - pColor->spec.TekHVC.V) *
......@@ -233,7 +233,7 @@ XcmsTekHVCClipVC (ccc, pColors_in_out, nColors, i, pCompressed)
nI = (nMaxCount + nI) / 2;
saveDist = tmpDist;
bestValue = pColor->spec.TekHVC.V;
bestChroma = pColor->spec.TekHVC.C;
bestChroma = pColor->spec.TekHVC.C;
}
if (nI == nILast || nI == 0) {
break;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. TekColor is a
* trademark of Tektronix, Inc. The term "TekHVC" designates a particular
......@@ -10,10 +10,10 @@
* foreign patents pending). Permission is hereby granted to use, copy,
* modify, sell, and otherwise distribute this software and its
* documentation for any purpose and without fee, provided that:
*
*
* 1. This copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and any modification thereof and in
* supporting documentation;
* supporting documentation;
* 2. Any color-handling application which displays TekHVC color
* cooordinates identifies these as TekHVC color coordinates in any
* interface that displays these coordinates and in any associated
......@@ -23,10 +23,10 @@
* including those provided in this file and any equivalent pathways and
* mathematical derivations, regardless of digital (e.g., floating point
* or integer) representation.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -69,11 +69,11 @@
* SYNOPSIS
*/
Status
XcmsTekHVCQueryMinV (ccc, hue, chroma, pColor_return)
XcmsCCC ccc;
XcmsFloat hue;
XcmsFloat chroma;
XcmsColor *pColor_return;
XcmsTekHVCQueryMinV (
XcmsCCC ccc,
XcmsFloat hue,
XcmsFloat chroma,
XcmsColor *pColor_return)
/*
* DESCRIPTION
......@@ -95,7 +95,7 @@ XcmsTekHVCQueryMinV (ccc, hue, chroma, pColor_return)
* XcmsFailure - Failure
* XcmsSuccess - Succeeded with no modifications
*
*/
*/
{
XcmsCCCRec myCCC;
XcmsColor tmp;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. TekColor is a
* trademark of Tektronix, Inc. The term "TekHVC" designates a particular
......@@ -10,10 +10,10 @@
* foreign patents pending). Permission is hereby granted to use, copy,
* modify, sell, and otherwise distribute this software and its
* documentation for any purpose and without fee, provided that:
*
*
* 1. This copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and any modification thereof and in
* supporting documentation;
* supporting documentation;
* 2. Any color-handling application which displays TekHVC color
* cooordinates identifies these as TekHVC color coordinates in any
* interface that displays these coordinates and in any associated
......@@ -23,10 +23,10 @@
* including those provided in this file and any equivalent pathways and
* mathematical derivations, regardless of digital (e.g., floating point
* or integer) representation.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -72,11 +72,11 @@
* SYNOPSIS
*/
Status
XcmsTekHVCQueryMaxC(ccc, hue, value, pColor_return)
XcmsCCC ccc;
XcmsFloat hue;
XcmsFloat value;
XcmsColor *pColor_return;
XcmsTekHVCQueryMaxC(
XcmsCCC ccc,
XcmsFloat hue,
XcmsFloat value,
XcmsColor *pColor_return)
/*
* DESCRIPTION
* Return the maximum chroma for a specific hue and value.
......@@ -210,7 +210,7 @@ XcmsTekHVCQueryMaxC(ccc, hue, value, pColor_return)
if (ftmp1 < ftmp2) {
tmp.spec.TekHVC.V = lastValue;
tmp.spec.TekHVC.C = lastChroma;
}
}
if (_XcmsTekHVC_CheckModify (&tmp)) {
memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor));
return(XcmsSuccess);
......@@ -235,7 +235,7 @@ XcmsTekHVCQueryMaxC(ccc, hue, value, pColor_return)
tmp.spec.TekHVC.C = lastChroma;
}
}
}
}
/* make sure to return the input hue */
tmp.spec.TekHVC.H = hue;
memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor));
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. TekColor is a
* trademark of Tektronix, Inc. The term "TekHVC" designates a particular
......@@ -10,10 +10,10 @@
* foreign patents pending). Permission is hereby granted to use, copy,
* modify, sell, and otherwise distribute this software and its
* documentation for any purpose and without fee, provided that:
*
*
* 1. This copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and any modification thereof and in
* supporting documentation;
* supporting documentation;
* 2. Any color-handling application which displays TekHVC color
* cooordinates identifies these as TekHVC color coordinates in any
* interface that displays these coordinates and in any associated
......@@ -23,10 +23,10 @@
* including those provided in this file and any equivalent pathways and
* mathematical derivations, regardless of digital (e.g., floating point
* or integer) representation.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -72,11 +72,11 @@
* SYNOPSIS
*/
Status
XcmsTekHVCQueryMaxV(ccc, hue, chroma, pColor_return)
XcmsCCC ccc;
XcmsFloat hue;
XcmsFloat chroma;
XcmsColor *pColor_return;
XcmsTekHVCQueryMaxV(
XcmsCCC ccc,
XcmsFloat hue,
XcmsFloat chroma,
XcmsColor *pColor_return)
/*
* DESCRIPTION
* Return the maximum value for a specified hue and chroma.
......@@ -142,7 +142,7 @@ XcmsTekHVCQueryMaxV(ccc, hue, chroma, pColor_return)
if (max_vc.spec.TekHVC.C < tmp.spec.TekHVC.C) {
/*
* If the chroma is greater than the chroma for the
* If the chroma is greater than the chroma for the
* maximum value/chroma point then the value is the
* the value for the maximum value, chroma point.
* This is an error but it I return the best approximation I can.
......@@ -154,7 +154,7 @@ XcmsTekHVCQueryMaxV(ccc, hue, chroma, pColor_return)
return(XcmsSuccess);
} else if (max_vc.spec.TekHVC.C == tmp.spec.TekHVC.C) {
/*
* If the chroma is equal to the chroma for the
* If the chroma is equal to the chroma for the
* maximum value/chroma point then the value is the
* the value for the maximum value, chroma point.
*/
......@@ -196,7 +196,7 @@ XcmsTekHVCQueryMaxV(ccc, hue, chroma, pColor_return)
tmp.spec.TekHVC.H = hue; /* use the saved hue */
memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor));
return(XcmsSuccess);
}
}
nChroma += savedChroma - tmp.spec.TekHVC.C;
if (nChroma > max_vc.spec.TekHVC.C) {
nChroma = max_vc.spec.TekHVC.C;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. TekColor is a
* trademark of Tektronix, Inc. The term "TekHVC" designates a particular
......@@ -10,10 +10,10 @@
* foreign patents pending). Permission is hereby granted to use, copy,
* modify, sell, and otherwise distribute this software and its
* documentation for any purpose and without fee, provided that:
*
*
* 1. This copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and any modification thereof and in
* supporting documentation;
* supporting documentation;
* 2. Any color-handling application which displays TekHVC color
* cooordinates identifies these as TekHVC color coordinates in any
* interface that displays these coordinates and in any associated
......@@ -23,10 +23,10 @@
* including those provided in this file and any equivalent pathways and
* mathematical derivations, regardless of digital (e.g., floating point
* or integer) representation.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -102,7 +102,7 @@ _XcmsTekHVCQueryMaxVCRGB(
* XcmsFailure - Failure
* XCMS_SUCCUSS - Succeeded
*
*/
*/
{
XcmsFloat nSmall, nLarge;
XcmsColor tmp;
......@@ -122,14 +122,14 @@ _XcmsTekHVCQueryMaxVCRGB(
* is NULL.
*/
if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp,
&ccc->pPerScrnInfo->screenWhitePt, 1, XcmsRGBiFormat, (Bool *) NULL)
&ccc->pPerScrnInfo->screenWhitePt, 1, XcmsRGBiFormat, (Bool *) NULL)
== XcmsFailure) && tmp.format != XcmsRGBiFormat) {
return (XcmsFailure);
}
/* Now pick the smallest RGB */
nSmall = MIN3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
nSmall = MIN3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
tmp.spec.RGBi.blue);
/* Make the smallest RGB equal to zero */
tmp.spec.RGBi.red -= nSmall;
......@@ -137,8 +137,8 @@ _XcmsTekHVCQueryMaxVCRGB(
tmp.spec.RGBi.blue -= nSmall;
/* Now pick the largest RGB */
nLarge = MAX3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
nLarge = MAX3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
tmp.spec.RGBi.blue);
/* Scale the RGB values based on the largest one */
tmp.spec.RGBi.red /= nLarge;
......@@ -155,7 +155,7 @@ _XcmsTekHVCQueryMaxVCRGB(
/* Convert from RGBi to HVC */
if (_XcmsConvertColorsWithWhitePt(ccc, &tmp,
&ccc->pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, (Bool *) NULL)
&ccc->pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, (Bool *) NULL)
== XcmsFailure) {
return (XcmsFailure);
}
......@@ -163,7 +163,7 @@ _XcmsTekHVCQueryMaxVCRGB(
/* make sure to return the input hue */
tmp.spec.TekHVC.H = hue;
memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor));
return (XcmsSuccess);
return (XcmsSuccess);
}
......@@ -180,10 +180,10 @@ _XcmsTekHVCQueryMaxVCRGB(
* SYNOPSIS
*/
Status
XcmsTekHVCQueryMaxVC (ccc, hue, pColor_return)
XcmsCCC ccc;
XcmsFloat hue;
XcmsColor *pColor_return;
XcmsTekHVCQueryMaxVC (
XcmsCCC ccc,
XcmsFloat hue,
XcmsColor *pColor_return)
/*
* DESCRIPTION
......@@ -200,7 +200,7 @@ XcmsTekHVCQueryMaxVC (ccc, hue, pColor_return)
* XcmsFailure - Failure
* XcmsSuccess - Succeeded
*
*/
*/
{
XcmsCCCRec myCCC;
......@@ -217,7 +217,7 @@ XcmsTekHVCQueryMaxVC (ccc, hue, pColor_return)
if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) {
return(XcmsFailure);
}
/* Use my own CCC */
memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec));
myCCC.clientWhitePt.format = XcmsUndefinedFormat;
......@@ -228,8 +228,8 @@ XcmsTekHVCQueryMaxVC (ccc, hue, pColor_return)
}
while (hue >= 360.0) {
hue -= 360.0;
}
}
return(_XcmsTekHVCQueryMaxVCRGB (&myCCC, hue, pColor_return,
(XcmsRGBi *)NULL));
}
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. TekColor is a
* trademark of Tektronix, Inc. The term "TekHVC" designates a particular
......@@ -10,10 +10,10 @@
* foreign patents pending). Permission is hereby granted to use, copy,
* modify, sell, and otherwise distribute this software and its
* documentation for any purpose and without fee, provided that:
*
*
* 1. This copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and any modification thereof and in
* supporting documentation;
* supporting documentation;
* 2. Any color-handling application which displays TekHVC color
* cooordinates identifies these as TekHVC color coordinates in any
* interface that displays these coordinates and in any associated
......@@ -23,10 +23,10 @@
* including those provided in this file and any equivalent pathways and
* mathematical derivations, regardless of digital (e.g., floating point
* or integer) representation.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -65,16 +65,16 @@
* SYNOPSIS
*/
Status
XcmsTekHVCQueryMaxVSamples(ccc, hue, pColor_in_out, nSamples)
XcmsCCC ccc;
XcmsFloat hue;
XcmsColor *pColor_in_out;
unsigned int nSamples;
XcmsTekHVCQueryMaxVSamples(
XcmsCCC ccc,
XcmsFloat hue,
XcmsColor *pColor_in_out,
unsigned int nSamples)
/*
* DESCRIPTION
* Return a set of values and chromas for the input Hue.
* This routine will take any color as input.
* This routine will take any color as input.
* It returns TekHVC colors.
*
* Since this routine works with the value within
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. TekColor is a
* trademark of Tektronix, Inc. The term "TekHVC" designates a particular
......@@ -10,10 +10,10 @@
* foreign patents pending). Permission is hereby granted to use, copy,
* modify, sell, and otherwise distribute this software and its
* documentation for any purpose and without fee, provided that:
*
*
* 1. This copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and any modification thereof and in
* supporting documentation;
* supporting documentation;
* 2. Any color-handling application which displays TekHVC color
* cooordinates identifies these as TekHVC color coordinates in any
* interface that displays these coordinates and in any associated
......@@ -23,10 +23,10 @@
* including those provided in this file and any equivalent pathways and
* mathematical derivations, regardless of digital (e.g., floating point
* or integer) representation.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -65,15 +65,14 @@
* SYNOPSIS
*/
Status
XcmsTekHVCWhiteShiftColors(ccc, pWhitePtFrom, pWhitePtTo, destSpecFmt,
pColors_in_out, nColors, pCompressed)
XcmsCCC ccc;
XcmsColor *pWhitePtFrom;
XcmsColor *pWhitePtTo;
XcmsColorFormat destSpecFmt;
XcmsColor *pColors_in_out;
unsigned int nColors;
Bool *pCompressed;
XcmsTekHVCWhiteShiftColors(
XcmsCCC ccc,
XcmsColor *pWhitePtFrom,
XcmsColor *pWhitePtTo,
XcmsColorFormat destSpecFmt,
XcmsColor *pColors_in_out,
unsigned int nColors,
Bool *pCompressed)
/*
* DESCRIPTION
* Convert color specifications in an array of XcmsColor structures
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -47,8 +47,7 @@
* SYNOPSIS
*/
XcmsColorFormat
XcmsFormatOfPrefix(prefix)
char *prefix;
XcmsFormatOfPrefix(char *prefix)
/*
* DESCRIPTION
* Returns the Color Space ID for the specified prefix
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -187,7 +187,7 @@ XcmsColorSpace XcmsRGBColorSpace =
};
/*
* Device-Independent Color Spaces known to the
* Device-Independent Color Spaces known to the
* LINEAR_RGB Screen Color Characteristics Function Set.
*/
static XcmsColorSpace *DDColorSpaces[] = {
......@@ -481,17 +481,17 @@ LINEAR_RGB_InitSCCData(
/*
* Allocate memory for pScreenData
*/
if (!(pScreenData = pScreenDefaultData = (LINEAR_RGB_SCCData *)
if (!(pScreenData = pScreenDefaultData = (LINEAR_RGB_SCCData *)
Xcalloc (1, sizeof(LINEAR_RGB_SCCData)))) {
return(XcmsFailure);
}
/*
/*
* 1. Get the XYZ->RGB and RGB->XYZ matrices
*/
if (MatrixAtom == None ||
!_XcmsGetProperty (dpy, RootWindow(dpy, screenNumber), MatrixAtom,
!_XcmsGetProperty (dpy, RootWindow(dpy, screenNumber), MatrixAtom,
&format_return, &nitems, &nbytes_return, &property_return) ||
nitems != 18 || format_return != 32) {
/*
......@@ -656,7 +656,7 @@ LINEAR_RGB_InitSCCData(
/*
* This is a per-Visual intensity table
*/
if (!(pScreenData = (LINEAR_RGB_SCCData *)
if (!(pScreenData = (LINEAR_RGB_SCCData *)
Xcalloc (1, sizeof(LINEAR_RGB_SCCData)))) {
return(XcmsFailure);
}
......@@ -665,7 +665,7 @@ LINEAR_RGB_InitSCCData(
18 * sizeof(XcmsFloat));
/* Create, initialize, and add map */
if (!(pNewMap = (XcmsIntensityMap *)
if (!(pNewMap = (XcmsIntensityMap *)
Xcalloc (1, sizeof(XcmsIntensityMap)))) {
Xfree((char *)pScreenData);
return(XcmsFailure);
......@@ -719,7 +719,7 @@ LINEAR_RGB_InitSCCData(
&nitems) == XcmsFailure) {
goto FreeBlueTbl;
}
}
}
} else if (cType == 1) {
/* Red Intensity Table */
if (!(pScreenData->pRedTbl = (IntensityTbl *)
......@@ -849,7 +849,7 @@ LINEAR_RGB_FreeSCCData(
if (pScreenData && pScreenData != &Default_RGB_SCCData) {
if (pScreenData->pRedTbl) {
if (pScreenData->pGreenTbl) {
if (pScreenData->pRedTbl->pBase !=
if (pScreenData->pRedTbl->pBase !=
pScreenData->pGreenTbl->pBase) {
if (pScreenData->pGreenTbl->pBase) {
Xfree ((char *)pScreenData->pGreenTbl->pBase);
......@@ -860,7 +860,7 @@ LINEAR_RGB_FreeSCCData(
}
}
if (pScreenData->pBlueTbl) {
if (pScreenData->pRedTbl->pBase !=
if (pScreenData->pRedTbl->pBase !=
pScreenData->pBlueTbl->pBase) {
if (pScreenData->pBlueTbl->pBase) {
Xfree ((char *)pScreenData->pBlueTbl->pBase);
......@@ -919,7 +919,7 @@ _XcmsGetTableType0(
}
switch (format) {
case 8:
case 8:
for (; nElements--; pIRec++) {
/* 0xFFFF/0xFF = 0x101 */
pIRec->value = _XcmsGetElement (format, pChar, pCount) * 0x101;
......@@ -927,14 +927,14 @@ _XcmsGetTableType0(
_XcmsGetElement (format, pChar, pCount) / (XcmsFloat)255.0;
}
break;
case 16:
case 16:
for (; nElements--; pIRec++) {
pIRec->value = _XcmsGetElement (format, pChar, pCount);
pIRec->intensity = _XcmsGetElement (format, pChar, pCount)
/ (XcmsFloat)65535.0;
}
break;
case 32:
case 32:
for (; nElements--; pIRec++) {
pIRec->value = _XcmsGetElement (format, pChar, pCount);
pIRec->intensity = _XcmsGetElement (format, pChar, pCount)
......@@ -981,21 +981,21 @@ _XcmsGetTableType1(
}
switch (format) {
case 8:
case 8:
for (count = 0; count < max_index+1; count++, pIRec++) {
pIRec->value = (count * 65535) / max_index;
pIRec->intensity = _XcmsGetElement (format, pChar, pCount)
/ (XcmsFloat)255.0;
}
break;
case 16:
case 16:
for (count = 0; count < max_index+1; count++, pIRec++) {
pIRec->value = (count * 65535) / max_index;
pIRec->intensity = _XcmsGetElement (format, pChar, pCount)
/ (XcmsFloat)65535.0;
}
break;
case 32:
case 32:
for (count = 0; count < max_index+1; count++, pIRec++) {
pIRec->value = (count * 65535) / max_index;
pIRec->intensity = _XcmsGetElement (format, pChar, pCount)
......@@ -1088,7 +1088,7 @@ _XcmsValueInterpolation(
{
XcmsFloat ratio;
ratio = ((XcmsFloat)key->value - (XcmsFloat)lo->value) /
ratio = ((XcmsFloat)key->value - (XcmsFloat)lo->value) /
((XcmsFloat)hi->value - (XcmsFloat)lo->value);
answer->value = key->value;
answer->intensity = (hi->intensity - lo->intensity) * ratio;
......@@ -1239,7 +1239,7 @@ static void _XcmsMatVec(
XcmsFloat *pMat, XcmsFloat *pIn, XcmsFloat *pOut)
/*
* DESCRIPTION
* Multiply the passed vector by the passed matrix to return a
* Multiply the passed vector by the passed matrix to return a
* vector. Matrix is 3x3, vectors are of length 3.
*
* RETURNS
......@@ -1430,7 +1430,24 @@ XcmsLRGB_RGBi_ParseString(
&pColor->spec.RGBi.red,
&pColor->spec.RGBi.green,
&pColor->spec.RGBi.blue) != 3) {
return(XcmsFailure);
char *s; /* Maybe failed due to locale */
int f;
if ((s = strdup(spec))) {
for (f = 0; s[f]; ++f)
if (s[f] == '.')
s[f] = ',';
else if (s[f] == ',')
s[f] = '.';
if (sscanf(s + n + 1, "%lf/%lf/%lf",
&pColor->spec.RGBi.red,
&pColor->spec.RGBi.green,
&pColor->spec.RGBi.blue) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure);
}
/*
......@@ -1449,12 +1466,12 @@ XcmsLRGB_RGBi_ParseString(
* SYNOPSIS
*/
/* ARGSUSED */
Status
XcmsCIEXYZToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed)
XcmsCCC ccc;
XcmsColor *pXcmsColors_in_out;/* pointer to XcmsColors to convert */
unsigned int nColors; /* Number of colors */
Bool *pCompressed; /* pointer to an array of Bool */
Status
XcmsCIEXYZToRGBi(
XcmsCCC ccc,
XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */
unsigned int nColors, /* Number of colors */
Bool *pCompressed) /* pointer to an array of Bool */
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......@@ -1515,7 +1532,7 @@ XcmsCIEXYZToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed)
/*
* Aha!! Here's that little trick that will allow
* gamut compression routines to get the out of bound
* RGBi.
* RGBi.
*/
memcpy((char *)&pColor->spec, (char *)tmp, sizeof(tmp));
pColor->format = XcmsRGBiFormat;
......@@ -1571,12 +1588,12 @@ XcmsCIEXYZToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed)
* SYNOPSIS
*/
/* ARGSUSED */
Status
XcmsRGBiToCIEXYZ(ccc, pXcmsColors_in_out, nColors, pCompressed)
XcmsCCC ccc;
XcmsColor *pXcmsColors_in_out;/* pointer to XcmsColors to convert */
unsigned int nColors; /* Number of colors */
Bool *pCompressed; /* pointer to a bit array */
Status
XcmsRGBiToCIEXYZ(
XcmsCCC ccc,
XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */
unsigned int nColors, /* Number of colors */
Bool *pCompressed) /* pointer to a bit array */
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......@@ -1624,12 +1641,12 @@ XcmsRGBiToCIEXYZ(ccc, pXcmsColors_in_out, nColors, pCompressed)
* SYNOPSIS
*/
/* ARGSUSED */
Status
XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed)
XcmsCCC ccc;
XcmsColor *pXcmsColors_in_out;/* pointer to XcmsColors to convert */
unsigned int nColors; /* Number of colors */
Bool *pCompressed; /* pointer to a bit array */
Status
XcmsRGBiToRGB(
XcmsCCC ccc,
XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */
unsigned int nColors, /* Number of colors */
Bool *pCompressed) /* pointer to a bit array */
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......@@ -1707,7 +1724,7 @@ XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed)
* SYNOPSIS
*/
/* ARGSUSED */
Status
Status
XcmsRGBToRGBi(
XcmsCCC ccc,
XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -160,7 +160,24 @@ CIELab_ParseString(
&pColor->spec.CIELab.L_star,
&pColor->spec.CIELab.a_star,
&pColor->spec.CIELab.b_star) != 3) {
return(XcmsFailure);
char *s; /* Maybe failed due to locale */
int f;
if ((s = strdup(spec))) {
for (f = 0; s[f]; ++f)
if (s[f] == '.')
s[f] = ',';
else if (s[f] == ',')
s[f] = '.';
if (sscanf(s + n + 1, "%lf/%lf/%lf",
&pColor->spec.CIELab.L_star,
&pColor->spec.CIELab.a_star,
&pColor->spec.CIELab.b_star) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure);
}
pColor->format = XcmsCIELabFormat;
pColor->pixel = 0;
......@@ -213,11 +230,11 @@ XcmsCIELab_ValidSpec(
* SYNOPSIS
*/
Status
XcmsCIELabToCIEXYZ(ccc, pLab_WhitePt, pColors_in_out, nColors)
XcmsCCC ccc;
XcmsColor *pLab_WhitePt;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsCIELabToCIEXYZ(
XcmsCCC ccc,
XcmsColor *pLab_WhitePt,
XcmsColor *pColors_in_out,
unsigned int nColors)
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......@@ -316,11 +333,11 @@ XcmsCIELabToCIEXYZ(ccc, pLab_WhitePt, pColors_in_out, nColors)
* SYNOPSIS
*/
Status
XcmsCIEXYZToCIELab(ccc, pLab_WhitePt, pColors_in_out, nColors)
XcmsCCC ccc;
XcmsColor *pLab_WhitePt;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsCIEXYZToCIELab(
XcmsCCC ccc,
XcmsColor *pLab_WhitePt,
XcmsColor *pColors_in_out,
unsigned int nColors)
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -52,20 +52,20 @@
*/
/* ARGSUSED */
Status
XcmsCIELabClipab (ccc, pColors_in_out, nColors, i, pCompressed)
XcmsCCC ccc;
XcmsColor *pColors_in_out;
unsigned int nColors;
unsigned int i;
Bool *pCompressed;
XcmsCIELabClipab (
XcmsCCC ccc,
XcmsColor *pColors_in_out,
unsigned int nColors,
unsigned int i,
Bool *pCompressed)
/*
* DESCRIPTION
* Reduce the Chroma for a specific hue and chroma to
* to bring the given color into the gamut of the
* to bring the given color into the gamut of the
* specified device. As required of gamut compression
* functions, this routine returns pColor_in_out
* in XcmsCIEXYZFormat on successful completion.
*
*
* Since this routine works with the L* within
* pColor_in_out intermediate results may be returned
* even though it may be invalid.
......@@ -111,7 +111,7 @@ XcmsCIELabClipab (ccc, pColors_in_out, nColors, i, pCompressed)
}
}
if (XcmsCIELabQueryMaxC(ccc,
degrees(XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star,
degrees(XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star,
pColor->spec.CIELab.b_star)),
pColor->spec.CIELab.L_star,
pColor) == XcmsFailure) {
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -52,16 +52,16 @@
*/
/* ARGSUSED */
Status
XcmsCIELabClipL (ccc, pColors_in_out, nColors, i, pCompressed)
XcmsCCC ccc;
XcmsColor *pColors_in_out;
unsigned int nColors;
unsigned int i;
Bool *pCompressed;
XcmsCIELabClipL (
XcmsCCC ccc,
XcmsColor *pColors_in_out,
unsigned int nColors,
unsigned int i,
Bool *pCompressed)
/*
* DESCRIPTION
* Return the closest L* for a specific hue and chroma.
* This routine takes any color as input and outputs
* This routine takes any color as input and outputs
* a CIE XYZ color.
*
* Since this routine works with the L* within
......@@ -95,7 +95,7 @@ XcmsCIELabClipL (ccc, pColors_in_out, nColors, i, pCompressed)
*/
pColor = pColors_in_out + i;
if (ccc->visual->class < StaticColor) {
/*
* GRAY !
......@@ -136,7 +136,7 @@ XcmsCIELabClipL (ccc, pColors_in_out, nColors, i, pCompressed)
memcpy((char *)pColor, (char *)&Lab_max, sizeof(XcmsColor));
return (XcmsFailure);
} else if (pColor->spec.CIELab.L_star < Lab_max.spec.CIELab.L_star) {
/* Find the minimum lightness for the given chroma. */
/* Find the minimum lightness for the given chroma. */
if (pColor->format != XcmsCIELabFormat) {
if (_XcmsDIConvertColors(ccc, pColor,
ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat)
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -60,15 +60,15 @@
*/
/* ARGSUSED */
Status
XcmsCIELabClipLab (ccc, pColors_in_out, nColors, i, pCompressed)
XcmsCCC ccc;
XcmsColor *pColors_in_out;
unsigned int nColors;
unsigned int i;
Bool *pCompressed;
XcmsCIELabClipLab (
XcmsCCC ccc,
XcmsColor *pColors_in_out,
unsigned int nColors,
unsigned int i,
Bool *pCompressed)
/*
* DESCRIPTION
* This routine will find the closest L* and chroma
* This routine will find the closest L* and chroma
* for a specific hue. The color input is converted to
* CIE L*u*v* format and returned as CIE XYZ format.
*
......@@ -138,12 +138,12 @@ XcmsCIELabClipLab (ccc, pColors_in_out, nColors, i, pCompressed)
chroma = XCMS_CIELAB_PMETRIC_CHROMA(pColor->spec.CIELab.a_star,
pColor->spec.CIELab.b_star);
memcpy((char *)&Lab_max, (char *)pColor, sizeof(XcmsColor));
if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, &rgb_max)
if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, &rgb_max)
== XcmsFailure) {
return (XcmsFailure);
}
maxLstar = Lab_max.spec.CIELab.L_star;
/* Now check and return the appropriate L* */
if (saveLstar == maxLstar) {
/* When the L* input is equal to the maximum L* */
......@@ -197,7 +197,7 @@ XcmsCIELabClipLab (ccc, pColors_in_out, nColors, i, pCompressed)
bestLstar = pColor->spec.CIELab.L_star;
bestastar = pColor->spec.CIELab.a_star;
bestbstar = pColor->spec.CIELab.b_star;
bestChroma = chroma;
bestChroma = chroma;
}
if (nI == nILast || nI == 0) {
break;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -60,11 +60,11 @@
* SYNOPSIS
*/
Status
XcmsCIELabQueryMinL(ccc, hue_angle, chroma, pColor_return)
XcmsCCC ccc;
XcmsFloat hue_angle; /* hue angle in degrees */
XcmsFloat chroma;
XcmsColor *pColor_return;
XcmsCIELabQueryMinL(
XcmsCCC ccc,
XcmsFloat hue_angle, /* hue angle in degrees */
XcmsFloat chroma,
XcmsColor *pColor_return)
/*
* DESCRIPTION
* Return the maximum Lstar for a specified hue_angle and chroma.
......@@ -106,7 +106,7 @@ XcmsCIELabQueryMinL(ccc, hue_angle, chroma, pColor_return)
}
while (hue_angle >= 360.0) {
hue_angle -= 360.0;
}
}
hue = radians(hue_angle);
tmp.spec.CIELab.L_star = START_L_STAR;
......@@ -114,7 +114,7 @@ XcmsCIELabQueryMinL(ccc, hue_angle, chroma, pColor_return)
tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, chroma);
tmp.pixel = pColor_return->pixel;
tmp.format = XcmsCIELabFormat;
/* Step 1: Obtain the maximum L_star and chroma for this hue. */
if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved)
== XcmsFailure) {
......@@ -126,7 +126,7 @@ XcmsCIELabQueryMinL(ccc, hue_angle, chroma, pColor_return)
if (max_chroma <= chroma) {
/*
* If the chroma is greater than the chroma for the
* If the chroma is greater than the chroma for the
* maximum L/chroma point then the L_star is the
* the L_star for the maximum L_star/chroma point.
* This is an error but I return the best approximation I can.
......@@ -137,7 +137,7 @@ XcmsCIELabQueryMinL(ccc, hue_angle, chroma, pColor_return)
}
/*
* If the chroma is equal to the chroma for the
* If the chroma is equal to the chroma for the
* maximum L_star/chroma point then the L_star is the
* the L_star for the maximum L* and chroma point.
*/
......@@ -180,15 +180,15 @@ XcmsCIELabQueryMinL(ccc, hue_angle, chroma, pColor_return)
/* Found It! */
memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor));
return(XcmsSuccess);
}
}
nChroma += chroma - tmp_chroma;
if (nChroma > max_chroma) {
nChroma = max_chroma;
rFactor *= 0.5; /* selective relaxation employed */
} else if (nChroma < 0.0) {
if (XCMS_FABS(lastChroma - chroma) <
if (XCMS_FABS(lastChroma - chroma) <
XCMS_FABS(tmp_chroma - chroma)) {
memcpy ((char *)pColor_return, (char *)&prev,
memcpy ((char *)pColor_return, (char *)&prev,
sizeof(XcmsColor));
} else {
memcpy ((char *)pColor_return, (char *)&tmp,
......@@ -202,7 +202,7 @@ XcmsCIELabQueryMinL(ccc, hue_angle, chroma, pColor_return)
}
if (nCount >= nMaxCount) {
if (XCMS_FABS(lastChroma - chroma) <
if (XCMS_FABS(lastChroma - chroma) <
XCMS_FABS(tmp_chroma - chroma)) {
memcpy ((char *)pColor_return, (char *)&prev,
sizeof(XcmsColor));
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -63,11 +63,11 @@
* SYNOPSIS
*/
Status
XcmsCIELabQueryMaxC(ccc, hue_angle, L_star, pColor_return)
XcmsCCC ccc;
XcmsFloat hue_angle; /* hue angle in degrees */
XcmsFloat L_star;
XcmsColor *pColor_return;
XcmsCIELabQueryMaxC(
XcmsCCC ccc,
XcmsFloat hue_angle, /* hue angle in degrees */
XcmsFloat L_star,
XcmsColor *pColor_return)
/*
* DESCRIPTION
* Return the maximum chroma for a specific hue_angle and L_star.
......@@ -103,7 +103,7 @@ XcmsCIELabQueryMaxC(ccc, hue_angle, L_star, pColor_return)
/* Use my own CCC and inherit screen white Pt */
memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec));
myCCC.clientWhitePt.format = XcmsUndefinedFormat;
myCCC.clientWhitePt.format = XcmsUndefinedFormat;
myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */
while (hue_angle < 0.0) {
......@@ -111,7 +111,7 @@ XcmsCIELabQueryMaxC(ccc, hue_angle, L_star, pColor_return)
}
while (hue_angle >= 360.0) {
hue_angle -= 360.0;
}
}
hue = radians(hue_angle);
tmp.spec.CIELab.L_star = L_star;
......@@ -190,7 +190,7 @@ XcmsCIELabQueryMaxC(ccc, hue_angle, L_star, pColor_return)
/* printf("rFactor = %lf\n", rFactor); */
}
}
if (XCMS_FABS(last_L_star - L_star) <
if (XCMS_FABS(last_L_star - L_star) <
XCMS_FABS(tmp.spec.CIELab.L_star - L_star)) {
tmp.spec.CIELab.a_star = lastaStar;
tmp.spec.CIELab.b_star = lastbStar;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -60,11 +60,11 @@
* SYNOPSIS
*/
Status
XcmsCIELabQueryMaxL(ccc, hue_angle, chroma, pColor_return)
XcmsCCC ccc;
XcmsFloat hue_angle; /* hue in degrees */
XcmsFloat chroma;
XcmsColor *pColor_return;
XcmsCIELabQueryMaxL(
XcmsCCC ccc,
XcmsFloat hue_angle, /* hue in degrees */
XcmsFloat chroma,
XcmsColor *pColor_return)
/*
* DESCRIPTION
* Return the maximum Lstar for a specified hue_angle and chroma.
......@@ -106,7 +106,7 @@ XcmsCIELabQueryMaxL(ccc, hue_angle, chroma, pColor_return)
}
while (hue_angle >= 360.0) {
hue_angle -= 360.0;
}
}
hue = radians(hue_angle);
tmp.spec.CIELab.L_star = START_L_STAR;
......@@ -114,7 +114,7 @@ XcmsCIELabQueryMaxL(ccc, hue_angle, chroma, pColor_return)
tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, chroma);
tmp.pixel = pColor_return->pixel;
tmp.format = XcmsCIELabFormat;
/* Step 1: Obtain the maximum L_star and chroma for this hue. */
if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved)
== XcmsFailure) {
......@@ -126,7 +126,7 @@ XcmsCIELabQueryMaxL(ccc, hue_angle, chroma, pColor_return)
if (max_chroma <= chroma) {
/*
* If the chroma is greater than the chroma for the
* If the chroma is greater than the chroma for the
* maximum L/chroma point then the L_star is the
* the L_star for the maximum L_star/chroma point.
* This is an error but I return the best approximation I can.
......@@ -137,7 +137,7 @@ XcmsCIELabQueryMaxL(ccc, hue_angle, chroma, pColor_return)
}
/*
* If the chroma is equal to the chroma for the
* If the chroma is equal to the chroma for the
* maximum L_star/chroma point then the L_star is the
* the L_star for the maximum L* and chroma point.
*/
......@@ -180,13 +180,13 @@ XcmsCIELabQueryMaxL(ccc, hue_angle, chroma, pColor_return)
/* Found It! */
memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor));
return(XcmsSuccess);
}
}
nChroma += chroma - tmp_chroma;
if (nChroma > max_chroma) {
nChroma = max_chroma;
rFactor *= 0.5; /* selective relaxation employed */
} else if (nChroma < 0.0) {
if (XCMS_FABS(lastChroma - chroma) <
if (XCMS_FABS(lastChroma - chroma) <
XCMS_FABS(tmp_chroma - chroma)) {
memcpy ((char *)pColor_return, (char *)&prev,
sizeof(XcmsColor));
......@@ -202,7 +202,7 @@ XcmsCIELabQueryMaxL(ccc, hue_angle, chroma, pColor_return)
}
if (nCount >= nMaxCount) {
if (XCMS_FABS(lastChroma - chroma) <
if (XCMS_FABS(lastChroma - chroma) <
XCMS_FABS(tmp_chroma - chroma)) {
memcpy ((char *)pColor_return, (char *)&prev,
sizeof(XcmsColor));
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -81,7 +81,7 @@ _XcmsCIELabQueryMaxLCRGB(
* by a binary search of all possible chromas. An assumption
* is made that there are no local maxima. Use the unrounded
* Max psychometric chroma because the difference check can be
* small.
* small.
*
* NOTE: No local CCC is used because this is a private
* routine and all routines that call it are expected
......@@ -96,7 +96,7 @@ _XcmsCIELabQueryMaxLCRGB(
* XcmsFailure - Failure
* XcmsSuccess - Succeeded
*
*/
*/
{
XcmsFloat nSmall, nLarge;
XcmsColor tmp;
......@@ -113,15 +113,15 @@ _XcmsCIELabQueryMaxLCRGB(
* out of bounds RGBi values in tmp when the ccc->gamutCompProc
* is NULL.
*/
if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc),
(unsigned int)1, XcmsRGBiFormat, (Bool *) NULL)
if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc),
(unsigned int)1, XcmsRGBiFormat, (Bool *) NULL)
== XcmsFailure) && tmp.format != XcmsRGBiFormat) {
return (XcmsFailure);
}
/* Now pick the smallest RGB */
nSmall = MIN3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
nSmall = MIN3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
tmp.spec.RGBi.blue);
/* Make the smallest RGB equal to zero */
tmp.spec.RGBi.red -= nSmall;
......@@ -129,8 +129,8 @@ _XcmsCIELabQueryMaxLCRGB(
tmp.spec.RGBi.blue -= nSmall;
/* Now pick the largest RGB */
nLarge = MAX3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
nLarge = MAX3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
tmp.spec.RGBi.blue);
/* Scale the RGB values based on the largest one */
tmp.spec.RGBi.red /= nLarge;
......@@ -147,13 +147,13 @@ _XcmsCIELabQueryMaxLCRGB(
/* Convert from RGBi to Lab */
if (_XcmsConvertColorsWithWhitePt(ccc, &tmp,
ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat, (Bool *) NULL)
ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat, (Bool *) NULL)
== XcmsFailure) {
return (XcmsFailure);
}
memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor));
return (XcmsSuccess);
return (XcmsSuccess);
}
......@@ -170,10 +170,10 @@ _XcmsCIELabQueryMaxLCRGB(
* SYNOPSIS
*/
Status
XcmsCIELabQueryMaxLC (ccc, hue_angle, pColor_return)
XcmsCCC ccc;
XcmsFloat hue_angle; /* hue_angle in degrees */
XcmsColor *pColor_return;
XcmsCIELabQueryMaxLC (
XcmsCCC ccc,
XcmsFloat hue_angle, /* hue_angle in degrees */
XcmsColor *pColor_return)
/*
* DESCRIPTION
......@@ -190,7 +190,7 @@ XcmsCIELabQueryMaxLC (ccc, hue_angle, pColor_return)
* XcmsFailure - Failure
* XcmsSuccess - Succeeded
*
*/
*/
{
XcmsCCCRec myCCC;
......@@ -200,7 +200,7 @@ XcmsCIELabQueryMaxLC (ccc, hue_angle, pColor_return)
if (ccc == NULL || pColor_return == NULL) {
return(XcmsFailure);
}
/* Use my own CCC */
memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec));
myCCC.clientWhitePt.format = XcmsUndefinedFormat;
......@@ -211,8 +211,8 @@ XcmsCIELabQueryMaxLC (ccc, hue_angle, pColor_return)
}
while (hue_angle >= 360.0) {
hue_angle -= 360.0;
}
}
return(_XcmsCIELabQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return,
(XcmsRGBi *)NULL));
}
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -57,15 +57,14 @@
* SYNOPSIS
*/
Status
XcmsCIELabWhiteShiftColors(ccc, pWhitePtFrom, pWhitePtTo, destSpecFmt,
pColors_in_out, nColors, pCompressed)
XcmsCCC ccc;
XcmsColor *pWhitePtFrom;
XcmsColor *pWhitePtTo;
XcmsColorFormat destSpecFmt;
XcmsColor *pColors_in_out;
unsigned int nColors;
Bool *pCompressed;
XcmsCIELabWhiteShiftColors(
XcmsCCC ccc,
XcmsColor *pWhitePtFrom,
XcmsColor *pWhitePtTo,
XcmsColorFormat destSpecFmt,
XcmsColor *pColors_in_out,
unsigned int nColors,
Bool *pCompressed)
/*
* DESCRIPTION
* Adjust color specifications in XcmsColor structures for
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -163,6 +163,23 @@ CIELuv_ParseString(
&pColor->spec.CIELuv.L_star,
&pColor->spec.CIELuv.u_star,
&pColor->spec.CIELuv.v_star) != 3) {
char *s; /* Maybe failed due to locale */
int f;
if ((s = strdup(spec))) {
for (f = 0; s[f]; ++f)
if (s[f] == '.')
s[f] = ',';
else if (s[f] == ',')
s[f] = '.';
if (sscanf(s + n + 1, "%lf/%lf/%lf",
&pColor->spec.CIELuv.L_star,
&pColor->spec.CIELuv.u_star,
&pColor->spec.CIELuv.v_star) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure);
}
pColor->format = XcmsCIELuvFormat;
......@@ -214,11 +231,11 @@ XcmsCIELuv_ValidSpec(
* SYNOPSIS
*/
Status
XcmsCIELuvToCIEuvY(ccc, pLuv_WhitePt, pColors_in_out, nColors)
XcmsCCC ccc;
XcmsColor *pLuv_WhitePt;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsCIELuvToCIEuvY(
XcmsCCC ccc,
XcmsColor *pLuv_WhitePt,
XcmsColor *pColors_in_out,
unsigned int nColors)
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......@@ -284,7 +301,7 @@ XcmsCIELuvToCIEuvY(ccc, pLuv_WhitePt, pColors_in_out, nColors)
uvY_return.v_prime = pLuv_WhitePt->spec.CIEuvY.v_prime;
} else {
tmpVal = 13.0 * (pColor->spec.CIELuv.L_star / 100.0);
uvY_return.u_prime = pColor->spec.CIELuv.u_star/tmpVal +
uvY_return.u_prime = pColor->spec.CIELuv.u_star/tmpVal +
pLuv_WhitePt->spec.CIEuvY.u_prime;
uvY_return.v_prime = pColor->spec.CIELuv.v_star/tmpVal +
pLuv_WhitePt->spec.CIEuvY.v_prime;
......@@ -306,11 +323,11 @@ XcmsCIELuvToCIEuvY(ccc, pLuv_WhitePt, pColors_in_out, nColors)
* SYNOPSIS
*/
Status
XcmsCIEuvYToCIELuv(ccc, pLuv_WhitePt, pColors_in_out, nColors)
XcmsCCC ccc;
XcmsColor *pLuv_WhitePt;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsCIEuvYToCIELuv(
XcmsCCC ccc,
XcmsColor *pLuv_WhitePt,
XcmsColor *pColors_in_out,
unsigned int nColors)
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......@@ -362,7 +379,7 @@ XcmsCIEuvYToCIELuv(ccc, pLuv_WhitePt, pColors_in_out, nColors)
}
/* Now convert the uvY to Luv */
Luv_return.L_star =
Luv_return.L_star =
(pColor->spec.CIEuvY.Y < 0.008856)
?
(pColor->spec.CIEuvY.Y * 903.29)
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -52,20 +52,20 @@
*/
/* ARGSUSED */
Status
XcmsCIELuvClipuv (ccc, pColors_in_out, nColors, i, pCompressed)
XcmsCCC ccc;
XcmsColor *pColors_in_out;
unsigned int nColors;
unsigned int i;
Bool *pCompressed;
XcmsCIELuvClipuv (
XcmsCCC ccc,
XcmsColor *pColors_in_out,
unsigned int nColors,
unsigned int i,
Bool *pCompressed)
/*
* DESCRIPTION
* Reduce the Chroma for a specific hue and chroma to
* to bring the given color into the gamut of the
* to bring the given color into the gamut of the
* specified device. As required of gamut compression
* functions, this routine returns pColor_in_out
* in XcmsCIEXYZFormat on successful completion.
*
*
* Since this routine works with the L* within
* pColor_in_out intermediate results may be returned
* even though it may be invalid.
......@@ -111,7 +111,7 @@ XcmsCIELuvClipuv (ccc, pColors_in_out, nColors, i, pCompressed)
}
}
if (XcmsCIELuvQueryMaxC(ccc,
degrees(XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star,
degrees(XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star,
pColor->spec.CIELuv.v_star)),
pColor->spec.CIELuv.L_star,
pColor) == XcmsFailure) {
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -52,16 +52,16 @@
*/
/* ARGSUSED */
Status
XcmsCIELuvClipL (ccc, pColors_in_out, nColors, i, pCompressed)
XcmsCCC ccc;
XcmsColor *pColors_in_out;
unsigned int nColors;
unsigned int i;
Bool *pCompressed;
XcmsCIELuvClipL (
XcmsCCC ccc,
XcmsColor *pColors_in_out,
unsigned int nColors,
unsigned int i,
Bool *pCompressed)
/*
* DESCRIPTION
* Return the closest L* for a specific hue and chroma.
* This routine takes any color as input and outputs
* This routine takes any color as input and outputs
* a CIE XYZ color.
*
* Since this routine works with the L* within
......@@ -95,7 +95,7 @@ XcmsCIELuvClipL (ccc, pColors_in_out, nColors, i, pCompressed)
*/
pColor = pColors_in_out + i;
if (ccc->visual->class < StaticColor) {
/*
* GRAY !
......@@ -136,7 +136,7 @@ XcmsCIELuvClipL (ccc, pColors_in_out, nColors, i, pCompressed)
memcpy((char *)pColor, (char *)&Luv_max, sizeof(XcmsColor));
return (XcmsFailure);
} else if (pColor->spec.CIELuv.L_star < Luv_max.spec.CIELuv.L_star) {
/* Find the minimum lightness for the given chroma. */
/* Find the minimum lightness for the given chroma. */
if (pColor->format != XcmsCIELuvFormat) {
if (_XcmsDIConvertColors(ccc, pColor,
ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat)
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -60,15 +60,15 @@
*/
/* ARGSUSED */
Status
XcmsCIELuvClipLuv (ccc, pColors_in_out, nColors, i, pCompressed)
XcmsCCC ccc;
XcmsColor *pColors_in_out;
unsigned int nColors;
unsigned int i;
Bool *pCompressed;
XcmsCIELuvClipLuv (
XcmsCCC ccc,
XcmsColor *pColors_in_out,
unsigned int nColors,
unsigned int i,
Bool *pCompressed)
/*
* DESCRIPTION
* This routine will find the closest L* and chroma
* This routine will find the closest L* and chroma
* for a specific hue. The color input is converted to
* CIE L*u*v* format and returned as CIE XYZ format.
*
......@@ -138,12 +138,12 @@ XcmsCIELuvClipLuv (ccc, pColors_in_out, nColors, i, pCompressed)
chroma = XCMS_CIELUV_PMETRIC_CHROMA(pColor->spec.CIELuv.u_star,
pColor->spec.CIELuv.v_star);
memcpy((char *)&Luv_max, (char *)pColor, sizeof(XcmsColor));
if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, &rgb_max)
if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, &rgb_max)
== XcmsFailure) {
return (XcmsFailure);
}
maxLstar = Luv_max.spec.CIELuv.L_star;
/* Now check and return the appropriate L* */
if (saveLstar == maxLstar) {
/* When the L* input is equal to the maximum L* */
......@@ -197,7 +197,7 @@ XcmsCIELuvClipLuv (ccc, pColors_in_out, nColors, i, pCompressed)
bestLstar = pColor->spec.CIELuv.L_star;
bestustar = pColor->spec.CIELuv.u_star;
bestvstar = pColor->spec.CIELuv.v_star;
bestChroma = chroma;
bestChroma = chroma;
}
if (nI == nILast || nI == 0) {
break;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -60,11 +60,11 @@
* SYNOPSIS
*/
Status
XcmsCIELuvQueryMinL(ccc, hue_angle, chroma, pColor_return)
XcmsCCC ccc;
XcmsFloat hue_angle; /* hue angle in degrees */
XcmsFloat chroma;
XcmsColor *pColor_return;
XcmsCIELuvQueryMinL(
XcmsCCC ccc,
XcmsFloat hue_angle, /* hue angle in degrees */
XcmsFloat chroma,
XcmsColor *pColor_return)
/*
* DESCRIPTION
* Return the maximum Lstar for a specified hue_angle and chroma.
......@@ -106,7 +106,7 @@ XcmsCIELuvQueryMinL(ccc, hue_angle, chroma, pColor_return)
}
while (hue_angle >= 360.0) {
hue_angle -= 360.0;
}
}
hue = radians(hue_angle);
tmp.spec.CIELuv.L_star = START_L_STAR;
......@@ -114,7 +114,7 @@ XcmsCIELuvQueryMinL(ccc, hue_angle, chroma, pColor_return)
tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, chroma);
tmp.pixel = pColor_return->pixel;
tmp.format = XcmsCIELuvFormat;
/* Step 1: Obtain the maximum L_star and chroma for this hue. */
if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved)
== XcmsFailure) {
......@@ -126,7 +126,7 @@ XcmsCIELuvQueryMinL(ccc, hue_angle, chroma, pColor_return)
if (max_chroma <= chroma) {
/*
* If the chroma is greater than the chroma for the
* If the chroma is greater than the chroma for the
* maximum L/chroma point then the L_star is the
* the L_star for the maximum L_star/chroma point.
* This is an error but I return the best approximation I can.
......@@ -137,7 +137,7 @@ XcmsCIELuvQueryMinL(ccc, hue_angle, chroma, pColor_return)
}
/*
* If the chroma is equal to the chroma for the
* If the chroma is equal to the chroma for the
* maximum L_star/chroma point then the L_star is the
* the L_star for the maximum L* and chroma point.
*/
......@@ -180,15 +180,15 @@ XcmsCIELuvQueryMinL(ccc, hue_angle, chroma, pColor_return)
/* Found It! */
memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor));
return(XcmsSuccess);
}
}
nChroma += chroma - tmp_chroma;
if (nChroma > max_chroma) {
nChroma = max_chroma;
rFactor *= 0.5; /* selective relaxation employed */
} else if (nChroma < 0.0) {
if (XCMS_FABS(lastChroma - chroma) <
if (XCMS_FABS(lastChroma - chroma) <
XCMS_FABS(tmp_chroma - chroma)) {
memcpy ((char *)pColor_return, (char *)&prev,
memcpy ((char *)pColor_return, (char *)&prev,
sizeof(XcmsColor));
} else {
memcpy ((char *)pColor_return, (char *)&tmp,
......@@ -202,7 +202,7 @@ XcmsCIELuvQueryMinL(ccc, hue_angle, chroma, pColor_return)
}
if (nCount >= nMaxCount) {
if (XCMS_FABS(lastChroma - chroma) <
if (XCMS_FABS(lastChroma - chroma) <
XCMS_FABS(tmp_chroma - chroma)) {
memcpy ((char *)pColor_return, (char *)&prev,
sizeof(XcmsColor));
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -63,11 +63,11 @@
* SYNOPSIS
*/
Status
XcmsCIELuvQueryMaxC(ccc, hue_angle, L_star, pColor_return)
XcmsCCC ccc;
XcmsFloat hue_angle; /* hue angle in degrees */
XcmsFloat L_star;
XcmsColor *pColor_return;
XcmsCIELuvQueryMaxC(
XcmsCCC ccc,
XcmsFloat hue_angle, /* hue angle in degrees */
XcmsFloat L_star,
XcmsColor *pColor_return)
/*
* DESCRIPTION
* Return the maximum chroma for a specific hue_angle and L_star.
......@@ -103,7 +103,7 @@ XcmsCIELuvQueryMaxC(ccc, hue_angle, L_star, pColor_return)
/* Use my own CCC and inherit screen white Pt */
memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec));
myCCC.clientWhitePt.format = XcmsUndefinedFormat;
myCCC.clientWhitePt.format = XcmsUndefinedFormat;
myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */
while (hue_angle < 0.0) {
......@@ -111,7 +111,7 @@ XcmsCIELuvQueryMaxC(ccc, hue_angle, L_star, pColor_return)
}
while (hue_angle >= 360.0) {
hue_angle -= 360.0;
}
}
hue = radians(hue_angle);
tmp.spec.CIELuv.L_star = L_star;
......@@ -180,7 +180,7 @@ XcmsCIELuvQueryMaxC(ccc, hue_angle, L_star, pColor_return)
return(XcmsSuccess);
}
if (nT > 0) {
n_L_star += ((TOPL - n_L_star) *
n_L_star += ((TOPL - n_L_star) *
(L_star - tmp.spec.CIELuv.L_star)) / (TOPL - L_star);
} else {
n_L_star *= L_star / tmp.spec.CIELuv.L_star;
......@@ -191,7 +191,7 @@ XcmsCIELuvQueryMaxC(ccc, hue_angle, L_star, pColor_return)
/* printf("rFactor = %lf\n", rFactor); */
}
}
if (XCMS_FABS(last_L_star - L_star) <
if (XCMS_FABS(last_L_star - L_star) <
XCMS_FABS(tmp.spec.CIELuv.L_star - L_star)) {
tmp.spec.CIELuv.u_star = lastuStar;
tmp.spec.CIELuv.v_star = lastvStar;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -60,11 +60,11 @@
* SYNOPSIS
*/
Status
XcmsCIELuvQueryMaxL(ccc, hue_angle, chroma, pColor_return)
XcmsCCC ccc;
XcmsFloat hue_angle; /* hue angle in degrees */
XcmsFloat chroma;
XcmsColor *pColor_return;
XcmsCIELuvQueryMaxL(
XcmsCCC ccc,
XcmsFloat hue_angle, /* hue angle in degrees */
XcmsFloat chroma,
XcmsColor *pColor_return)
/*
* DESCRIPTION
* Return the maximum Lstar for a specified hue_angle and chroma.
......@@ -106,7 +106,7 @@ XcmsCIELuvQueryMaxL(ccc, hue_angle, chroma, pColor_return)
}
while (hue_angle >= 360.0) {
hue_angle -= 360.0;
}
}
hue = radians(hue_angle);
tmp.spec.CIELuv.L_star = START_L_STAR;
......@@ -114,7 +114,7 @@ XcmsCIELuvQueryMaxL(ccc, hue_angle, chroma, pColor_return)
tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, chroma);
tmp.pixel = pColor_return->pixel;
tmp.format = XcmsCIELuvFormat;
/* Step 1: Obtain the maximum L_star and chroma for this hue. */
if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved)
== XcmsFailure) {
......@@ -126,7 +126,7 @@ XcmsCIELuvQueryMaxL(ccc, hue_angle, chroma, pColor_return)
if (max_chroma <= chroma) {
/*
* If the chroma is greater than the chroma for the
* If the chroma is greater than the chroma for the
* maximum L/chroma point then the L_star is the
* the L_star for the maximum L_star/chroma point.
* This is an error but I return the best approximation I can.
......@@ -137,7 +137,7 @@ XcmsCIELuvQueryMaxL(ccc, hue_angle, chroma, pColor_return)
}
/*
* If the chroma is equal to the chroma for the
* If the chroma is equal to the chroma for the
* maximum L_star/chroma point then the L_star is the
* the L_star for the maximum L* and chroma point.
*/
......@@ -180,13 +180,13 @@ XcmsCIELuvQueryMaxL(ccc, hue_angle, chroma, pColor_return)
/* Found It! */
memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor));
return(XcmsSuccess);
}
}
nChroma += chroma - tmp_chroma;
if (nChroma > max_chroma) {
nChroma = max_chroma;
rFactor *= 0.5; /* selective relaxation employed */
} else if (nChroma < 0.0) {
if (XCMS_FABS(lastChroma - chroma) <
if (XCMS_FABS(lastChroma - chroma) <
XCMS_FABS(tmp_chroma - chroma)) {
memcpy ((char *)pColor_return, (char *)&prev,
sizeof(XcmsColor));
......@@ -202,7 +202,7 @@ XcmsCIELuvQueryMaxL(ccc, hue_angle, chroma, pColor_return)
}
if (nCount >= nMaxCount) {
if (XCMS_FABS(lastChroma - chroma) <
if (XCMS_FABS(lastChroma - chroma) <
XCMS_FABS(tmp_chroma - chroma)) {
memcpy ((char *)pColor_return, (char *)&prev,
sizeof(XcmsColor));
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -96,7 +96,7 @@ _XcmsCIELuvQueryMaxLCRGB(
* XcmsFailure - Failure
* XcmsSuccess - Succeeded
*
*/
*/
{
XcmsFloat nSmall, nLarge;
XcmsColor tmp;
......@@ -113,15 +113,15 @@ _XcmsCIELuvQueryMaxLCRGB(
* out of bounds RGBi values in tmp when the ccc->gamutCompProc
* is NULL.
*/
if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc),
(unsigned int)1, XcmsRGBiFormat, (Bool *) NULL)
if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc),
(unsigned int)1, XcmsRGBiFormat, (Bool *) NULL)
== XcmsFailure) && tmp.format != XcmsRGBiFormat) {
return (XcmsFailure);
}
/* Now pick the smallest RGB */
nSmall = MIN3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
nSmall = MIN3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
tmp.spec.RGBi.blue);
/* Make the smallest RGB equal to zero */
tmp.spec.RGBi.red -= nSmall;
......@@ -129,8 +129,8 @@ _XcmsCIELuvQueryMaxLCRGB(
tmp.spec.RGBi.blue -= nSmall;
/* Now pick the largest RGB */
nLarge = MAX3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
nLarge = MAX3(tmp.spec.RGBi.red,
tmp.spec.RGBi.green,
tmp.spec.RGBi.blue);
/* Scale the RGB values based on the largest one */
tmp.spec.RGBi.red /= nLarge;
......@@ -147,13 +147,13 @@ _XcmsCIELuvQueryMaxLCRGB(
/* Convert from RGBi to Luv */
if (_XcmsConvertColorsWithWhitePt(ccc, &tmp,
ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat, (Bool *) NULL)
ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat, (Bool *) NULL)
== XcmsFailure) {
return (XcmsFailure);
}
memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor));
return (XcmsSuccess);
return (XcmsSuccess);
}
......@@ -170,10 +170,10 @@ _XcmsCIELuvQueryMaxLCRGB(
* SYNOPSIS
*/
Status
XcmsCIELuvQueryMaxLC (ccc, hue_angle, pColor_return)
XcmsCCC ccc;
XcmsFloat hue_angle; /* hue angle in degrees */
XcmsColor *pColor_return;
XcmsCIELuvQueryMaxLC (
XcmsCCC ccc,
XcmsFloat hue_angle, /* hue angle in degrees */
XcmsColor *pColor_return)
/*
* DESCRIPTION
......@@ -190,7 +190,7 @@ XcmsCIELuvQueryMaxLC (ccc, hue_angle, pColor_return)
* XcmsFailure - Failure
* XcmsSuccess - Succeeded
*
*/
*/
{
XcmsCCCRec myCCC;
......@@ -200,7 +200,7 @@ XcmsCIELuvQueryMaxLC (ccc, hue_angle, pColor_return)
if (ccc == NULL || pColor_return == NULL) {
return(XcmsFailure);
}
/* Use my own CCC */
memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec));
myCCC.clientWhitePt.format = XcmsUndefinedFormat;
......@@ -211,8 +211,8 @@ XcmsCIELuvQueryMaxLC (ccc, hue_angle, pColor_return)
}
while (hue_angle >= 360.0) {
hue_angle -= 360.0;
}
}
return(_XcmsCIELuvQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return,
(XcmsRGBi *)NULL));
}
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -54,15 +54,14 @@
* SYNOPSIS
*/
Status
XcmsCIELuvWhiteShiftColors(ccc, pWhitePtFrom, pWhitePtTo, destSpecFmt,
pColors_in_out, nColors, pCompressed)
XcmsCCC ccc;
XcmsColor *pWhitePtFrom;
XcmsColor *pWhitePtTo;
XcmsColorFormat destSpecFmt;
XcmsColor *pColors_in_out;
unsigned int nColors;
Bool *pCompressed;
XcmsCIELuvWhiteShiftColors(
XcmsCCC ccc,
XcmsColor *pWhitePtFrom,
XcmsColor *pWhitePtTo,
XcmsColorFormat destSpecFmt,
XcmsColor *pColors_in_out,
unsigned int nColors,
Bool *pCompressed)
/*
* DESCRIPTION
* Adjusts color specifications in an array of XcmsColor
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -55,8 +55,8 @@
*/
Display *
XcmsDisplayOfCCC(ccc)
XcmsCCC ccc;
XcmsDisplayOfCCC(
XcmsCCC ccc)
/*
* DESCRIPTION
* Queries the Display of the specified CCC.
......@@ -78,8 +78,8 @@ XcmsDisplayOfCCC(ccc)
*/
Visual *
XcmsVisualOfCCC(ccc)
XcmsCCC ccc;
XcmsVisualOfCCC(
XcmsCCC ccc)
/*
* DESCRIPTION
* Queries the Visual of the specified CCC.
......@@ -101,8 +101,8 @@ XcmsVisualOfCCC(ccc)
*/
int
XcmsScreenNumberOfCCC(ccc)
XcmsCCC ccc;
XcmsScreenNumberOfCCC(
XcmsCCC ccc)
/*
* DESCRIPTION
* Queries the screen number of the specified CCC.
......@@ -124,8 +124,8 @@ XcmsScreenNumberOfCCC(ccc)
*/
XcmsColor *
XcmsScreenWhitePointOfCCC(ccc)
XcmsCCC ccc;
XcmsScreenWhitePointOfCCC(
XcmsCCC ccc)
/*
* DESCRIPTION
* Queries the screen white point of the specified CCC.
......@@ -147,8 +147,8 @@ XcmsScreenWhitePointOfCCC(ccc)
*/
XcmsColor *
XcmsClientWhitePointOfCCC(ccc)
XcmsCCC ccc;
XcmsClientWhitePointOfCCC(
XcmsCCC ccc)
/*
* DESCRIPTION
* Queries the client white point of the specified CCC.
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -47,8 +47,8 @@
* SYNOPSIS
*/
char *
XcmsPrefixOfFormat(id)
XcmsColorFormat id;
XcmsPrefixOfFormat(
XcmsColorFormat id)
/*
* DESCRIPTION
* Returns the color space prefix for the specified color
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -55,10 +55,10 @@
*/
Status
XcmsQueryBlack(ccc, target_format, pColor_ret)
XcmsCCC ccc;
XcmsColorFormat target_format;
XcmsColor *pColor_ret;
XcmsQueryBlack(
XcmsCCC ccc,
XcmsColorFormat target_format,
XcmsColor *pColor_ret)
/*
* DESCRIPTION
* Returns the color specification in the target format for
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -55,10 +55,10 @@
*/
Status
XcmsQueryBlue(ccc, target_format, pColor_ret)
XcmsCCC ccc;
XcmsColorFormat target_format;
XcmsColor *pColor_ret;
XcmsQueryBlue(
XcmsCCC ccc,
XcmsColorFormat target_format,
XcmsColor *pColor_ret)
/*
* DESCRIPTION
* Returns the color specification in the target format for
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -55,10 +55,10 @@
*/
Status
XcmsQueryGreen(ccc, target_format, pColor_ret)
XcmsCCC ccc;
XcmsColorFormat target_format;
XcmsColor *pColor_ret;
XcmsQueryGreen(
XcmsCCC ccc,
XcmsColorFormat target_format,
XcmsColor *pColor_ret)
/*
* DESCRIPTION
* Returns the color specification in the target format for
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -55,10 +55,10 @@
*/
Status
XcmsQueryRed(ccc, target_format, pColor_ret)
XcmsCCC ccc;
XcmsColorFormat target_format;
XcmsColor *pColor_ret;
XcmsQueryRed(
XcmsCCC ccc,
XcmsColorFormat target_format,
XcmsColor *pColor_ret)
/*
* DESCRIPTION
* Returns the color specification in the target format for
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -55,10 +55,10 @@
*/
Status
XcmsQueryWhite(ccc, target_format, pColor_ret)
XcmsCCC ccc;
XcmsColorFormat target_format;
XcmsColor *pColor_ret;
XcmsQueryWhite(
XcmsCCC ccc,
XcmsColorFormat target_format,
XcmsColor *pColor_ret)
/*
* DESCRIPTION
* Returns the color specification in the target format for
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -53,11 +53,11 @@
* SYNOPSIS
*/
Status
XcmsQueryColor(dpy, colormap, pXcmsColor_in_out, result_format)
Display *dpy;
Colormap colormap;
XcmsColor *pXcmsColor_in_out;
XcmsColorFormat result_format;
XcmsQueryColor(
Display *dpy,
Colormap colormap,
XcmsColor *pXcmsColor_in_out,
XcmsColorFormat result_format)
/*
* DESCRIPTION
* This routine uses XQueryColor to obtain the X RGB values
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -52,12 +52,12 @@
* SYNOPSIS
*/
Status
XcmsQueryColors(dpy, colormap, pXcmsColors_in_out, nColors, result_format)
Display *dpy;
Colormap colormap;
XcmsColor *pXcmsColors_in_out;
unsigned int nColors;
XcmsColorFormat result_format;
XcmsQueryColors(
Display *dpy,
Colormap colormap,
XcmsColor *pXcmsColors_in_out,
unsigned int nColors,
XcmsColorFormat result_format)
/*
* DESCRIPTION
* This routine uses XQueryColors to obtain the X RGB values
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -55,9 +55,9 @@
*/
Status
XcmsSetWhitePoint(ccc, pColor)
XcmsCCC ccc;
XcmsColor *pColor;
XcmsSetWhitePoint(
XcmsCCC ccc,
XcmsColor *pColor)
/*
* DESCRIPTION
* Sets the Client White Point in the specified CCC.
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -53,7 +53,7 @@
/*
* NAME
* XcmsSetColor -
* XcmsSetColor -
*
* SYNOPSIS
*/
......@@ -170,7 +170,7 @@ Query:
/*
* NAME
* XcmsSetColors -
* XcmsSetColors -
*
* SYNOPSIS
*/
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -53,10 +53,10 @@
* SYNOPSIS
*/
Status
XcmsStoreColor(dpy, colormap, pColor_in)
Display *dpy;
Colormap colormap;
XcmsColor *pColor_in;
XcmsStoreColor(
Display *dpy,
Colormap colormap,
XcmsColor *pColor_in)
/*
* DESCRIPTION
* Given a device-dependent or device-independent color
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -53,13 +53,12 @@
* SYNOPSIS
*/
Status
XcmsStoreColors(dpy, colormap, pColors_in,
nColors, pCompressed)
Display *dpy;
Colormap colormap;
XcmsColor *pColors_in;
unsigned int nColors;
Bool *pCompressed;
XcmsStoreColors(
Display *dpy,
Colormap colormap,
XcmsColor *pColors_in,
unsigned int nColors,
Bool *pCompressed)
/*
* DESCRIPTION
* Given device-dependent or device-independent color
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -74,7 +74,7 @@ static unsigned short const MASK[17] = {
/*
* NAME
* _XcmsRGB_to_XColor -
* _XcmsRGB_to_XColor -
*
* SYNOPSIS
*/
......@@ -161,7 +161,7 @@ _XcmsResolveColor(
* On a display with N-bit DACs, the "hardware" color is computed as:
*
* ((unsignedlong)(ClientValue >> (16-N)) * 0xFFFF) / ((1 << N) - 1)
*
*
*
* RETURNS
* void.
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -142,7 +142,24 @@ CIEXYZ_ParseString(
&pColor->spec.CIEXYZ.X,
&pColor->spec.CIEXYZ.Y,
&pColor->spec.CIEXYZ.Z) != 3) {
return(XcmsFailure);
char *s; /* Maybe failed due to locale */
int f;
if ((s = strdup(spec))) {
for (f = 0; s[f]; ++f)
if (s[f] == '.')
s[f] = ',';
else if (s[f] == ',')
s[f] = '.';
if (sscanf(s + n + 1, "%lf/%lf/%lf",
&pColor->spec.CIEXYZ.X,
&pColor->spec.CIEXYZ.Y,
&pColor->spec.CIEXYZ.Z) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure);
}
pColor->format = XcmsCIEXYZFormat;
pColor->pixel = 0;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -47,11 +47,11 @@
* SYNOPSIS
*/
Status
XcmsAllocColor(dpy, colormap, pXcmsColor_in_out, result_format)
Display *dpy;
Colormap colormap;
XcmsColor *pXcmsColor_in_out;
XcmsColorFormat result_format;
XcmsAllocColor(
Display *dpy,
Colormap colormap,
XcmsColor *pXcmsColor_in_out,
XcmsColorFormat result_format)
/*
* DESCRIPTION
* Given a device-dependent or device-independent color
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -43,7 +43,7 @@
/*
* NAME
* XcmsAllocNamedColor -
* XcmsAllocNamedColor -
*
* SYNOPSIS
*/
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -142,7 +142,7 @@ CmapRecForColormap(
visualTemplate.screen = i;
visualList = XGetVisualInfo(dpy, VisualScreenMask, &visualTemplate,
&nVisualsMatched);
if (nVisualsMatched == 0) {
if (visualList == NULL) {
continue;
}
......@@ -232,11 +232,11 @@ CmapRecForColormap(
* SYNOPSIS
*/
XcmsCmapRec *
_XcmsAddCmapRec(dpy, cmap, windowID, visual)
Display *dpy;
Colormap cmap;
Window windowID;
Visual *visual;
_XcmsAddCmapRec(
Display *dpy,
Colormap cmap,
Window windowID,
Visual *visual)
/*
* DESCRIPTION
* Create an XcmsCmapRec for the specified cmap, windowID,
......@@ -407,10 +407,10 @@ _XcmsFreeClientCmaps(
*
* SYNOPSIS
*/
XcmsCCC
XcmsCCCOfColormap(dpy, cmap)
Display *dpy;
Colormap cmap;
XcmsCCC
XcmsCCCOfColormap(
Display *dpy,
Colormap cmap)
/*
* DESCRIPTION
* Finds the XcmsCCC associated with the specified colormap.
......@@ -476,10 +476,10 @@ XcmsCCCOfColormap(dpy, cmap)
return(NULL);
}
XcmsCCC XcmsSetCCCOfColormap(dpy, cmap, ccc)
Display *dpy;
Colormap cmap;
XcmsCCC ccc;
XcmsCCC XcmsSetCCCOfColormap(
Display *dpy,
Colormap cmap,
XcmsCCC ccc)
{
XcmsCCC prev_ccc = NULL;
XcmsCmapRec *pRec;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -184,7 +184,7 @@ _XcmsParseColorString(
* DESCRIPTION
* Assuming color_string contains a numerical string color
* specification, attempts to parse a string into an
* XcmsColor structure.
* XcmsColor structure.
*
* RETURNS
* 0 if failed; otherwise non-zero.
......@@ -467,7 +467,7 @@ Retry:
pair->flag = CYCLE;
return(XcmsFailure);
}
if (_XcmsParseColorString(ccc, pair->second, pColor) == XcmsSuccess) {
/* f2 contains a numerical string specification */
return(XcmsSuccess);
......@@ -706,7 +706,7 @@ LoadColornameDB(void)
{
int size;
FILE *stream;
char *pathname;
const char *pathname;
struct stat txt;
int length;
......@@ -732,10 +732,17 @@ LoadColornameDB(void)
}
if ((stream = _XFopenFile (pathname, "r")) == NULL) {
/* can't open file */
XcmsColorDbState = XcmsDbInitFailure;
return(XcmsFailure);
}
stringSectionSize(stream, &nEntries, &size);
if (stringSectionSize(stream, &nEntries, &size) != XcmsSuccess ||
nEntries == 0) {
(void) fclose(stream);
XcmsColorDbState = XcmsDbInitFailure;
return(XcmsFailure);
}
rewind(stream);
strings = (char *) Xmalloc(size);
......@@ -806,7 +813,7 @@ _XcmsCopyISOLatin1Lowered(
/*
* NAME
* _XcmsResolveColorString -
* _XcmsResolveColorString -
*
* SYNOPSIS
*/
......@@ -862,7 +869,7 @@ _XcmsResolveColorString (
if (result_format != XcmsUndefinedFormat
&& pColor_exact_return->format != result_format) {
/* need to be converted to the target format */
return(XcmsConvertColors(ccc, pColor_exact_return, 1,
return(XcmsConvertColors(ccc, pColor_exact_return, 1,
result_format, (Bool *)NULL));
} else {
return(XcmsSuccess);
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -186,7 +186,7 @@ _XcmsInitDefaultCCCs(
if (!(ccc = (XcmsCCC)
Xcalloc((unsigned)nScrn, (unsigned) sizeof(XcmsCCCRec)))) {
return(0);
}
}
dpy->cms.defaultCCCs = (XPointer)ccc;
dpy->free_funcs->defaultCCCs = _XcmsFreeDefaultCCCs;
......@@ -325,7 +325,7 @@ _XcmsInitScrnInfo(
if (!(defaultccc->pPerScrnInfo = (XcmsPerScrnInfo *)
Xcalloc(1, (unsigned) sizeof(XcmsPerScrnInfo)))) {
return(0);
}
}
defaultccc->pPerScrnInfo->state = XcmsInitNone;
}
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -43,7 +43,7 @@
/*
* NAME
* XcmsLookupColor -
* XcmsLookupColor -
*
* SYNOPSIS
*/
......
......@@ -51,8 +51,7 @@ int sqrt_loopcount;
/* for cube roots, x^3 - a = 0, x_new = x - 1/3 (x - a/x^2) */
double
_XcmsCubeRoot(a)
double a;
_XcmsCubeRoot(double a)
{
register double abs_a, cur_guess, delta;
......@@ -90,14 +89,13 @@ _XcmsCubeRoot(a)
#endif
return cur_guess;
}
/* for square roots, x^2 - a = 0, x_new = x - 1/2 (x - a/x) */
double
_XcmsSquareRoot(a)
double a;
_XcmsSquareRoot(double a)
{
register double cur_guess, delta;
......@@ -135,4 +133,4 @@ _XcmsSquareRoot(a)
#endif
return cur_guess;
}
......@@ -3,7 +3,7 @@
*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -11,10 +11,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -125,10 +125,10 @@ _XcmsGetProperty(
unsigned long nitems_ret, after_ret;
#endif
Atom atom_ret;
while (XGetWindowProperty (pDpy, w, property, 0, len, False,
XA_INTEGER, &atom_ret, &format_ret,
&nitems_ret, &after_ret,
while (XGetWindowProperty (pDpy, w, property, 0, len, False,
XA_INTEGER, &atom_ret, &format_ret,
&nitems_ret, &after_ret,
(unsigned char **)&prop_ret)) {
if (after_ret > 0) {
len += nitems_ret * (format_ret >> 3);
......@@ -137,7 +137,7 @@ _XcmsGetProperty(
break;
}
}
if (format_ret == 0 || nitems_ret == 0) {
if (format_ret == 0 || nitems_ret == 0) {
/* the property does not exist or is of an unexpected type */
return(XcmsFailure);
}
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -159,7 +159,7 @@ static double const sin_qcoeffs[] = {
* to the range over which the polynomial approximation
* is valid, and as the polynomial is evaluated using
* finite-precision arithmetic.
*
*
* PROGRAMMER
*
* Fred Fish
......@@ -219,7 +219,7 @@ static double const sin_qcoeffs[] = {
* HART satisfies this requirement, although not explicitly
* stated in the text. This may not be true of other
* approximations given in the reference.
*
*
*/
double _XcmsCosine(double x)
......@@ -438,7 +438,7 @@ static double _XcmsPolynomial(
* to the range over which the polynomial approximation
* is valid, and as the polynomial is evaluated using
* finite-precision arithmetic.
*
*
* PROGRAMMER
*
* Fred Fish
......@@ -499,12 +499,11 @@ static double _XcmsPolynomial(
* HART satisfies this requirement, although not explicitly
* stated in the text. This may not be true of other
* approximations given in the reference.
*
*
*/
double
_XcmsSine (x)
double x;
_XcmsSine (double x)
{
double y;
double yt2;
......@@ -544,8 +543,7 @@ double x;
* SYNOPSIS
*/
double
_XcmsArcTangent(x)
double x;
_XcmsArcTangent(double x)
/*
* DESCRIPTION
* Computes the arctangent.
......@@ -555,7 +553,7 @@ _XcmsArcTangent(x)
* New York, NY, Harper & Row, 1970.
*
* RETURNS
* Returns the arctangent
* Returns the arctangent
*/
{
double ai, a1 = 0.0, bi, b1 = 0.0, l, d;
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of XCMS based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -157,7 +157,24 @@ CIEuvY_ParseString(
&pColor->spec.CIEuvY.u_prime,
&pColor->spec.CIEuvY.v_prime,
&pColor->spec.CIEuvY.Y) != 3) {
return(XcmsFailure);
char *s; /* Maybe failed due to locale */
int f;
if ((s = strdup(spec))) {
for (f = 0; s[f]; ++f)
if (s[f] == '.')
s[f] = ',';
else if (s[f] == ',')
s[f] = '.';
if (sscanf(s + n + 1, "%lf/%lf/%lf",
&pColor->spec.CIEuvY.u_prime,
&pColor->spec.CIEuvY.v_prime,
&pColor->spec.CIEuvY.Y) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure);
}
pColor->format = XcmsCIEuvYFormat;
pColor->pixel = 0;
......@@ -208,11 +225,11 @@ _XcmsCIEuvY_ValidSpec(
* SYNOPSIS
*/
Status
XcmsCIEuvYToCIEXYZ(ccc, puvY_WhitePt, pColors_in_out, nColors)
XcmsCCC ccc;
XcmsColor *puvY_WhitePt;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsCIEuvYToCIEXYZ(
XcmsCCC ccc,
XcmsColor *puvY_WhitePt,
XcmsColor *pColors_in_out,
unsigned int nColors)
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......@@ -323,11 +340,11 @@ XcmsCIEuvYToCIEXYZ(ccc, puvY_WhitePt, pColors_in_out, nColors)
* SYNOPSIS
*/
Status
XcmsCIEXYZToCIEuvY(ccc, puvY_WhitePt, pColors_in_out, nColors)
XcmsCCC ccc;
XcmsColor *puvY_WhitePt;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsCIEXYZToCIEuvY(
XcmsCCC ccc,
XcmsColor *puvY_WhitePt,
XcmsColor *pColors_in_out,
unsigned int nColors)
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......
......@@ -2,7 +2,7 @@
/*
* Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
* All Rights Reserved
*
*
* This file is a component of an X Window System-specific implementation
* of Xcms based on the TekColor Color Management System. Permission is
* hereby granted to use, copy, modify, sell, and otherwise distribute this
......@@ -10,10 +10,10 @@
* that this copyright, permission, and disclaimer notice is reproduced in
* all copies of this software and in supporting documentation. TekColor
* is a trademark of Tektronix, Inc.
*
*
* Tektronix makes no representation about the suitability of this software
* for any purpose. It is provided "as is" and with all faults.
*
*
* TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
* INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
......@@ -156,7 +156,24 @@ CIExyY_ParseString(
&pColor->spec.CIExyY.x,
&pColor->spec.CIExyY.y,
&pColor->spec.CIExyY.Y) != 3) {
return(XcmsFailure);
char *s; /* Maybe failed due to locale */
int f;
if ((s = strdup(spec))) {
for (f = 0; s[f]; ++f)
if (s[f] == '.')
s[f] = ',';
else if (s[f] == ',')
s[f] = '.';
if (sscanf(s + n + 1, "%lf/%lf/%lf",
&pColor->spec.CIExyY.x,
&pColor->spec.CIExyY.y,
&pColor->spec.CIExyY.Y) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure);
}
pColor->format = XcmsCIExyYFormat;
pColor->pixel = 0;
......@@ -216,11 +233,11 @@ XcmsCIExyY_ValidSpec(
* SYNOPSIS
*/
Status
XcmsCIExyYToCIEXYZ(ccc, pxyY_WhitePt, pColors_in_out, nColors)
XcmsCCC ccc;
XcmsColor *pxyY_WhitePt;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsCIExyYToCIEXYZ(
XcmsCCC ccc,
XcmsColor *pxyY_WhitePt,
XcmsColor *pColors_in_out,
unsigned int nColors)
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......@@ -323,11 +340,11 @@ XcmsCIExyYToCIEXYZ(ccc, pxyY_WhitePt, pColors_in_out, nColors)
*/
/* ARGSUSED */
Status
XcmsCIEXYZToCIExyY(ccc, pxyY_WhitePt, pColors_in_out, nColors)
XcmsCCC ccc;
XcmsColor *pxyY_WhitePt;
XcmsColor *pColors_in_out;
unsigned int nColors;
XcmsCIEXYZToCIExyY(
XcmsCCC ccc,
XcmsColor *pxyY_WhitePt,
XcmsColor *pColors_in_out,
unsigned int nColors)
/*
* DESCRIPTION
* Converts color specifications in an array of XcmsColor
......@@ -363,7 +380,7 @@ XcmsCIEXYZToCIExyY(ccc, pxyY_WhitePt, pColors_in_out, nColors)
/* Now convert for XYZ to xyY */
if ((div = pColor->spec.CIEXYZ.X + pColor->spec.CIEXYZ.Y + pColor->spec.CIEXYZ.Z) == 0.0) {
div = EPS;
}
}
xyY_return.x = pColor->spec.CIEXYZ.X / div;
xyY_return.y = pColor->spec.CIEXYZ.Y / div;
xyY_return.Y = pColor->spec.CIEXYZ.Y;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment