OLD | NEW |
| (Empty) |
1 #ifndef __DEFINED__SkPdfImageDictionary | |
2 #define __DEFINED__SkPdfImageDictionary | |
3 | |
4 #include "SkPdfUtils.h" | |
5 #include "SkPdfEnums_autogen.h" | |
6 #include "SkPdfArray_autogen.h" | |
7 #include "SkPdfXObjectDictionary_autogen.h" | |
8 | |
9 // Additional entries specific to an image dictionary | |
10 class SkPdfImageDictionary : public SkPdfXObjectDictionary { | |
11 public: | |
12 virtual SkPdfObjectType getType() const { return kImageDictionary_SkPdfObjectT
ype;} | |
13 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kImageDi
ctionary_SkPdfObjectType + 1);} | |
14 public: | |
15 virtual SkPdfImageDictionary* asImageDictionary() {return this;} | |
16 virtual const SkPdfImageDictionary* asImageDictionary() const {return this;} | |
17 | |
18 private: | |
19 virtual SkPdfType1FormDictionary* asType1FormDictionary() {return NULL;} | |
20 virtual const SkPdfType1FormDictionary* asType1FormDictionary() const {return
NULL;} | |
21 | |
22 public: | |
23 private: | |
24 public: | |
25 SkPdfImageDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObject*
podofoObj = NULL) : SkPdfXObjectDictionary(podofoDoc, podofoObj) {} | |
26 | |
27 SkPdfImageDictionary(const SkPdfImageDictionary& from) : SkPdfXObjectDictionar
y(from.fPodofoDoc, from.fPodofoObj) {} | |
28 | |
29 virtual bool valid() const {return true;} | |
30 | |
31 SkPdfImageDictionary& operator=(const SkPdfImageDictionary& from) {this->fPodo
foDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;} | |
32 | |
33 /** (Optional) The type of PDF object that this dictionary describes; if | |
34 * present, must be XObject for an image XObject. | |
35 **/ | |
36 bool has_Type() const { | |
37 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); | |
38 } | |
39 | |
40 std::string Type() const; | |
41 /** (Required) The type of XObject that this dictionary describes; must be | |
42 * Image for an image XObject. | |
43 **/ | |
44 bool has_Subtype() const { | |
45 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); | |
46 } | |
47 | |
48 std::string Subtype() const; | |
49 /** (Required) The width of the image, in samples. | |
50 **/ | |
51 bool has_Width() const { | |
52 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Width
", "", NULL)); | |
53 } | |
54 | |
55 long Width() const; | |
56 /** (Required) The height of the image, in samples. | |
57 **/ | |
58 bool has_Height() const { | |
59 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Heigh
t", "", NULL)); | |
60 } | |
61 | |
62 long Height() const; | |
63 /** (Required except for image masks; not allowed for image masks) The color | |
64 * space in which image samples are specified. This may be any type of color | |
65 * space except Pattern. | |
66 **/ | |
67 bool has_ColorSpace() const { | |
68 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Color
Space", "", NULL)); | |
69 } | |
70 | |
71 bool isColorSpaceAName() const { | |
72 SkPdfObject* ret = NULL; | |
73 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpa
ce", "", &ret)) return false; | |
74 return ret->podofo()->GetDataType() == ePdfDataType_Name; | |
75 } | |
76 | |
77 std::string getColorSpaceAsName() const; | |
78 bool isColorSpaceAArray() const { | |
79 SkPdfObject* ret = NULL; | |
80 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpa
ce", "", &ret)) return false; | |
81 return ret->podofo()->GetDataType() == ePdfDataType_Array; | |
82 } | |
83 | |
84 SkPdfArray* getColorSpaceAsArray() const; | |
85 /** (Required except for image masks; optional for image masks) The number of | |
86 * bits used to represent each color component. Only a single value may be | |
87 * specified; the number of bits is the same for all color components. Valid | |
88 * values are 1, 2, 4, and 8. If ImageMask is true, this entry is optional, and
if | |
89 * specified, its value must be 1. | |
90 * If the image stream uses a filter, the value of BitsPerComponent must be | |
91 * consistent with the size of the data samples that the filter delivers. In pa
r- | |
92 * ticular, a CCITTFaxDecode or JBIG2Decode filter always delivers 1-bit sam- | |
93 * ples, a RunLengthDecode or DCTDecode filter delivers 8-bit samples, and | |
94 * an LZWDecode or FlateDecode filter delivers samples of a specified size if | |
95 * a predictor function is used. | |
96 **/ | |
97 bool has_BitsPerComponent() const { | |
98 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BitsP
erComponent", "", NULL)); | |
99 } | |
100 | |
101 long BitsPerComponent() const; | |
102 /** (Optional; PDF 1.1) The name of a color rendering intent to be used in | |
103 * rendering the image (see "Rendering Intents" on page 197). Default value: | |
104 * the current rendering intent in the graphics state. | |
105 **/ | |
106 bool has_Intent() const { | |
107 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Inten
t", "", NULL)); | |
108 } | |
109 | |
110 std::string Intent() const; | |
111 /** (Optional) A flag indicating whether the image is to be treated as an image | |
112 * mask (see Section 4.8.5, "Masked Images"). If this flag is true, the value o
f | |
113 * BitsPerComponent must be 1 and Mask and ColorSpace should not be | |
114 * specified; unmasked areas will be painted using the current nonstroking | |
115 * color. Default value: false. | |
116 **/ | |
117 bool has_ImageMask() const { | |
118 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Image
Mask", "", NULL)); | |
119 } | |
120 | |
121 bool ImageMask() const; | |
122 /** (Optional except for image masks; not allowed for image masks; PDF 1.3) An | |
123 * image XObject defining an image mask to be applied to this image (see | |
124 * "Explicit Masking" on page 277), or an array specifying a range of colors | |
125 * to be applied to it as a color key mask (see "Color Key Masking" on page | |
126 * 277). If ImageMask is true, this entry must not be present. (See | |
127 * implementation note 35 in Appendix H.) | |
128 **/ | |
129 bool has_Mask() const { | |
130 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Mask"
, "", NULL)); | |
131 } | |
132 | |
133 bool isMaskAStream() const { | |
134 SkPdfObject* ret = NULL; | |
135 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Mask", "
", &ret)) return false; | |
136 return ret->podofo()->HasStream(); | |
137 } | |
138 | |
139 SkPdfStream* getMaskAsStream() const; | |
140 bool isMaskAArray() const { | |
141 SkPdfObject* ret = NULL; | |
142 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Mask", "
", &ret)) return false; | |
143 return ret->podofo()->GetDataType() == ePdfDataType_Array; | |
144 } | |
145 | |
146 SkPdfArray* getMaskAsArray() const; | |
147 /** (Optional; PDF 1.4) A subsidiary image XObject defining a soft-mask | |
148 * image (see "Soft-Mask Images" on page 447) to be used as a source of | |
149 * mask shape or mask opacity values in the transparent imaging model. The | |
150 * alpha source parameter in the graphics state determines whether the mask | |
151 * values are interpreted as shape or opacity. | |
152 * If present, this entry overrides the current soft mask in the graphics state
, | |
153 * as well as the image's Mask entry, if any. (However, the other transparency- | |
154 * related graphics state parameters-blend mode and alpha constant- | |
155 * remain in effect.) If SMask is absent, the image has no associated soft mask | |
156 * (although the current soft mask in the graphics state may still apply). | |
157 **/ | |
158 bool has_SMask() const { | |
159 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SMask
", "", NULL)); | |
160 } | |
161 | |
162 SkPdfStream* SMask() const; | |
163 /** (Optional) An array of numbers describing how to map image samples | |
164 * into the range of values appropriate for the image's color space (see | |
165 * "Decode Arrays" on page 271). If ImageMask is true, the array must be | |
166 * either [0 1] or [1 0]; otherwise, its length must be twice the number of | |
167 * color components required by ColorSpace. Default value: see "Decode | |
168 * Arrays" on page 271. | |
169 **/ | |
170 bool has_Decode() const { | |
171 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Decod
e", "", NULL)); | |
172 } | |
173 | |
174 SkPdfArray* Decode() const; | |
175 /** (Optional) A flag indicating whether image interpolation is to be per- | |
176 * formed (see "Image Interpolation" on page 273). Default value: false. | |
177 **/ | |
178 bool has_Interpolate() const { | |
179 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Inter
polate", "", NULL)); | |
180 } | |
181 | |
182 bool Interpolate() const; | |
183 /** (Optional; PDF 1.3) An array of alternate image dictionaries for this image | |
184 * (see "Alternate Images" on page 273). The order of elements within the | |
185 * array has no significance. This entry may not be present in an image | |
186 * XObject that is itself an alternate image. | |
187 **/ | |
188 bool has_Alternates() const { | |
189 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alter
nates", "", NULL)); | |
190 } | |
191 | |
192 SkPdfArray* Alternates() const; | |
193 /** (Required in PDF 1.0; optional otherwise) The name by which this image | |
194 * XObject is referenced in the XObject subdictionary of the current resource | |
195 * dictionary (see Section 3.7.2, "Resource Dictionaries"). | |
196 * Note: This entry is obsolescent and its use is no longer recommended. (See | |
197 * implementation note 36 in Appendix H.) | |
198 **/ | |
199 bool has_Name() const { | |
200 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name"
, "", NULL)); | |
201 } | |
202 | |
203 std::string Name() const; | |
204 /** (Required if the image is a structural content item; PDF 1.3) The integer ke
y | |
205 * of the image's entry in the structural parent tree (see "Finding Structure | |
206 * Elements from Content Items" on page 600). | |
207 **/ | |
208 bool has_StructParent() const { | |
209 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Struc
tParent", "", NULL)); | |
210 } | |
211 | |
212 long StructParent() const; | |
213 /** (Optional; PDF 1.3; indirect reference preferred) The digital identifier of
the | |
214 * image's parent Web Capture content set (see Section 9.9.5, "Object At- | |
215 * tributes Related to Web Capture"). | |
216 **/ | |
217 bool has_ID() const { | |
218 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ID",
"", NULL)); | |
219 } | |
220 | |
221 std::string ID() const; | |
222 /** (Optional; PDF 1.2) An OPI version dictionary for the image (see Section | |
223 * 9.10.6, "Open Prepress Interface (OPI)"). If ImageMask is true, this entry | |
224 * is ignored. | |
225 **/ | |
226 bool has_OPI() const { | |
227 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPI",
"", NULL)); | |
228 } | |
229 | |
230 SkPdfDictionary* OPI() const; | |
231 /** (Optional; PDF 1.4) A metadata stream containing metadata for the image | |
232 * (see Section 9.2.2, "Metadata Streams"). | |
233 **/ | |
234 bool has_Metadata() const { | |
235 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metad
ata", "", NULL)); | |
236 } | |
237 | |
238 SkPdfStream* Metadata() const; | |
239 }; | |
240 | |
241 #endif // __DEFINED__SkPdfImageDictionary | |
OLD | NEW |