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.IOException;
023: import java.io.InputStream;
024: import java.io.ObjectStreamException;
025: import java.io.OutputStream;
026:
027: import org.apache.harmony.awt.internal.nls.Messages;
028:
029: final class ICC_ProfileStub extends ICC_Profile {
030: private static final long serialVersionUID = 501389760875253507L;
031:
032: transient int colorspace;
033:
034: public ICC_ProfileStub(int csSpecifier) {
035: switch (csSpecifier) {
036: case ColorSpace.CS_sRGB:
037: case ColorSpace.CS_CIEXYZ:
038: case ColorSpace.CS_LINEAR_RGB:
039: case ColorSpace.CS_PYCC:
040: case ColorSpace.CS_GRAY:
041: break;
042: default:
043: // awt.15D=Invalid colorspace
044: throw new IllegalArgumentException(Messages
045: .getString("awt.15D")); //$NON-NLS-1$
046: }
047: colorspace = csSpecifier;
048: }
049:
050: @Override
051: public void write(String fileName) throws IOException {
052: throw new UnsupportedOperationException(
053: "Stub cannot perform this operation"); //$NON-NLS-1$
054: }
055:
056: /**
057: * Serializable implementation
058: *
059: * @throws ObjectStreamException
060: */
061: private Object writeReplace() throws ObjectStreamException {
062: return loadProfile();
063: }
064:
065: @Override
066: public void write(OutputStream s) throws IOException {
067: throw new UnsupportedOperationException(
068: "Stub cannot perform this operation"); //$NON-NLS-1$
069: }
070:
071: @Override
072: public void setData(int tagSignature, byte[] tagData) {
073: throw new UnsupportedOperationException(
074: "Stub cannot perform this operation"); //$NON-NLS-1$
075: }
076:
077: @Override
078: public byte[] getData(int tagSignature) {
079: throw new UnsupportedOperationException(
080: "Stub cannot perform this operation"); //$NON-NLS-1$
081: }
082:
083: @Override
084: public byte[] getData() {
085: throw new UnsupportedOperationException(
086: "Stub cannot perform this operation"); //$NON-NLS-1$
087: }
088:
089: @Override
090: protected void finalize() {
091: }
092:
093: @Override
094: public int getProfileClass() {
095: return CLASS_COLORSPACECONVERSION;
096: }
097:
098: @Override
099: public int getPCSType() {
100: throw new UnsupportedOperationException(
101: "Stub cannot perform this operation"); //$NON-NLS-1$
102: }
103:
104: @Override
105: public int getNumComponents() {
106: switch (colorspace) {
107: case ColorSpace.CS_sRGB:
108: case ColorSpace.CS_CIEXYZ:
109: case ColorSpace.CS_LINEAR_RGB:
110: case ColorSpace.CS_PYCC:
111: return 3;
112: case ColorSpace.CS_GRAY:
113: return 1;
114: default:
115: throw new UnsupportedOperationException(
116: "Stub cannot perform this operation"); //$NON-NLS-1$
117: }
118: }
119:
120: @Override
121: public int getMinorVersion() {
122: throw new UnsupportedOperationException(
123: "Stub cannot perform this operation"); //$NON-NLS-1$
124: }
125:
126: @Override
127: public int getMajorVersion() {
128: throw new UnsupportedOperationException(
129: "Stub cannot perform this operation"); //$NON-NLS-1$
130: }
131:
132: @Override
133: public int getColorSpaceType() {
134: switch (colorspace) {
135: case ColorSpace.CS_sRGB:
136: case ColorSpace.CS_LINEAR_RGB:
137: return ColorSpace.TYPE_RGB;
138: case ColorSpace.CS_CIEXYZ:
139: return ColorSpace.TYPE_XYZ;
140: case ColorSpace.CS_PYCC:
141: return ColorSpace.TYPE_3CLR;
142: case ColorSpace.CS_GRAY:
143: return ColorSpace.TYPE_GRAY;
144: default:
145: throw new UnsupportedOperationException(
146: "Stub cannot perform this operation"); //$NON-NLS-1$
147: }
148: }
149:
150: public static ICC_Profile getInstance(String fileName)
151: throws IOException {
152: throw new UnsupportedOperationException(
153: "Stub cannot perform this operation"); //$NON-NLS-1$
154: }
155:
156: public static ICC_Profile getInstance(InputStream s)
157: throws IOException {
158: throw new UnsupportedOperationException(
159: "Stub cannot perform this operation"); //$NON-NLS-1$
160: }
161:
162: public static ICC_Profile getInstance(byte[] data) {
163: throw new UnsupportedOperationException(
164: "Stub cannot perform this operation"); //$NON-NLS-1$
165: }
166:
167: public static ICC_Profile getInstance(int cspace) {
168: throw new UnsupportedOperationException(
169: "Stub cannot perform this operation"); //$NON-NLS-1$
170: }
171:
172: public ICC_Profile loadProfile() {
173: switch (colorspace) {
174: case ColorSpace.CS_sRGB:
175: return ICC_Profile.getInstance(ColorSpace.CS_sRGB);
176: case ColorSpace.CS_GRAY:
177: return ICC_Profile.getInstance(ColorSpace.CS_GRAY);
178: case ColorSpace.CS_CIEXYZ:
179: return ICC_Profile.getInstance(ColorSpace.CS_CIEXYZ);
180: case ColorSpace.CS_LINEAR_RGB:
181: return ICC_Profile.getInstance(ColorSpace.CS_LINEAR_RGB);
182: case ColorSpace.CS_PYCC:
183: return ICC_Profile.getInstance(ColorSpace.CS_PYCC);
184: default:
185: throw new UnsupportedOperationException(
186: "Stub cannot perform this operation"); //$NON-NLS-1$
187: }
188: }
189: }
|