Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. import java.io.IOException;
  20. import java.io.OutputStream;
  21. /**
  22. * Interface for a PDF image.
  23. * This is used for inserting an image into PDF.
  24. */
  25. public interface PDFImage {
  26. /**
  27. * Key to look up XObject.
  28. * This should be a unique key to refer to the image.
  29. *
  30. * @return the key for this image
  31. */
  32. String getKey();
  33. /**
  34. * Setup the PDF image for the current document.
  35. * Some image formats may need to access the document (for example to
  36. * add an ICC profile to the document).
  37. *
  38. * @param doc the PDF parent document
  39. * (todo) Remove this and delegate to the XObject
  40. */
  41. void setup(PDFDocument doc);
  42. /**
  43. * Get the image width in pixels.
  44. *
  45. * @return the image width
  46. */
  47. int getWidth();
  48. /**
  49. * Get the image height in pixels.
  50. *
  51. * @return the image height
  52. */
  53. int getHeight();
  54. /**
  55. * Get the color space for this image.
  56. * Possible results are: DeviceGray, DeviceRGB, or DeviceCMYK
  57. *
  58. * @return the color space
  59. */
  60. PDFDeviceColorSpace getColorSpace();
  61. /**
  62. * Get the bits per pixel for this image.
  63. *
  64. * @return the bits per pixel
  65. */
  66. int getBitsPerPixel();
  67. /**
  68. * Check if this image is a PostScript image.
  69. *
  70. * @return true if this is a PostScript image
  71. */
  72. boolean isPS();
  73. /**
  74. * Check if this image has a transparent color transparency.
  75. *
  76. * @return true if it has transparency
  77. */
  78. boolean isTransparent();
  79. /**
  80. * Get the transparent color.
  81. *
  82. * @return the transparent color for this image
  83. */
  84. PDFColor getTransparentColor();
  85. /**
  86. * Get the PDF reference for a bitmap mask.
  87. *
  88. * @return the PDF reference for the mask image
  89. */
  90. String getMask();
  91. /**
  92. * Get the PDF reference for a soft mask.
  93. *
  94. * @return the PDF reference for a soft mask image
  95. */
  96. String getSoftMask();
  97. PDFReference getSoftMaskReference();
  98. /** @return true for CMYK images generated by Adobe Photoshop */
  99. boolean isInverted();
  100. /**
  101. * Get the PDF Filter to be applied to the image.
  102. *
  103. * @return the PDF Filter or null
  104. */
  105. PDFFilter getPDFFilter();
  106. // get the image bytes, and bytes properties
  107. /**
  108. * Writes the raw, unencoded contents of the image to a given output stream.
  109. *
  110. * @param out OutputStream to write to
  111. * @throws IOException if there creating stream
  112. */
  113. void outputContents(OutputStream out) throws IOException;
  114. /**
  115. * Get the ICC stream for this image.
  116. *
  117. * @return the ICC stream for this image if any
  118. */
  119. PDFICCStream getICCStream();
  120. /**
  121. * Returns a hint in form of a String (Possible values from PDFFilterList)
  122. * indicating which filter setup should be used to encode the object.
  123. * @return the filter setup hint
  124. */
  125. String getFilterHint();
  126. }