You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMYKColorSpace.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. /* $Id$ */
  18. package org.apache.fop.util;
  19. import java.awt.color.ColorSpace;
  20. /**
  21. * This class represents an uncalibrated CMYK color space. It is used by
  22. * the JpegImage class.
  23. */
  24. public class CMYKColorSpace extends ColorSpace {
  25. private static CMYKColorSpace instance;
  26. /**
  27. * @see java.awt.color.ColorSpace#ColorSpace(int, int)
  28. */
  29. protected CMYKColorSpace(int type, int numcomponents) {
  30. super(type, numcomponents);
  31. }
  32. /**
  33. * Returns an instance of an uncalibrated CMYK color space.
  34. * @return CMYKColorSpace the requested color space object
  35. */
  36. public static CMYKColorSpace getInstance() {
  37. if (instance == null) {
  38. instance = new CMYKColorSpace(TYPE_CMYK, 4);
  39. }
  40. return instance;
  41. }
  42. /**
  43. * {@inheritDoc}
  44. */
  45. public float[] toRGB(float[] colorvalue) {
  46. return new float [] {
  47. (1 - colorvalue[0]) * (1 - colorvalue[3]),
  48. (1 - colorvalue[1]) * (1 - colorvalue[3]),
  49. (1 - colorvalue[2]) * (1 - colorvalue[3])};
  50. }
  51. /**
  52. * {@inheritDoc}
  53. */
  54. public float[] fromRGB(float[] rgbvalue) {
  55. throw new UnsupportedOperationException("NYI");
  56. }
  57. /**
  58. * {@inheritDoc}
  59. */
  60. public float[] toCIEXYZ(float[] colorvalue) {
  61. throw new UnsupportedOperationException("NYI");
  62. }
  63. /**
  64. * {@inheritDoc}
  65. */
  66. public float[] fromCIEXYZ(float[] colorvalue) {
  67. throw new UnsupportedOperationException("NYI");
  68. }
  69. }