KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fop > pdf > PDFImage


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: PDFImage.java 426576 2006-07-28 15:44:37Z jeremias $ */
19
20 package org.apache.fop.pdf;
21
22 import java.io.IOException JavaDoc;
23 import java.io.OutputStream JavaDoc;
24
25 /**
26  * Interface for a PDF image.
27  * This is used for inserting an image into PDF.
28  */

29 public interface PDFImage {
30
31     /**
32      * Key to look up XObject.
33      * This should be a unique key to refer to the image.
34      *
35      * @return the key for this image
36      */

37     String JavaDoc getKey();
38
39     /**
40      * Setup the PDF image for the current document.
41      * Some image formats may need to access the document (for example to
42      * add an ICC profile to the document).
43      *
44      * @param doc the PDF parent document
45      * (todo) Remove this and delegate to the XObject
46      */

47     void setup(PDFDocument doc);
48
49     /**
50      * Get the image width in pixels.
51      *
52      * @return the image width
53      */

54     int getWidth();
55
56     /**
57      * Get the image height in pixels.
58      *
59      * @return the image height
60      */

61     int getHeight();
62
63     /**
64      * Get the color space for this image.
65      * Possible results are: DeviceGray, DeviceRGB, or DeviceCMYK
66      *
67      * @return the color space
68      */

69     PDFDeviceColorSpace getColorSpace();
70
71     /**
72      * Get the bits per pixel for this image.
73      *
74      * @return the bits per pixel
75      */

76     int getBitsPerPixel();
77
78     /**
79      * Check if this image is a PostScript image.
80      *
81      * @return true if this is a PostScript image
82      */

83     boolean isPS();
84
85     /**
86      * Check if this image has a transparent color transparency.
87      *
88      * @return true if it has transparency
89      */

90     boolean isTransparent();
91
92     /**
93      * Get the transparent color.
94      *
95      * @return the transparent color for this image
96      */

97     PDFColor getTransparentColor();
98
99     /**
100      * Get the PDF reference for a bitmap mask.
101      *
102      * @return the PDF reference for the mask image
103      */

104     String JavaDoc getMask();
105
106     /**
107      * Get the PDF reference for a soft mask.
108      *
109      * @return the PDF reference for a soft mask image
110      */

111     String JavaDoc getSoftMask();
112
113     /** @return true for CMYK images generated by Adobe Photoshop */
114     boolean isInverted();
115     
116     /**
117      * Get the PDF Filter to be applied to the image.
118      *
119      * @return the PDF Filter or null
120      */

121     PDFFilter getPDFFilter();
122     
123     // get the image bytes, and bytes properties
124

125     /**
126      * Writes the raw, unencoded contents of the image to a given output stream.
127      *
128      * @param out OutputStream to write to
129      * @throws IOException if there creating stream
130      */

131     void outputContents(OutputStream JavaDoc out) throws IOException JavaDoc;
132
133     /**
134      * Get the ICC stream for this image.
135      *
136      * @return the ICC stream for this image if any
137      */

138     PDFICCStream getICCStream();
139
140     /**
141      * Returns a hint in form of a String (Possible values from PDFFilterList)
142      * indicating which filter setup should be used to encode the object.
143      * @return the filter setup hint
144      */

145     String JavaDoc getFilterHint();
146
147 }
148
149
Popular Tags