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.

ColorProfile.java 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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.fo.pagination;
  19. import org.apache.fop.apps.FOPException;
  20. import org.apache.fop.fo.FONode;
  21. import org.apache.fop.fo.FObj;
  22. import org.apache.fop.fo.PropertyList;
  23. import org.apache.fop.fo.ValidationException;
  24. import org.xml.sax.Locator;
  25. /**
  26. * Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_color-profile">
  27. * <code>fo:color-profile</code></a> object.
  28. *
  29. * This loads the color profile when needed and resolves a requested color.
  30. */
  31. public class ColorProfile extends FObj {
  32. // The value of properties relevant for fo:color-profile.
  33. private String src;
  34. private String colorProfileName;
  35. private int renderingIntent;
  36. // End of property values
  37. /**
  38. * Base constructor
  39. *
  40. * @param parent {@link FONode} that is the parent of this object
  41. */
  42. public ColorProfile(FONode parent) {
  43. super(parent);
  44. }
  45. /** {@inheritDoc} */
  46. public void bind(PropertyList pList) throws FOPException {
  47. src = pList.get(PR_SRC).getString();
  48. colorProfileName = pList.get(PR_COLOR_PROFILE_NAME).getString();
  49. renderingIntent = pList.get(PR_RENDERING_INTENT).getEnum();
  50. }
  51. /**
  52. * {@inheritDoc}
  53. * <br>XSL 1.0/FOP: EMPTY (no child nodes permitted)
  54. */
  55. protected void validateChildNode(Locator loc, String nsURI, String localName)
  56. throws ValidationException {
  57. if (FO_URI.equals(nsURI)) {
  58. invalidChildError(loc, nsURI, localName);
  59. }
  60. }
  61. /**
  62. * @return the "color-profile-name" property.
  63. */
  64. public String getColorProfileName() {
  65. return colorProfileName;
  66. }
  67. /** {@inheritDoc} */
  68. public String getLocalName() {
  69. return "color-profile";
  70. }
  71. /**
  72. * {@inheritDoc}
  73. * @return {@link org.apache.fop.fo.Constants#FO_COLOR_PROFILE}
  74. */
  75. public int getNameId() {
  76. return FO_COLOR_PROFILE;
  77. }
  78. /**
  79. * Get src attribute
  80. *
  81. * @return value of color-profile src attribute
  82. */
  83. public String getSrc() {
  84. return this.src;
  85. }
  86. /**
  87. * Get rendering-intent attribute
  88. *
  89. * Returned value is one of
  90. * Constants.EN_AUTO
  91. * Constants.EN_PERCEPTUAL
  92. * Constants.EN_RELATIVE_COLOMETRIC
  93. * Constants.EN_SATURATION
  94. * Constants.EN_ABSOLUTE_COLORMETRIC
  95. *
  96. * @return Rendering intent attribute
  97. */
  98. public int getRenderingIntent() {
  99. return this.renderingIntent;
  100. }
  101. }