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

« back to all changes in this revision

Viewing changes to src/xcms/HVC.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:
4
4
/*
5
5
 * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc.
6
6
 *      All Rights Reserved
7
 
 * 
 
7
 *
8
8
 * This file is a component of an X Window System-specific implementation
9
9
 * of Xcms based on the TekColor Color Management System.  TekColor is a
10
10
 * trademark of Tektronix, Inc.  The term "TekHVC" designates a particular
12
12
 * foreign patents pending).  Permission is hereby granted to use, copy,
13
13
 * modify, sell, and otherwise distribute this software and its
14
14
 * documentation for any purpose and without fee, provided that:
15
 
 * 
 
15
 *
16
16
 * 1. This copyright, permission, and disclaimer notice is reproduced in
17
17
 *    all copies of this software and any modification thereof and in
18
 
 *    supporting documentation; 
 
18
 *    supporting documentation;
19
19
 * 2. Any color-handling application which displays TekHVC color
20
20
 *    cooordinates identifies these as TekHVC color coordinates in any
21
21
 *    interface that displays these coordinates and in any associated
25
25
 *    including those provided in this file and any equivalent pathways and
26
26
 *    mathematical derivations, regardless of digital (e.g., floating point
27
27
 *    or integer) representation.
28
 
 * 
 
28
 *
29
29
 * Tektronix makes no representation about the suitability of this software
30
30
 * for any purpose.  It is provided "as is" and with all faults.
31
 
 * 
 
31
 *
32
32
 * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE,
33
33
 * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
34
34
 * PARTICULAR PURPOSE.  IN NO EVENT SHALL TEKTRONIX BE LIABLE FOR ANY
85
85
/*************************************************************************
86
86
 * Note: The DBL_EPSILON for ANSI is 1e-5 so my checks need to take
87
87
 *       this into account.  If your DBL_EPSILON is different then
88
 
 *       adjust this define. 
 
88
 *       adjust this define.
89
89
 *
90
90
 *       Also note that EPS is the error factor in the calculations
91
91
 *       This may need to be the same as XMY_DBL_EPSILON in
319
319
    }
320
320
    while (pColor->spec.TekHVC.H >= 360.0) {
321
321
        pColor->spec.TekHVC.H -= 360.0;
322
 
    } 
 
322
    }
323
323
    return(XcmsSuccess);
324
324
}
325
325
 
416
416
            tempHue = radians(tempHue);
417
417
 
418
418
            /* Calculate u'v' for the obtained hue */
419
 
            u = (XcmsFloat) ((XCMS_COS(tempHue) * pColor->spec.TekHVC.C) / 
 
419
            u = (XcmsFloat) ((XCMS_COS(tempHue) * pColor->spec.TekHVC.C) /
420
420
                    (pColor->spec.TekHVC.V * (double)CHROMA_SCALE_FACTOR));
421
 
            v = (XcmsFloat) ((XCMS_SIN(tempHue) * pColor->spec.TekHVC.C) / 
 
421
            v = (XcmsFloat) ((XCMS_SIN(tempHue) * pColor->spec.TekHVC.C) /
422
422
                    (pColor->spec.TekHVC.V * (double)CHROMA_SCALE_FACTOR));
423
423
 
424
424
            /* Based on the white point get the offset from best red */
623
623
    } else if (pColor->spec.TekHVC.H >= 360.0) {
624
624
        n = pColor->spec.TekHVC.H / 360.0;
625
625
        pColor->spec.TekHVC.H -= n * 360.0;
626
 
    } 
 
626
    }
627
627
    return(1);
628
628
}