Commit e868fbbf authored by Ulrich Sibiller's avatar Ulrich Sibiller

update xcms files to libX11 1.3.4

parent 27492905
...@@ -55,8 +55,7 @@ ...@@ -55,8 +55,7 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsAddColorSpace(pCS) XcmsAddColorSpace(XcmsColorSpace *pCS)
XcmsColorSpace *pCS;
/* /*
* DESCRIPTION * DESCRIPTION
* DI Color Spaces are managed on a global basis. * DI Color Spaces are managed on a global basis.
......
...@@ -55,8 +55,7 @@ ...@@ -55,8 +55,7 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsAddFunctionSet(pNewFS) XcmsAddFunctionSet(XcmsFunctionSet *pNewFS)
XcmsFunctionSet *pNewFS;
/* /*
* DESCRIPTION * DESCRIPTION
* Additional Screen Color Characterization Function Sets are * Additional Screen Color Characterization Function Sets are
......
...@@ -85,16 +85,15 @@ from The Open Group. ...@@ -85,16 +85,15 @@ from The Open Group.
*/ */
XcmsCCC XcmsCCC
XcmsCreateCCC(dpy, screenNumber, visual, clientWhitePt, gamutCompProc, XcmsCreateCCC(
gamutCompClientData, whitePtAdjProc, whitePtAdjClientData) Display *dpy,
Display *dpy; int screenNumber,
int screenNumber; Visual *visual,
Visual *visual; XcmsColor *clientWhitePt,
XcmsColor *clientWhitePt; XcmsCompressionProc gamutCompProc,
XcmsCompressionProc gamutCompProc; XPointer gamutCompClientData,
XPointer gamutCompClientData; XcmsWhiteAdjustProc whitePtAdjProc,
XcmsWhiteAdjustProc whitePtAdjProc; XPointer whitePtAdjClientData)
XPointer whitePtAdjClientData;
/* /*
* DESCRIPTION * DESCRIPTION
* Given a Display, Screen, Visual, etc., this routine creates * Given a Display, Screen, Visual, etc., this routine creates
...@@ -172,9 +171,9 @@ XcmsCreateCCC(dpy, screenNumber, visual, clientWhitePt, gamutCompProc, ...@@ -172,9 +171,9 @@ XcmsCreateCCC(dpy, screenNumber, visual, clientWhitePt, gamutCompProc,
* SYNOPSIS * SYNOPSIS
*/ */
XcmsCCC XcmsCCC
XcmsDefaultCCC(dpy, screenNumber) XcmsDefaultCCC(
Display *dpy; Display *dpy,
int screenNumber; int screenNumber)
/* /*
* DESCRIPTION * DESCRIPTION
* Given a Display and Screen, this routine creates * Given a Display and Screen, this routine creates
...@@ -254,8 +253,7 @@ XcmsDefaultCCC(dpy, screenNumber) ...@@ -254,8 +253,7 @@ XcmsDefaultCCC(dpy, screenNumber)
* SYNOPSIS * SYNOPSIS
*/ */
void void
XcmsFreeCCC(ccc) XcmsFreeCCC(XcmsCCC ccc)
XcmsCCC ccc;
/* /*
* DESCRIPTION * DESCRIPTION
* Frees memory associated with a Color Conversion Context * Frees memory associated with a Color Conversion Context
......
...@@ -712,12 +712,12 @@ Continue: ...@@ -712,12 +712,12 @@ Continue:
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsConvertColors(ccc, pColors_in_out, nColors, targetFormat, pCompressed) XcmsConvertColors(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors,
XcmsColorFormat targetFormat; XcmsColorFormat targetFormat,
Bool *pCompressed; Bool *pCompressed)
/* /*
* DESCRIPTION * DESCRIPTION
* Convert XcmsColor structures to another format * Convert XcmsColor structures to another format
......
...@@ -198,6 +198,23 @@ TekHVC_ParseString( ...@@ -198,6 +198,23 @@ TekHVC_ParseString(
&pColor->spec.TekHVC.H, &pColor->spec.TekHVC.H,
&pColor->spec.TekHVC.V, &pColor->spec.TekHVC.V,
&pColor->spec.TekHVC.C) != 3) { &pColor->spec.TekHVC.C) != 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.TekHVC.H,
&pColor->spec.TekHVC.V,
&pColor->spec.TekHVC.C) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure); return(XcmsFailure);
} }
pColor->format = XcmsTekHVCFormat; pColor->format = XcmsTekHVCFormat;
...@@ -310,11 +327,11 @@ XcmsTekHVC_ValidSpec( ...@@ -310,11 +327,11 @@ XcmsTekHVC_ValidSpec(
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsTekHVCToCIEuvY(ccc, pHVC_WhitePt, pColors_in_out, nColors) XcmsTekHVCToCIEuvY(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pHVC_WhitePt; XcmsColor *pHVC_WhitePt,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors)
/* /*
* DESCRIPTION * DESCRIPTION
* Transforms an array of TekHVC color specifications, given * Transforms an array of TekHVC color specifications, given
...@@ -431,11 +448,11 @@ XcmsTekHVCToCIEuvY(ccc, pHVC_WhitePt, pColors_in_out, nColors) ...@@ -431,11 +448,11 @@ XcmsTekHVCToCIEuvY(ccc, pHVC_WhitePt, pColors_in_out, nColors)
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIEuvYToTekHVC(ccc, pHVC_WhitePt, pColors_in_out, nColors) XcmsCIEuvYToTekHVC(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pHVC_WhitePt; XcmsColor *pHVC_WhitePt,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors)
/* /*
* DESCRIPTION * DESCRIPTION
* Transforms an array of CIECIEuvY.color specifications, given * Transforms an array of CIECIEuvY.color specifications, given
......
...@@ -65,12 +65,12 @@ ...@@ -65,12 +65,12 @@
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsTekHVCClipC (ccc, pColors_in_out, nColors, i, pCompressed) XcmsTekHVCClipC (
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors,
unsigned int i; unsigned int i,
Bool *pCompressed; Bool *pCompressed)
/* /*
* DESCRIPTION * DESCRIPTION
* Reduce the Chroma for a specific hue and value to * Reduce the Chroma for a specific hue and value to
......
...@@ -65,12 +65,12 @@ ...@@ -65,12 +65,12 @@
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsTekHVCClipV (ccc, pColors_in_out, nColors, i, pCompressed) XcmsTekHVCClipV (
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors,
unsigned int i; unsigned int i,
Bool *pCompressed; Bool *pCompressed)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the closest value for a specific hue and chroma. * Return the closest value for a specific hue and chroma.
......
...@@ -73,12 +73,12 @@ ...@@ -73,12 +73,12 @@
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsTekHVCClipVC (ccc, pColors_in_out, nColors, i, pCompressed) XcmsTekHVCClipVC (
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors,
unsigned int i; unsigned int i,
Bool *pCompressed; Bool *pCompressed)
/* /*
* DESCRIPTION * DESCRIPTION
* This routine will find the closest value and chroma * This routine will find the closest value and chroma
......
...@@ -69,11 +69,11 @@ ...@@ -69,11 +69,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsTekHVCQueryMinV (ccc, hue, chroma, pColor_return) XcmsTekHVCQueryMinV (
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue; XcmsFloat hue,
XcmsFloat chroma; XcmsFloat chroma,
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
......
...@@ -72,11 +72,11 @@ ...@@ -72,11 +72,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsTekHVCQueryMaxC(ccc, hue, value, pColor_return) XcmsTekHVCQueryMaxC(
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue; XcmsFloat hue,
XcmsFloat value; XcmsFloat value,
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the maximum chroma for a specific hue and value. * Return the maximum chroma for a specific hue and value.
......
...@@ -72,11 +72,11 @@ ...@@ -72,11 +72,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsTekHVCQueryMaxV(ccc, hue, chroma, pColor_return) XcmsTekHVCQueryMaxV(
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue; XcmsFloat hue,
XcmsFloat chroma; XcmsFloat chroma,
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the maximum value for a specified hue and chroma. * Return the maximum value for a specified hue and chroma.
......
...@@ -180,10 +180,10 @@ _XcmsTekHVCQueryMaxVCRGB( ...@@ -180,10 +180,10 @@ _XcmsTekHVCQueryMaxVCRGB(
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsTekHVCQueryMaxVC (ccc, hue, pColor_return) XcmsTekHVCQueryMaxVC (
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue; XcmsFloat hue,
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
......
...@@ -65,11 +65,11 @@ ...@@ -65,11 +65,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsTekHVCQueryMaxVSamples(ccc, hue, pColor_in_out, nSamples) XcmsTekHVCQueryMaxVSamples(
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue; XcmsFloat hue,
XcmsColor *pColor_in_out; XcmsColor *pColor_in_out,
unsigned int nSamples; unsigned int nSamples)
/* /*
* DESCRIPTION * DESCRIPTION
......
...@@ -65,15 +65,14 @@ ...@@ -65,15 +65,14 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsTekHVCWhiteShiftColors(ccc, pWhitePtFrom, pWhitePtTo, destSpecFmt, XcmsTekHVCWhiteShiftColors(
pColors_in_out, nColors, pCompressed) XcmsCCC ccc,
XcmsCCC ccc; XcmsColor *pWhitePtFrom,
XcmsColor *pWhitePtFrom; XcmsColor *pWhitePtTo,
XcmsColor *pWhitePtTo; XcmsColorFormat destSpecFmt,
XcmsColorFormat destSpecFmt; XcmsColor *pColors_in_out,
XcmsColor *pColors_in_out; unsigned int nColors,
unsigned int nColors; Bool *pCompressed)
Bool *pCompressed;
/* /*
* DESCRIPTION * DESCRIPTION
* Convert color specifications in an array of XcmsColor structures * Convert color specifications in an array of XcmsColor structures
......
...@@ -47,8 +47,7 @@ ...@@ -47,8 +47,7 @@
* SYNOPSIS * SYNOPSIS
*/ */
XcmsColorFormat XcmsColorFormat
XcmsFormatOfPrefix(prefix) XcmsFormatOfPrefix(char *prefix)
char *prefix;
/* /*
* DESCRIPTION * DESCRIPTION
* Returns the Color Space ID for the specified prefix * Returns the Color Space ID for the specified prefix
......
...@@ -1430,6 +1430,23 @@ XcmsLRGB_RGBi_ParseString( ...@@ -1430,6 +1430,23 @@ XcmsLRGB_RGBi_ParseString(
&pColor->spec.RGBi.red, &pColor->spec.RGBi.red,
&pColor->spec.RGBi.green, &pColor->spec.RGBi.green,
&pColor->spec.RGBi.blue) != 3) { &pColor->spec.RGBi.blue) != 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.RGBi.red,
&pColor->spec.RGBi.green,
&pColor->spec.RGBi.blue) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure); return(XcmsFailure);
} }
...@@ -1450,11 +1467,11 @@ XcmsLRGB_RGBi_ParseString( ...@@ -1450,11 +1467,11 @@ XcmsLRGB_RGBi_ParseString(
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsCIEXYZToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed) XcmsCIEXYZToRGBi(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pXcmsColors_in_out;/* pointer to XcmsColors to convert */ XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */
unsigned int nColors; /* Number of colors */ unsigned int nColors, /* Number of colors */
Bool *pCompressed; /* pointer to an array of Bool */ Bool *pCompressed) /* pointer to an array of Bool */
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
...@@ -1572,11 +1589,11 @@ XcmsCIEXYZToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed) ...@@ -1572,11 +1589,11 @@ XcmsCIEXYZToRGBi(ccc, pXcmsColors_in_out, nColors, pCompressed)
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsRGBiToCIEXYZ(ccc, pXcmsColors_in_out, nColors, pCompressed) XcmsRGBiToCIEXYZ(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pXcmsColors_in_out;/* pointer to XcmsColors to convert */ XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */
unsigned int nColors; /* Number of colors */ unsigned int nColors, /* Number of colors */
Bool *pCompressed; /* pointer to a bit array */ Bool *pCompressed) /* pointer to a bit array */
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
...@@ -1625,11 +1642,11 @@ XcmsRGBiToCIEXYZ(ccc, pXcmsColors_in_out, nColors, pCompressed) ...@@ -1625,11 +1642,11 @@ XcmsRGBiToCIEXYZ(ccc, pXcmsColors_in_out, nColors, pCompressed)
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsRGBiToRGB(ccc, pXcmsColors_in_out, nColors, pCompressed) XcmsRGBiToRGB(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pXcmsColors_in_out;/* pointer to XcmsColors to convert */ XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */
unsigned int nColors; /* Number of colors */ unsigned int nColors, /* Number of colors */
Bool *pCompressed; /* pointer to a bit array */ Bool *pCompressed) /* pointer to a bit array */
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
......
...@@ -160,6 +160,23 @@ CIELab_ParseString( ...@@ -160,6 +160,23 @@ CIELab_ParseString(
&pColor->spec.CIELab.L_star, &pColor->spec.CIELab.L_star,
&pColor->spec.CIELab.a_star, &pColor->spec.CIELab.a_star,
&pColor->spec.CIELab.b_star) != 3) { &pColor->spec.CIELab.b_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.CIELab.L_star,
&pColor->spec.CIELab.a_star,
&pColor->spec.CIELab.b_star) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure); return(XcmsFailure);
} }
pColor->format = XcmsCIELabFormat; pColor->format = XcmsCIELabFormat;
...@@ -213,11 +230,11 @@ XcmsCIELab_ValidSpec( ...@@ -213,11 +230,11 @@ XcmsCIELab_ValidSpec(
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELabToCIEXYZ(ccc, pLab_WhitePt, pColors_in_out, nColors) XcmsCIELabToCIEXYZ(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pLab_WhitePt; XcmsColor *pLab_WhitePt,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors)
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
...@@ -316,11 +333,11 @@ XcmsCIELabToCIEXYZ(ccc, pLab_WhitePt, pColors_in_out, nColors) ...@@ -316,11 +333,11 @@ XcmsCIELabToCIEXYZ(ccc, pLab_WhitePt, pColors_in_out, nColors)
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIEXYZToCIELab(ccc, pLab_WhitePt, pColors_in_out, nColors) XcmsCIEXYZToCIELab(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pLab_WhitePt; XcmsColor *pLab_WhitePt,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors)
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
......
...@@ -52,12 +52,12 @@ ...@@ -52,12 +52,12 @@
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsCIELabClipab (ccc, pColors_in_out, nColors, i, pCompressed) XcmsCIELabClipab (
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors,
unsigned int i; unsigned int i,
Bool *pCompressed; Bool *pCompressed)
/* /*
* DESCRIPTION * DESCRIPTION
* Reduce the Chroma for a specific hue and chroma to * Reduce the Chroma for a specific hue and chroma to
......
...@@ -52,12 +52,12 @@ ...@@ -52,12 +52,12 @@
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsCIELabClipL (ccc, pColors_in_out, nColors, i, pCompressed) XcmsCIELabClipL (
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors,
unsigned int i; unsigned int i,
Bool *pCompressed; Bool *pCompressed)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the closest L* for a specific hue and chroma. * Return the closest L* for a specific hue and chroma.
......
...@@ -60,12 +60,12 @@ ...@@ -60,12 +60,12 @@
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsCIELabClipLab (ccc, pColors_in_out, nColors, i, pCompressed) XcmsCIELabClipLab (
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors,
unsigned int i; unsigned int i,
Bool *pCompressed; Bool *pCompressed)
/* /*
* DESCRIPTION * DESCRIPTION
* This routine will find the closest L* and chroma * This routine will find the closest L* and chroma
......
...@@ -60,11 +60,11 @@ ...@@ -60,11 +60,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELabQueryMinL(ccc, hue_angle, chroma, pColor_return) XcmsCIELabQueryMinL(
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue_angle; /* hue angle in degrees */ XcmsFloat hue_angle, /* hue angle in degrees */
XcmsFloat chroma; XcmsFloat chroma,
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the maximum Lstar for a specified hue_angle and chroma. * Return the maximum Lstar for a specified hue_angle and chroma.
......
...@@ -63,11 +63,11 @@ ...@@ -63,11 +63,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELabQueryMaxC(ccc, hue_angle, L_star, pColor_return) XcmsCIELabQueryMaxC(
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue_angle; /* hue angle in degrees */ XcmsFloat hue_angle, /* hue angle in degrees */
XcmsFloat L_star; XcmsFloat L_star,
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the maximum chroma for a specific hue_angle and L_star. * Return the maximum chroma for a specific hue_angle and L_star.
......
...@@ -60,11 +60,11 @@ ...@@ -60,11 +60,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELabQueryMaxL(ccc, hue_angle, chroma, pColor_return) XcmsCIELabQueryMaxL(
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue_angle; /* hue in degrees */ XcmsFloat hue_angle, /* hue in degrees */
XcmsFloat chroma; XcmsFloat chroma,
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the maximum Lstar for a specified hue_angle and chroma. * Return the maximum Lstar for a specified hue_angle and chroma.
......
...@@ -170,10 +170,10 @@ _XcmsCIELabQueryMaxLCRGB( ...@@ -170,10 +170,10 @@ _XcmsCIELabQueryMaxLCRGB(
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELabQueryMaxLC (ccc, hue_angle, pColor_return) XcmsCIELabQueryMaxLC (
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue_angle; /* hue_angle in degrees */ XcmsFloat hue_angle, /* hue_angle in degrees */
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
......
...@@ -57,15 +57,14 @@ ...@@ -57,15 +57,14 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELabWhiteShiftColors(ccc, pWhitePtFrom, pWhitePtTo, destSpecFmt, XcmsCIELabWhiteShiftColors(
pColors_in_out, nColors, pCompressed) XcmsCCC ccc,
XcmsCCC ccc; XcmsColor *pWhitePtFrom,
XcmsColor *pWhitePtFrom; XcmsColor *pWhitePtTo,
XcmsColor *pWhitePtTo; XcmsColorFormat destSpecFmt,
XcmsColorFormat destSpecFmt; XcmsColor *pColors_in_out,
XcmsColor *pColors_in_out; unsigned int nColors,
unsigned int nColors; Bool *pCompressed)
Bool *pCompressed;
/* /*
* DESCRIPTION * DESCRIPTION
* Adjust color specifications in XcmsColor structures for * Adjust color specifications in XcmsColor structures for
......
...@@ -163,6 +163,23 @@ CIELuv_ParseString( ...@@ -163,6 +163,23 @@ CIELuv_ParseString(
&pColor->spec.CIELuv.L_star, &pColor->spec.CIELuv.L_star,
&pColor->spec.CIELuv.u_star, &pColor->spec.CIELuv.u_star,
&pColor->spec.CIELuv.v_star) != 3) { &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); return(XcmsFailure);
} }
pColor->format = XcmsCIELuvFormat; pColor->format = XcmsCIELuvFormat;
...@@ -214,11 +231,11 @@ XcmsCIELuv_ValidSpec( ...@@ -214,11 +231,11 @@ XcmsCIELuv_ValidSpec(
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELuvToCIEuvY(ccc, pLuv_WhitePt, pColors_in_out, nColors) XcmsCIELuvToCIEuvY(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pLuv_WhitePt; XcmsColor *pLuv_WhitePt,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors)
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
...@@ -306,11 +323,11 @@ XcmsCIELuvToCIEuvY(ccc, pLuv_WhitePt, pColors_in_out, nColors) ...@@ -306,11 +323,11 @@ XcmsCIELuvToCIEuvY(ccc, pLuv_WhitePt, pColors_in_out, nColors)
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIEuvYToCIELuv(ccc, pLuv_WhitePt, pColors_in_out, nColors) XcmsCIEuvYToCIELuv(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pLuv_WhitePt; XcmsColor *pLuv_WhitePt,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors)
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
......
...@@ -52,12 +52,12 @@ ...@@ -52,12 +52,12 @@
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsCIELuvClipuv (ccc, pColors_in_out, nColors, i, pCompressed) XcmsCIELuvClipuv (
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors,
unsigned int i; unsigned int i,
Bool *pCompressed; Bool *pCompressed)
/* /*
* DESCRIPTION * DESCRIPTION
* Reduce the Chroma for a specific hue and chroma to * Reduce the Chroma for a specific hue and chroma to
......
...@@ -52,12 +52,12 @@ ...@@ -52,12 +52,12 @@
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsCIELuvClipL (ccc, pColors_in_out, nColors, i, pCompressed) XcmsCIELuvClipL (
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors,
unsigned int i; unsigned int i,
Bool *pCompressed; Bool *pCompressed)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the closest L* for a specific hue and chroma. * Return the closest L* for a specific hue and chroma.
......
...@@ -60,12 +60,12 @@ ...@@ -60,12 +60,12 @@
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsCIELuvClipLuv (ccc, pColors_in_out, nColors, i, pCompressed) XcmsCIELuvClipLuv (
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors,
unsigned int i; unsigned int i,
Bool *pCompressed; Bool *pCompressed)
/* /*
* DESCRIPTION * DESCRIPTION
* This routine will find the closest L* and chroma * This routine will find the closest L* and chroma
......
...@@ -60,11 +60,11 @@ ...@@ -60,11 +60,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELuvQueryMinL(ccc, hue_angle, chroma, pColor_return) XcmsCIELuvQueryMinL(
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue_angle; /* hue angle in degrees */ XcmsFloat hue_angle, /* hue angle in degrees */
XcmsFloat chroma; XcmsFloat chroma,
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the maximum Lstar for a specified hue_angle and chroma. * Return the maximum Lstar for a specified hue_angle and chroma.
......
...@@ -63,11 +63,11 @@ ...@@ -63,11 +63,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELuvQueryMaxC(ccc, hue_angle, L_star, pColor_return) XcmsCIELuvQueryMaxC(
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue_angle; /* hue angle in degrees */ XcmsFloat hue_angle, /* hue angle in degrees */
XcmsFloat L_star; XcmsFloat L_star,
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the maximum chroma for a specific hue_angle and L_star. * Return the maximum chroma for a specific hue_angle and L_star.
......
...@@ -60,11 +60,11 @@ ...@@ -60,11 +60,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELuvQueryMaxL(ccc, hue_angle, chroma, pColor_return) XcmsCIELuvQueryMaxL(
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue_angle; /* hue angle in degrees */ XcmsFloat hue_angle, /* hue angle in degrees */
XcmsFloat chroma; XcmsFloat chroma,
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
* Return the maximum Lstar for a specified hue_angle and chroma. * Return the maximum Lstar for a specified hue_angle and chroma.
......
...@@ -170,10 +170,10 @@ _XcmsCIELuvQueryMaxLCRGB( ...@@ -170,10 +170,10 @@ _XcmsCIELuvQueryMaxLCRGB(
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELuvQueryMaxLC (ccc, hue_angle, pColor_return) XcmsCIELuvQueryMaxLC (
XcmsCCC ccc; XcmsCCC ccc,
XcmsFloat hue_angle; /* hue angle in degrees */ XcmsFloat hue_angle, /* hue angle in degrees */
XcmsColor *pColor_return; XcmsColor *pColor_return)
/* /*
* DESCRIPTION * DESCRIPTION
......
...@@ -54,15 +54,14 @@ ...@@ -54,15 +54,14 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIELuvWhiteShiftColors(ccc, pWhitePtFrom, pWhitePtTo, destSpecFmt, XcmsCIELuvWhiteShiftColors(
pColors_in_out, nColors, pCompressed) XcmsCCC ccc,
XcmsCCC ccc; XcmsColor *pWhitePtFrom,
XcmsColor *pWhitePtFrom; XcmsColor *pWhitePtTo,
XcmsColor *pWhitePtTo; XcmsColorFormat destSpecFmt,
XcmsColorFormat destSpecFmt; XcmsColor *pColors_in_out,
XcmsColor *pColors_in_out; unsigned int nColors,
unsigned int nColors; Bool *pCompressed)
Bool *pCompressed;
/* /*
* DESCRIPTION * DESCRIPTION
* Adjusts color specifications in an array of XcmsColor * Adjusts color specifications in an array of XcmsColor
......
...@@ -55,8 +55,8 @@ ...@@ -55,8 +55,8 @@
*/ */
Display * Display *
XcmsDisplayOfCCC(ccc) XcmsDisplayOfCCC(
XcmsCCC ccc; XcmsCCC ccc)
/* /*
* DESCRIPTION * DESCRIPTION
* Queries the Display of the specified CCC. * Queries the Display of the specified CCC.
...@@ -78,8 +78,8 @@ XcmsDisplayOfCCC(ccc) ...@@ -78,8 +78,8 @@ XcmsDisplayOfCCC(ccc)
*/ */
Visual * Visual *
XcmsVisualOfCCC(ccc) XcmsVisualOfCCC(
XcmsCCC ccc; XcmsCCC ccc)
/* /*
* DESCRIPTION * DESCRIPTION
* Queries the Visual of the specified CCC. * Queries the Visual of the specified CCC.
...@@ -101,8 +101,8 @@ XcmsVisualOfCCC(ccc) ...@@ -101,8 +101,8 @@ XcmsVisualOfCCC(ccc)
*/ */
int int
XcmsScreenNumberOfCCC(ccc) XcmsScreenNumberOfCCC(
XcmsCCC ccc; XcmsCCC ccc)
/* /*
* DESCRIPTION * DESCRIPTION
* Queries the screen number of the specified CCC. * Queries the screen number of the specified CCC.
...@@ -124,8 +124,8 @@ XcmsScreenNumberOfCCC(ccc) ...@@ -124,8 +124,8 @@ XcmsScreenNumberOfCCC(ccc)
*/ */
XcmsColor * XcmsColor *
XcmsScreenWhitePointOfCCC(ccc) XcmsScreenWhitePointOfCCC(
XcmsCCC ccc; XcmsCCC ccc)
/* /*
* DESCRIPTION * DESCRIPTION
* Queries the screen white point of the specified CCC. * Queries the screen white point of the specified CCC.
...@@ -147,8 +147,8 @@ XcmsScreenWhitePointOfCCC(ccc) ...@@ -147,8 +147,8 @@ XcmsScreenWhitePointOfCCC(ccc)
*/ */
XcmsColor * XcmsColor *
XcmsClientWhitePointOfCCC(ccc) XcmsClientWhitePointOfCCC(
XcmsCCC ccc; XcmsCCC ccc)
/* /*
* DESCRIPTION * DESCRIPTION
* Queries the client white point of the specified CCC. * Queries the client white point of the specified CCC.
......
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
* SYNOPSIS * SYNOPSIS
*/ */
char * char *
XcmsPrefixOfFormat(id) XcmsPrefixOfFormat(
XcmsColorFormat id; XcmsColorFormat id)
/* /*
* DESCRIPTION * DESCRIPTION
* Returns the color space prefix for the specified color * Returns the color space prefix for the specified color
......
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
*/ */
Status Status
XcmsQueryBlack(ccc, target_format, pColor_ret) XcmsQueryBlack(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColorFormat target_format; XcmsColorFormat target_format,
XcmsColor *pColor_ret; XcmsColor *pColor_ret)
/* /*
* DESCRIPTION * DESCRIPTION
* Returns the color specification in the target format for * Returns the color specification in the target format for
......
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
*/ */
Status Status
XcmsQueryBlue(ccc, target_format, pColor_ret) XcmsQueryBlue(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColorFormat target_format; XcmsColorFormat target_format,
XcmsColor *pColor_ret; XcmsColor *pColor_ret)
/* /*
* DESCRIPTION * DESCRIPTION
* Returns the color specification in the target format for * Returns the color specification in the target format for
......
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
*/ */
Status Status
XcmsQueryGreen(ccc, target_format, pColor_ret) XcmsQueryGreen(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColorFormat target_format; XcmsColorFormat target_format,
XcmsColor *pColor_ret; XcmsColor *pColor_ret)
/* /*
* DESCRIPTION * DESCRIPTION
* Returns the color specification in the target format for * Returns the color specification in the target format for
......
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
*/ */
Status Status
XcmsQueryRed(ccc, target_format, pColor_ret) XcmsQueryRed(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColorFormat target_format; XcmsColorFormat target_format,
XcmsColor *pColor_ret; XcmsColor *pColor_ret)
/* /*
* DESCRIPTION * DESCRIPTION
* Returns the color specification in the target format for * Returns the color specification in the target format for
......
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
*/ */
Status Status
XcmsQueryWhite(ccc, target_format, pColor_ret) XcmsQueryWhite(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColorFormat target_format; XcmsColorFormat target_format,
XcmsColor *pColor_ret; XcmsColor *pColor_ret)
/* /*
* DESCRIPTION * DESCRIPTION
* Returns the color specification in the target format for * Returns the color specification in the target format for
......
...@@ -53,11 +53,11 @@ ...@@ -53,11 +53,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsQueryColor(dpy, colormap, pXcmsColor_in_out, result_format) XcmsQueryColor(
Display *dpy; Display *dpy,
Colormap colormap; Colormap colormap,
XcmsColor *pXcmsColor_in_out; XcmsColor *pXcmsColor_in_out,
XcmsColorFormat result_format; XcmsColorFormat result_format)
/* /*
* DESCRIPTION * DESCRIPTION
* This routine uses XQueryColor to obtain the X RGB values * This routine uses XQueryColor to obtain the X RGB values
......
...@@ -52,12 +52,12 @@ ...@@ -52,12 +52,12 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsQueryColors(dpy, colormap, pXcmsColors_in_out, nColors, result_format) XcmsQueryColors(
Display *dpy; Display *dpy,
Colormap colormap; Colormap colormap,
XcmsColor *pXcmsColors_in_out; XcmsColor *pXcmsColors_in_out,
unsigned int nColors; unsigned int nColors,
XcmsColorFormat result_format; XcmsColorFormat result_format)
/* /*
* DESCRIPTION * DESCRIPTION
* This routine uses XQueryColors to obtain the X RGB values * This routine uses XQueryColors to obtain the X RGB values
......
...@@ -55,9 +55,9 @@ ...@@ -55,9 +55,9 @@
*/ */
Status Status
XcmsSetWhitePoint(ccc, pColor) XcmsSetWhitePoint(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pColor; XcmsColor *pColor)
/* /*
* DESCRIPTION * DESCRIPTION
* Sets the Client White Point in the specified CCC. * Sets the Client White Point in the specified CCC.
......
...@@ -53,10 +53,10 @@ ...@@ -53,10 +53,10 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsStoreColor(dpy, colormap, pColor_in) XcmsStoreColor(
Display *dpy; Display *dpy,
Colormap colormap; Colormap colormap,
XcmsColor *pColor_in; XcmsColor *pColor_in)
/* /*
* DESCRIPTION * DESCRIPTION
* Given a device-dependent or device-independent color * Given a device-dependent or device-independent color
......
...@@ -53,13 +53,12 @@ ...@@ -53,13 +53,12 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsStoreColors(dpy, colormap, pColors_in, XcmsStoreColors(
nColors, pCompressed) Display *dpy,
Display *dpy; Colormap colormap,
Colormap colormap; XcmsColor *pColors_in,
XcmsColor *pColors_in; unsigned int nColors,
unsigned int nColors; Bool *pCompressed)
Bool *pCompressed;
/* /*
* DESCRIPTION * DESCRIPTION
* Given device-dependent or device-independent color * Given device-dependent or device-independent color
......
...@@ -142,6 +142,23 @@ CIEXYZ_ParseString( ...@@ -142,6 +142,23 @@ CIEXYZ_ParseString(
&pColor->spec.CIEXYZ.X, &pColor->spec.CIEXYZ.X,
&pColor->spec.CIEXYZ.Y, &pColor->spec.CIEXYZ.Y,
&pColor->spec.CIEXYZ.Z) != 3) { &pColor->spec.CIEXYZ.Z) != 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.CIEXYZ.X,
&pColor->spec.CIEXYZ.Y,
&pColor->spec.CIEXYZ.Z) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure); return(XcmsFailure);
} }
pColor->format = XcmsCIEXYZFormat; pColor->format = XcmsCIEXYZFormat;
......
...@@ -47,11 +47,11 @@ ...@@ -47,11 +47,11 @@
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsAllocColor(dpy, colormap, pXcmsColor_in_out, result_format) XcmsAllocColor(
Display *dpy; Display *dpy,
Colormap colormap; Colormap colormap,
XcmsColor *pXcmsColor_in_out; XcmsColor *pXcmsColor_in_out,
XcmsColorFormat result_format; XcmsColorFormat result_format)
/* /*
* DESCRIPTION * DESCRIPTION
* Given a device-dependent or device-independent color * Given a device-dependent or device-independent color
......
...@@ -142,7 +142,7 @@ CmapRecForColormap( ...@@ -142,7 +142,7 @@ CmapRecForColormap(
visualTemplate.screen = i; visualTemplate.screen = i;
visualList = XGetVisualInfo(dpy, VisualScreenMask, &visualTemplate, visualList = XGetVisualInfo(dpy, VisualScreenMask, &visualTemplate,
&nVisualsMatched); &nVisualsMatched);
if (nVisualsMatched == 0) { if (visualList == NULL) {
continue; continue;
} }
...@@ -232,11 +232,11 @@ CmapRecForColormap( ...@@ -232,11 +232,11 @@ CmapRecForColormap(
* SYNOPSIS * SYNOPSIS
*/ */
XcmsCmapRec * XcmsCmapRec *
_XcmsAddCmapRec(dpy, cmap, windowID, visual) _XcmsAddCmapRec(
Display *dpy; Display *dpy,
Colormap cmap; Colormap cmap,
Window windowID; Window windowID,
Visual *visual; Visual *visual)
/* /*
* DESCRIPTION * DESCRIPTION
* Create an XcmsCmapRec for the specified cmap, windowID, * Create an XcmsCmapRec for the specified cmap, windowID,
...@@ -408,9 +408,9 @@ _XcmsFreeClientCmaps( ...@@ -408,9 +408,9 @@ _XcmsFreeClientCmaps(
* SYNOPSIS * SYNOPSIS
*/ */
XcmsCCC XcmsCCC
XcmsCCCOfColormap(dpy, cmap) XcmsCCCOfColormap(
Display *dpy; Display *dpy,
Colormap cmap; Colormap cmap)
/* /*
* DESCRIPTION * DESCRIPTION
* Finds the XcmsCCC associated with the specified colormap. * Finds the XcmsCCC associated with the specified colormap.
...@@ -476,10 +476,10 @@ XcmsCCCOfColormap(dpy, cmap) ...@@ -476,10 +476,10 @@ XcmsCCCOfColormap(dpy, cmap)
return(NULL); return(NULL);
} }
XcmsCCC XcmsSetCCCOfColormap(dpy, cmap, ccc) XcmsCCC XcmsSetCCCOfColormap(
Display *dpy; Display *dpy,
Colormap cmap; Colormap cmap,
XcmsCCC ccc; XcmsCCC ccc)
{ {
XcmsCCC prev_ccc = NULL; XcmsCCC prev_ccc = NULL;
XcmsCmapRec *pRec; XcmsCmapRec *pRec;
......
...@@ -706,7 +706,7 @@ LoadColornameDB(void) ...@@ -706,7 +706,7 @@ LoadColornameDB(void)
{ {
int size; int size;
FILE *stream; FILE *stream;
char *pathname; const char *pathname;
struct stat txt; struct stat txt;
int length; int length;
...@@ -732,10 +732,17 @@ LoadColornameDB(void) ...@@ -732,10 +732,17 @@ LoadColornameDB(void)
} }
if ((stream = _XFopenFile (pathname, "r")) == NULL) { if ((stream = _XFopenFile (pathname, "r")) == NULL) {
/* can't open file */
XcmsColorDbState = XcmsDbInitFailure;
return(XcmsFailure); return(XcmsFailure);
} }
stringSectionSize(stream, &nEntries, &size); if (stringSectionSize(stream, &nEntries, &size) != XcmsSuccess ||
nEntries == 0) {
(void) fclose(stream);
XcmsColorDbState = XcmsDbInitFailure;
return(XcmsFailure);
}
rewind(stream); rewind(stream);
strings = (char *) Xmalloc(size); strings = (char *) Xmalloc(size);
......
...@@ -51,8 +51,7 @@ int sqrt_loopcount; ...@@ -51,8 +51,7 @@ int sqrt_loopcount;
/* for cube roots, x^3 - a = 0, x_new = x - 1/3 (x - a/x^2) */ /* for cube roots, x^3 - a = 0, x_new = x - 1/3 (x - a/x^2) */
double double
_XcmsCubeRoot(a) _XcmsCubeRoot(double a)
double a;
{ {
register double abs_a, cur_guess, delta; register double abs_a, cur_guess, delta;
...@@ -96,8 +95,7 @@ _XcmsCubeRoot(a) ...@@ -96,8 +95,7 @@ _XcmsCubeRoot(a)
/* for square roots, x^2 - a = 0, x_new = x - 1/2 (x - a/x) */ /* for square roots, x^2 - a = 0, x_new = x - 1/2 (x - a/x) */
double double
_XcmsSquareRoot(a) _XcmsSquareRoot(double a)
double a;
{ {
register double cur_guess, delta; register double cur_guess, delta;
......
...@@ -503,8 +503,7 @@ static double _XcmsPolynomial( ...@@ -503,8 +503,7 @@ static double _XcmsPolynomial(
*/ */
double double
_XcmsSine (x) _XcmsSine (double x)
double x;
{ {
double y; double y;
double yt2; double yt2;
...@@ -544,8 +543,7 @@ double x; ...@@ -544,8 +543,7 @@ double x;
* SYNOPSIS * SYNOPSIS
*/ */
double double
_XcmsArcTangent(x) _XcmsArcTangent(double x)
double x;
/* /*
* DESCRIPTION * DESCRIPTION
* Computes the arctangent. * Computes the arctangent.
......
...@@ -157,6 +157,23 @@ CIEuvY_ParseString( ...@@ -157,6 +157,23 @@ CIEuvY_ParseString(
&pColor->spec.CIEuvY.u_prime, &pColor->spec.CIEuvY.u_prime,
&pColor->spec.CIEuvY.v_prime, &pColor->spec.CIEuvY.v_prime,
&pColor->spec.CIEuvY.Y) != 3) { &pColor->spec.CIEuvY.Y) != 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.CIEuvY.u_prime,
&pColor->spec.CIEuvY.v_prime,
&pColor->spec.CIEuvY.Y) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure); return(XcmsFailure);
} }
pColor->format = XcmsCIEuvYFormat; pColor->format = XcmsCIEuvYFormat;
...@@ -208,11 +225,11 @@ _XcmsCIEuvY_ValidSpec( ...@@ -208,11 +225,11 @@ _XcmsCIEuvY_ValidSpec(
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIEuvYToCIEXYZ(ccc, puvY_WhitePt, pColors_in_out, nColors) XcmsCIEuvYToCIEXYZ(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *puvY_WhitePt; XcmsColor *puvY_WhitePt,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors)
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
...@@ -323,11 +340,11 @@ XcmsCIEuvYToCIEXYZ(ccc, puvY_WhitePt, pColors_in_out, nColors) ...@@ -323,11 +340,11 @@ XcmsCIEuvYToCIEXYZ(ccc, puvY_WhitePt, pColors_in_out, nColors)
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIEXYZToCIEuvY(ccc, puvY_WhitePt, pColors_in_out, nColors) XcmsCIEXYZToCIEuvY(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *puvY_WhitePt; XcmsColor *puvY_WhitePt,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors)
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
......
...@@ -156,6 +156,23 @@ CIExyY_ParseString( ...@@ -156,6 +156,23 @@ CIExyY_ParseString(
&pColor->spec.CIExyY.x, &pColor->spec.CIExyY.x,
&pColor->spec.CIExyY.y, &pColor->spec.CIExyY.y,
&pColor->spec.CIExyY.Y) != 3) { &pColor->spec.CIExyY.Y) != 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.CIExyY.x,
&pColor->spec.CIExyY.y,
&pColor->spec.CIExyY.Y) != 3) {
free(s);
return(XcmsFailure);
}
free(s);
} else
return(XcmsFailure); return(XcmsFailure);
} }
pColor->format = XcmsCIExyYFormat; pColor->format = XcmsCIExyYFormat;
...@@ -216,11 +233,11 @@ XcmsCIExyY_ValidSpec( ...@@ -216,11 +233,11 @@ XcmsCIExyY_ValidSpec(
* SYNOPSIS * SYNOPSIS
*/ */
Status Status
XcmsCIExyYToCIEXYZ(ccc, pxyY_WhitePt, pColors_in_out, nColors) XcmsCIExyYToCIEXYZ(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pxyY_WhitePt; XcmsColor *pxyY_WhitePt,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors)
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
...@@ -323,11 +340,11 @@ XcmsCIExyYToCIEXYZ(ccc, pxyY_WhitePt, pColors_in_out, nColors) ...@@ -323,11 +340,11 @@ XcmsCIExyYToCIEXYZ(ccc, pxyY_WhitePt, pColors_in_out, nColors)
*/ */
/* ARGSUSED */ /* ARGSUSED */
Status Status
XcmsCIEXYZToCIExyY(ccc, pxyY_WhitePt, pColors_in_out, nColors) XcmsCIEXYZToCIExyY(
XcmsCCC ccc; XcmsCCC ccc,
XcmsColor *pxyY_WhitePt; XcmsColor *pxyY_WhitePt,
XcmsColor *pColors_in_out; XcmsColor *pColors_in_out,
unsigned int nColors; unsigned int nColors)
/* /*
* DESCRIPTION * DESCRIPTION
* Converts color specifications in an array of XcmsColor * Converts color specifications in an array of XcmsColor
......
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