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.

PDFSeparationColorSpace.java 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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.pdf;
  19. /**
  20. * This class represents a "Separation" color space. It is used in FOP to map named colors.
  21. */
  22. public class PDFSeparationColorSpace extends PDFArray implements PDFColorSpace {
  23. /**
  24. * Creates a new "Separation" color space.
  25. * @param colorName the name of the colorant
  26. * @param tintFunction the tint function used as fallback
  27. */
  28. public PDFSeparationColorSpace(String colorName, PDFFunction tintFunction) {
  29. super();
  30. add(new PDFName("Separation"));
  31. add(new PDFName(colorName));
  32. add(new PDFName("DeviceRGB"));
  33. add(new PDFReference(tintFunction));
  34. }
  35. /** {@inheritDoc} */
  36. public String getName() {
  37. //return "CS" + this.getObjectNumber();
  38. return getColorName().toString();
  39. }
  40. /**
  41. * Returns the name of the colorant.
  42. * @return the name of the colorant
  43. */
  44. public PDFName getColorName() {
  45. return (PDFName)get(1);
  46. }
  47. /**
  48. * Returns a reference to the tint function that is used as a fallback if the colorant is
  49. * not available.
  50. * @return a reference to the tint function
  51. */
  52. public PDFReference getTintFunction() {
  53. return (PDFReference)get(2);
  54. }
  55. /** {@inheritDoc} */
  56. public int getNumComponents() {
  57. return 1;
  58. }
  59. /** {@inheritDoc} */
  60. public boolean isCMYKColorSpace() {
  61. return false;
  62. }
  63. /** {@inheritDoc} */
  64. public boolean isDeviceColorSpace() {
  65. return false;
  66. }
  67. /** {@inheritDoc} */
  68. public boolean isGrayColorSpace() {
  69. return false;
  70. }
  71. /** {@inheritDoc} */
  72. public boolean isRGBColorSpace() {
  73. return false;
  74. }
  75. }