KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > color > ICC_ProfileGray


1 /*
2  * @(#)ICC_ProfileGray.java 1.21 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 /**********************************************************************
9  **********************************************************************
10  **********************************************************************
11  *** COPYRIGHT (c) Eastman Kodak Company, 1997 ***
12  *** As an unpublished work pursuant to Title 17 of the United ***
13  *** States Code. All rights reserved. ***
14  **********************************************************************
15  **********************************************************************
16  **********************************************************************/

17
18 package java.awt.color;
19
20 import java.awt.image.LookupTable JavaDoc;
21 import sun.awt.color.ProfileDeferralInfo;
22
23 /**
24  *
25  * A subclass of the ICC_Profile class which represents profiles
26  * which meet the following criteria: the color space type of the
27  * profile is TYPE_GRAY and the profile includes the grayTRCTag and
28  * mediaWhitePointTag tags. Examples of this kind of profile are
29  * monochrome input profiles, monochrome display profiles, and
30  * monochrome output profiles. The getInstance methods in the
31  * ICC_Profile class will
32  * return an ICC_ProfileGray object when the above conditions are
33  * met. The advantage of this class is that it provides a lookup
34  * table that Java or native methods may be able to use directly to
35  * optimize color conversion in some cases.
36  * <p>
37  * To transform from a GRAY device profile color space to the CIEXYZ Profile
38  * Connection Space, the device gray component is transformed by
39  * a lookup through the tone reproduction curve (TRC). The result is
40  * treated as the achromatic component of the PCS.
41 <pre>
42
43 &nbsp; PCSY = grayTRC[deviceGray]
44
45 </pre>
46  * The inverse transform is done by converting the PCS Y components to
47  * device Gray via the inverse of the grayTRC.
48  * <p>
49  */

50
51
52
53 public class ICC_ProfileGray
54 extends ICC_Profile JavaDoc {
55
56     /**
57      * Constructs a new ICC_ProfileGray from a CMM ID.
58      */

59     ICC_ProfileGray(long ID) {
60         super(ID);
61     }
62
63     /**
64      * Constructs a new ICC_ProfileGray from a ProfileDeferralInfo object.
65      */

66     ICC_ProfileGray(ProfileDeferralInfo pdi) {
67         super(pdi);
68     }
69
70
71     /**
72      * Returns a float array of length 3 containing the X, Y, and Z
73      * components of the mediaWhitePointTag in the ICC profile.
74      * @return an array containing the components of the
75      * mediaWhitePointTag in the ICC profile.
76      */

77     public float[] getMediaWhitePoint() {
78         return super.getMediaWhitePoint();
79     }
80
81
82     /**
83      * Returns a gamma value representing the tone reproduction
84      * curve (TRC). If the profile represents the TRC as a table rather
85      * than a single gamma value, then an exception is thrown. In this
86      * case the actual table can be obtained via getTRC(). When
87      * using a gamma value, the PCS Y component is computed as follows:
88 <pre>
89
90 &nbsp; gamma
91 &nbsp; PCSY = deviceGray
92
93 </pre>
94      * @return the gamma value as a float.
95      * @exception ProfileDataException if the profile does not specify
96      * the TRC as a single gamma value.
97      */

98     public float getGamma() {
99     float theGamma;
100
101         theGamma = super.getGamma(ICC_Profile.icSigGrayTRCTag);
102         return theGamma;
103     }
104
105     /**
106      * Returns the TRC as an array of shorts. If the profile has
107      * specified the TRC as linear (gamma = 1.0) or as a simple gamma
108      * value, this method throws an exception, and the getGamma() method
109      * should be used to get the gamma value. Otherwise the short array
110      * returned here represents a lookup table where the input Gray value
111      * is conceptually in the range [0.0, 1.0]. Value 0.0 maps
112      * to array index 0 and value 1.0 maps to array index length-1.
113      * Interpolation may be used to generate output values for
114      * input values which do not map exactly to an index in the
115      * array. Output values also map linearly to the range [0.0, 1.0].
116      * Value 0.0 is represented by an array value of 0x0000 and
117      * value 1.0 by 0xFFFF, i.e. the values are really unsigned
118      * short values, although they are returned in a short array.
119      * @return a short array representing the TRC.
120      * @exception ProfileDataException if the profile does not specify
121      * the TRC as a table.
122      */

123     public short[] getTRC() {
124     short[] theTRC;
125
126         theTRC = super.getTRC(ICC_Profile.icSigGrayTRCTag);
127         return theTRC;
128     }
129
130 }
131
132
Popular Tags