aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/X11/Luv.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/X11/Luv.c')
-rw-r--r--nx-X11/lib/X11/Luv.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/nx-X11/lib/X11/Luv.c b/nx-X11/lib/X11/Luv.c
index ee62ff32a..8af5ee98b 100644
--- a/nx-X11/lib/X11/Luv.c
+++ b/nx-X11/lib/X11/Luv.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. 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)