KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > util > CMYKColorSpace


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * 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 474225 2006-11-13 10:08:19Z jeremias $ */
19  
20 package org.apache.fop.util;
21
22 import java.awt.color.ColorSpace JavaDoc;
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 JavaDoc {
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      * @see java.awt.color.ColorSpace#toRGB(float[])
52      */

53     public float[] toRGB(float[] colorvalue) {
54         return new float [] {
55             (1 - colorvalue[0]) * (1 - colorvalue[3]),
56             (1 - colorvalue[1]) * (1 - colorvalue[3]),
57             (1 - colorvalue[2]) * (1 - colorvalue[3])};
58     }
59
60     /**
61      * @see java.awt.color.ColorSpace#fromRGB(float[])
62      */

63     public float[] fromRGB(float[] rgbvalue) {
64         throw new UnsupportedOperationException JavaDoc("NYI");
65     }
66
67     /**
68      * @see java.awt.color.ColorSpace#toCIEXYZ(float[])
69      */

70     public float[] toCIEXYZ(float[] colorvalue) {
71         throw new UnsupportedOperationException JavaDoc("NYI");
72     }
73
74     /**
75      * @see java.awt.color.ColorSpace#fromCIEXYZ(float[])
76      */

77     public float[] fromCIEXYZ(float[] colorvalue) {
78         throw new UnsupportedOperationException JavaDoc("NYI");
79     }
80
81 }
82
Popular Tags