blob: e2b9e521c85b3953f1d4db7070156535fd9153e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* $Id$ */
package org.apache.fop.pdf;
import java.io.IOException;
import java.io.OutputStream;
/**
* Interface for a PDF image.
* This is used for inserting an image into PDF.
*/
public interface PDFImage {
/**
* Key to look up XObject.
* This should be a unique key to refer to the image.
*
* @return the key for this image
*/
String getKey();
/**
* Setup the PDF image for the current document.
* Some image formats may need to access the document (for example to
* add an ICC profile to the document).
*
* @param doc the PDF parent document
* (todo) Remove this and delegate to the XObject
*/
void setup(PDFDocument doc);
/**
* Get the image width in pixels.
*
* @return the image width
*/
int getWidth();
/**
* Get the image height in pixels.
*
* @return the image height
*/
int getHeight();
/**
* Get the color space for this image.
* Possible results are: DeviceGray, DeviceRGB, or DeviceCMYK
*
* @return the color space
*/
PDFDeviceColorSpace getColorSpace();
/**
* Get the bits per color component for this image.
*
* @return the bits per component
*/
int getBitsPerComponent();
/**
* Check if this image is a PostScript image.
*
* @return true if this is a PostScript image
*/
boolean isPS();
/**
* Check if this image has a transparent color transparency.
*
* @return true if it has transparency
*/
boolean isTransparent();
/**
* Get the transparent color.
*
* @return the transparent color for this image
*/
PDFColor getTransparentColor();
/**
* Get the PDF reference for a bitmap mask.
*
* @return the PDF reference for the mask image
*/
String getMask();
/**
* Get the PDF reference for a soft mask.
* @return the PDF reference for a soft mask image (or null if there's no soft mask)
*/
PDFReference getSoftMaskReference();
/** @return true for CMYK images generated by Adobe Photoshop */
boolean isInverted();
/**
* Get the PDF Filter to be applied to the image.
*
* @return the PDF Filter or null
*/
PDFFilter getPDFFilter();
// get the image bytes, and bytes properties
/**
* Writes the raw, unencoded contents of the image to a given output stream.
*
* @param out OutputStream to write to
* @throws IOException if there creating stream
*/
void outputContents(OutputStream out) throws IOException;
/**
* Populates the XObject's dictionary with additional values. The values are added to the
* dictionary after all the values obtained from other methods from this interface have
* been put into the dictionary. That allows to override certain values.
* @param dict the dictionary to fill
*/
void populateXObjectDictionary(PDFDictionary dict);
/**
* Get the ICC stream for this image.
*
* @return the ICC stream for this image if any
*/
PDFICCStream getICCStream();
/**
* Returns a hint in form of a String (Possible values from PDFFilterList)
* indicating which filter setup should be used to encode the object.
* @return the filter setup hint
*/
String getFilterHint();
}
|