~ubuntu-branches/ubuntu/lucid/libx11/lucid

« back to all changes in this revision

Viewing changes to src/xcms/LuvMxL.c

  • Committer: Bazaar Package Importer
  • Author(s): Timo Aaltonen
  • Date: 2009-01-17 16:34:54 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090117163454-gaey3cd32xyavueo
Tags: 2:1.1.99.2-1build1
Fakesync with Debian, all previous Ubuntu changes are included
in the new upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
/*
4
4
 * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
5
5
 *      All Rights Reserved
6
 
 * 
 
6
 *
7
7
 * This file is a component of an X Window System-specific implementation
8
8
 * of XCMS based on the TekColor Color Management System.  Permission is
9
9
 * hereby granted to use, copy, modify, sell, and otherwise distribute this
11
11
 * that this copyright, permission, and disclaimer notice is reproduced in
12
12
 * all copies of this software and in supporting documentation.  TekColor
13
13
 * is a trademark of Tektronix, Inc.
14
 
 * 
 
14
 *
15
15
 * Tektronix makes no representation about the suitability of this software
16
16
 * for any purpose.  It is provided "as is" and with all faults.
17
 
 * 
 
17
 *
18
18
 * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
19
19
 * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20
20
 * PARTICULAR PURPOSE.  IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
108
108
    }
109
109
    while (hue_angle >= 360.0) {
110
110
        hue_angle -= 360.0;
111
 
    } 
 
111
    }
112
112
 
113
113
    hue = radians(hue_angle);
114
114
    tmp.spec.CIELuv.L_star = START_L_STAR;
116
116
    tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, chroma);
117
117
    tmp.pixel = pColor_return->pixel;
118
118
    tmp.format = XcmsCIELuvFormat;
119
 
    
 
119
 
120
120
    /* Step 1: Obtain the maximum L_star and chroma for this hue. */
121
121
    if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved)
122
122
            == XcmsFailure) {
128
128
 
129
129
    if (max_chroma <= chroma) {
130
130
        /*
131
 
         *  If the chroma is greater than the chroma for the 
 
131
         *  If the chroma is greater than the chroma for the
132
132
         *  maximum L/chroma point then the L_star is the
133
133
         *  the L_star for the maximum L_star/chroma point.
134
134
         *  This is an error but I return the best approximation I can.
139
139
    }
140
140
 
141
141
    /*
142
 
     *  If the chroma is equal to the chroma for the 
 
142
     *  If the chroma is equal to the chroma for the
143
143
     *  maximum L_star/chroma point then the L_star is the
144
144
     *  the L_star for the maximum L* and chroma point.
145
145
     */
182
182
            /* Found It! */
183
183
            memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor));
184
184
            return(XcmsSuccess);
185
 
        } 
 
185
        }
186
186
        nChroma += chroma - tmp_chroma;
187
187
        if (nChroma > max_chroma) {
188
188
            nChroma = max_chroma;
189
189
            rFactor *= 0.5;  /* selective relaxation employed */
190
190
        } else if (nChroma < 0.0) {
191
 
            if (XCMS_FABS(lastChroma - chroma) < 
 
191
            if (XCMS_FABS(lastChroma - chroma) <
192
192
                XCMS_FABS(tmp_chroma - chroma)) {
193
193
                memcpy ((char *)pColor_return, (char *)&prev,
194
194
                        sizeof(XcmsColor));
204
204
    }
205
205
 
206
206
    if (nCount >= nMaxCount) {
207
 
        if (XCMS_FABS(lastChroma - chroma) < 
 
207
        if (XCMS_FABS(lastChroma - chroma) <
208
208
            XCMS_FABS(tmp_chroma - chroma)) {
209
209
                memcpy ((char *)pColor_return, (char *)&prev,
210
210
                        sizeof(XcmsColor));