01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17:
18: /* $Id: CMYKColorSpace.java 563951 2007-08-08 17:37:33Z vhennebert $ */
19:
20: package org.apache.fop.util;
21:
22: import java.awt.color.ColorSpace;
23:
24: /**
25: * This class represents an uncalibrated CMYK color space. It is used by
26: * the JpegImage class.
27: */
28: public class CMYKColorSpace extends ColorSpace {
29:
30: private static CMYKColorSpace instance;
31:
32: /**
33: * @see java.awt.color.ColorSpace#ColorSpace(int, int)
34: */
35: protected CMYKColorSpace(int type, int numcomponents) {
36: super (type, numcomponents);
37: }
38:
39: /**
40: * Returns an instance of an uncalibrated CMYK color space.
41: * @return CMYKColorSpace the requested color space object
42: */
43: public static CMYKColorSpace getInstance() {
44: if (instance == null) {
45: instance = new CMYKColorSpace(TYPE_CMYK, 4);
46: }
47: return instance;
48: }
49:
50: /**
51: * {@inheritDoc}
52: */
53: public float[] toRGB(float[] colorvalue) {
54: return new float[] { (1 - colorvalue[0]) * (1 - colorvalue[3]),
55: (1 - colorvalue[1]) * (1 - colorvalue[3]),
56: (1 - colorvalue[2]) * (1 - colorvalue[3]) };
57: }
58:
59: /**
60: * {@inheritDoc}
61: */
62: public float[] fromRGB(float[] rgbvalue) {
63: throw new UnsupportedOperationException("NYI");
64: }
65:
66: /**
67: * {@inheritDoc}
68: */
69: public float[] toCIEXYZ(float[] colorvalue) {
70: throw new UnsupportedOperationException("NYI");
71: }
72:
73: /**
74: * {@inheritDoc}
75: */
76: public float[] fromCIEXYZ(float[] colorvalue) {
77: throw new UnsupportedOperationException("NYI");
78: }
79:
80: }
|