Source Code Cross Referenced for ColorSpace.java in  » Apache-Harmony-Java-SE » java-package » java » awt » color » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » java package » java.awt.color 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:        /**
018:         * @author Oleg V. Khaschansky
019:         * @version $Revision$
020:         */package java.awt.color;
021:
022:        import java.io.Serializable;
023:
024:        import org.apache.harmony.awt.gl.color.LUTColorConverter;
025:        import org.apache.harmony.awt.internal.nls.Messages;
026:
027:        public abstract class ColorSpace implements  Serializable {
028:
029:            private static final long serialVersionUID = -409452704308689724L;
030:
031:            public static final int TYPE_XYZ = 0;
032:
033:            public static final int TYPE_Lab = 1;
034:
035:            public static final int TYPE_Luv = 2;
036:
037:            public static final int TYPE_YCbCr = 3;
038:
039:            public static final int TYPE_Yxy = 4;
040:
041:            public static final int TYPE_RGB = 5;
042:
043:            public static final int TYPE_GRAY = 6;
044:
045:            public static final int TYPE_HSV = 7;
046:
047:            public static final int TYPE_HLS = 8;
048:
049:            public static final int TYPE_CMYK = 9;
050:
051:            public static final int TYPE_CMY = 11;
052:
053:            public static final int TYPE_2CLR = 12;
054:
055:            public static final int TYPE_3CLR = 13;
056:
057:            public static final int TYPE_4CLR = 14;
058:
059:            public static final int TYPE_5CLR = 15;
060:
061:            public static final int TYPE_6CLR = 16;
062:
063:            public static final int TYPE_7CLR = 17;
064:
065:            public static final int TYPE_8CLR = 18;
066:
067:            public static final int TYPE_9CLR = 19;
068:
069:            public static final int TYPE_ACLR = 20;
070:
071:            public static final int TYPE_BCLR = 21;
072:
073:            public static final int TYPE_CCLR = 22;
074:
075:            public static final int TYPE_DCLR = 23;
076:
077:            public static final int TYPE_ECLR = 24;
078:
079:            public static final int TYPE_FCLR = 25;
080:
081:            public static final int CS_sRGB = 1000;
082:
083:            public static final int CS_LINEAR_RGB = 1004;
084:
085:            public static final int CS_CIEXYZ = 1001;
086:
087:            public static final int CS_PYCC = 1002;
088:
089:            public static final int CS_GRAY = 1003;
090:
091:            private static ColorSpace cs_Gray = null;
092:            private static ColorSpace cs_PYCC = null;
093:            private static ColorSpace cs_CIEXYZ = null;
094:            private static ColorSpace cs_LRGB = null;
095:            private static ColorSpace cs_sRGB = null;
096:
097:            private int type;
098:            private int numComponents;
099:
100:            protected ColorSpace(int type, int numcomponents) {
101:                this .numComponents = numcomponents;
102:                this .type = type;
103:            }
104:
105:            public String getName(int idx) {
106:                if (idx < 0 || idx > numComponents - 1) {
107:                    // awt.16A=Invalid component index: {0}
108:                    throw new IllegalArgumentException(Messages.getString(
109:                            "awt.16A", idx)); //$NON-NLS-1$
110:                }
111:
112:                return "Unnamed color component #" + idx; //$NON-NLS-1$
113:            }
114:
115:            public abstract float[] toRGB(float[] colorvalue);
116:
117:            public abstract float[] toCIEXYZ(float[] colorvalue);
118:
119:            public abstract float[] fromRGB(float[] rgbvalue);
120:
121:            public abstract float[] fromCIEXYZ(float[] colorvalue);
122:
123:            public float getMinValue(int component) {
124:                if (component < 0 || component > numComponents - 1) {
125:                    // awt.16A=Invalid component index: {0}
126:                    throw new IllegalArgumentException(Messages.getString(
127:                            "awt.16A", component)); //$NON-NLS-1$
128:                }
129:                return 0;
130:            }
131:
132:            public float getMaxValue(int component) {
133:                if (component < 0 || component > numComponents - 1) {
134:                    // awt.16A=Invalid component index: {0}
135:                    throw new IllegalArgumentException(Messages.getString(
136:                            "awt.16A", component)); //$NON-NLS-1$
137:                }
138:                return 1;
139:            }
140:
141:            public boolean isCS_sRGB() {
142:                // If our color space is sRGB, then cs_sRGB
143:                // is already initialized
144:                return (this  == cs_sRGB);
145:            }
146:
147:            public int getType() {
148:                return type;
149:            }
150:
151:            public int getNumComponents() {
152:                return numComponents;
153:            }
154:
155:            public static ColorSpace getInstance(int colorspace) {
156:                switch (colorspace) {
157:                case CS_sRGB:
158:                    if (cs_sRGB == null) {
159:                        cs_sRGB = new ICC_ColorSpace(new ICC_ProfileStub(
160:                                CS_sRGB));
161:                        LUTColorConverter.sRGB_CS = cs_sRGB;
162:                        //ICC_Profile.getInstance (CS_sRGB));
163:                    }
164:                    return cs_sRGB;
165:                case CS_CIEXYZ:
166:                    if (cs_CIEXYZ == null) {
167:                        cs_CIEXYZ = new ICC_ColorSpace(new ICC_ProfileStub(
168:                                CS_CIEXYZ));
169:                        //ICC_Profile.getInstance (CS_CIEXYZ));
170:                    }
171:                    return cs_CIEXYZ;
172:                case CS_GRAY:
173:                    if (cs_Gray == null) {
174:                        cs_Gray = new ICC_ColorSpace(new ICC_ProfileStub(
175:                                CS_GRAY));
176:                        LUTColorConverter.LINEAR_GRAY_CS = cs_Gray;
177:                        //ICC_Profile.getInstance (CS_GRAY));
178:                    }
179:                    return cs_Gray;
180:                case CS_PYCC:
181:                    if (cs_PYCC == null) {
182:                        cs_PYCC = new ICC_ColorSpace(new ICC_ProfileStub(
183:                                CS_PYCC));
184:                        //ICC_Profile.getInstance (CS_PYCC));
185:                    }
186:                    return cs_PYCC;
187:                case CS_LINEAR_RGB:
188:                    if (cs_LRGB == null) {
189:                        cs_LRGB = new ICC_ColorSpace(new ICC_ProfileStub(
190:                                CS_LINEAR_RGB));
191:                        LUTColorConverter.LINEAR_GRAY_CS = cs_Gray;
192:                        //ICC_Profile.getInstance (CS_LINEAR_RGB));
193:                    }
194:                    return cs_LRGB;
195:                default:
196:                }
197:
198:                // Unknown argument passed
199:                // awt.16B=Not a predefined colorspace
200:                throw new IllegalArgumentException(Messages
201:                        .getString("awt.16B")); //$NON-NLS-1$
202:            }
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.