aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/PdfViewer/autogen/SkPdfImageDictionary_autogen.h
blob: 8eb481a36af8f2d8859333969eaaa24edaba2f21 (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
#ifndef __DEFINED__SkPdfImageDictionary
#define __DEFINED__SkPdfImageDictionary

#include "SkPdfUtils.h"
#include "SkPdfEnums_autogen.h"
#include "SkPdfArray_autogen.h"
#include "SkPdfXObjectDictionary_autogen.h"

// Additional entries specific to an image dictionary
class SkPdfImageDictionary : public SkPdfXObjectDictionary {
public:
  virtual SkPdfObjectType getType() const { return kImageDictionary_SkPdfObjectType;}
  virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kImageDictionary_SkPdfObjectType + 1);}
public:
  virtual SkPdfImageDictionary* asImageDictionary() {return this;}
  virtual const SkPdfImageDictionary* asImageDictionary() const {return this;}

private:
  virtual SkPdfType1FormDictionary* asType1FormDictionary() {return NULL;}
  virtual const SkPdfType1FormDictionary* asType1FormDictionary() const {return NULL;}

public:
private:
public:
  SkPdfImageDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObject* podofoObj = NULL) : SkPdfXObjectDictionary(podofoDoc, podofoObj) {}

  SkPdfImageDictionary(const SkPdfImageDictionary& from) : SkPdfXObjectDictionary(from.fPodofoDoc, from.fPodofoObj) {}

  virtual bool valid() const {return true;}

  SkPdfImageDictionary& operator=(const SkPdfImageDictionary& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;}

/** (Optional) The type of PDF object that this dictionary describes; if
 *  present, must be XObject for an image XObject.
**/
  bool has_Type() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "", NULL));
  }

  std::string Type() const;
/** (Required) The type of XObject that this dictionary describes; must be
 *  Image for an image XObject.
**/
  bool has_Subtype() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "", NULL));
  }

  std::string Subtype() const;
/** (Required) The width of the image, in samples.
**/
  bool has_Width() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Width", "", NULL));
  }

  long Width() const;
/** (Required) The height of the image, in samples.
**/
  bool has_Height() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Height", "", NULL));
  }

  long Height() const;
/** (Required except for image masks; not allowed for image masks) The color
 *  space in which image samples are specified. This may be any type of color
 *  space except Pattern.
**/
  bool has_ColorSpace() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpace", "", NULL));
  }

  bool isColorSpaceAName() const {
    SkPdfObject* ret = NULL;
    if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpace", "", &ret)) return false;
    return ret->podofo()->GetDataType() == ePdfDataType_Name;
  }

  std::string getColorSpaceAsName() const;
  bool isColorSpaceAArray() const {
    SkPdfObject* ret = NULL;
    if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpace", "", &ret)) return false;
    return ret->podofo()->GetDataType() == ePdfDataType_Array;
  }

  SkPdfArray* getColorSpaceAsArray() const;
/** (Required except for image masks; optional for image masks) The number of
 *  bits used to represent each color component. Only a single value may be
 *  specified; the number of bits is the same for all color components. Valid
 *  values are 1, 2, 4, and 8. If ImageMask is true, this entry is optional, and if
 *  specified, its value must be 1.
 *  If the image stream uses a filter, the value of BitsPerComponent must be
 *  consistent with the size of the data samples that the filter delivers. In par-
 *  ticular, a CCITTFaxDecode or JBIG2Decode filter always delivers 1-bit sam-
 *  ples, a RunLengthDecode or DCTDecode filter delivers 8-bit samples, and
 *  an LZWDecode or FlateDecode filter delivers samples of a specified size if
 *  a predictor function is used.
**/
  bool has_BitsPerComponent() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BitsPerComponent", "", NULL));
  }

  long BitsPerComponent() const;
/** (Optional; PDF 1.1) The name of a color rendering intent to be used in
 *  rendering the image (see "Rendering Intents" on page 197). Default value:
 *  the current rendering intent in the graphics state.
**/
  bool has_Intent() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Intent", "", NULL));
  }

  std::string Intent() const;
/** (Optional) A flag indicating whether the image is to be treated as an image
 *  mask (see Section 4.8.5, "Masked Images"). If this flag is true, the value of
 *  BitsPerComponent must be 1 and Mask and ColorSpace should not be
 *  specified; unmasked areas will be painted using the current nonstroking
 *  color. Default value: false.
**/
  bool has_ImageMask() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ImageMask", "", NULL));
  }

  bool ImageMask() const;
/** (Optional except for image masks; not allowed for image masks; PDF 1.3) An
 *  image XObject defining an image mask to be applied to this image (see
 *  "Explicit Masking" on page 277), or an array specifying a range of colors
 *  to be applied to it as a color key mask (see "Color Key Masking" on page
 *  277). If ImageMask is true, this entry must not be present. (See
 *  implementation note 35 in Appendix H.)
**/
  bool has_Mask() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Mask", "", NULL));
  }

  bool isMaskAStream() const {
    SkPdfObject* ret = NULL;
    if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Mask", "", &ret)) return false;
    return ret->podofo()->HasStream();
  }

  SkPdfStream* getMaskAsStream() const;
  bool isMaskAArray() const {
    SkPdfObject* ret = NULL;
    if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Mask", "", &ret)) return false;
    return ret->podofo()->GetDataType() == ePdfDataType_Array;
  }

  SkPdfArray* getMaskAsArray() const;
/** (Optional; PDF 1.4) A subsidiary image XObject defining a soft-mask
 *  image (see "Soft-Mask Images" on page 447) to be used as a source of
 *  mask shape or mask opacity values in the transparent imaging model. The
 *  alpha source parameter in the graphics state determines whether the mask
 *  values are interpreted as shape or opacity.
 *  If present, this entry overrides the current soft mask in the graphics state,
 *  as well as the image's Mask entry, if any. (However, the other transparency-
 *  related graphics state parameters-blend mode and alpha constant-
 *  remain in effect.) If SMask is absent, the image has no associated soft mask
 *  (although the current soft mask in the graphics state may still apply).
**/
  bool has_SMask() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SMask", "", NULL));
  }

  SkPdfStream* SMask() const;
/** (Optional) An array of numbers describing how to map image samples
 *  into the range of values appropriate for the image's color space (see
 *  "Decode Arrays" on page 271). If ImageMask is true, the array must be
 *  either [0 1] or [1 0]; otherwise, its length must be twice the number of
 *  color components required by ColorSpace. Default value: see "Decode
 *  Arrays" on page 271.
**/
  bool has_Decode() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Decode", "", NULL));
  }

  SkPdfArray* Decode() const;
/** (Optional) A flag indicating whether image interpolation is to be per-
 *  formed (see "Image Interpolation" on page 273). Default value: false.
**/
  bool has_Interpolate() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Interpolate", "", NULL));
  }

  bool Interpolate() const;
/** (Optional; PDF 1.3) An array of alternate image dictionaries for this image
 *  (see "Alternate Images" on page 273). The order of elements within the
 *  array has no significance. This entry may not be present in an image
 *  XObject that is itself an alternate image.
**/
  bool has_Alternates() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alternates", "", NULL));
  }

  SkPdfArray* Alternates() const;
/** (Required in PDF 1.0; optional otherwise) The name by which this image
 *  XObject is referenced in the XObject subdictionary of the current resource
 *  dictionary (see Section 3.7.2, "Resource Dictionaries").
 *  Note: This entry is obsolescent and its use is no longer recommended. (See
 *  implementation note 36 in Appendix H.)
**/
  bool has_Name() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name", "", NULL));
  }

  std::string Name() const;
/** (Required if the image is a structural content item; PDF 1.3) The integer key
 *  of the image's entry in the structural parent tree (see "Finding Structure
 *  Elements from Content Items" on page 600).
**/
  bool has_StructParent() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StructParent", "", NULL));
  }

  long StructParent() const;
/** (Optional; PDF 1.3; indirect reference preferred) The digital identifier of the
 *  image's parent Web Capture content set (see Section 9.9.5, "Object At-
 *  tributes Related to Web Capture").
**/
  bool has_ID() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ID", "", NULL));
  }

  std::string ID() const;
/** (Optional; PDF 1.2) An OPI version dictionary for the image (see Section
 *  9.10.6, "Open Prepress Interface (OPI)"). If ImageMask is true, this entry
 *  is ignored.
**/
  bool has_OPI() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPI", "", NULL));
  }

  SkPdfDictionary* OPI() const;
/** (Optional; PDF 1.4) A metadata stream containing metadata for the image
 *  (see Section 9.2.2, "Metadata Streams").
**/
  bool has_Metadata() const {
    return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metadata", "", NULL));
  }

  SkPdfStream* Metadata() const;
};

#endif  // __DEFINED__SkPdfImageDictionary