1 /*
2 * Copyright 2013 Google Inc.
3
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkPdfGraphicsStateDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10
Type(SkPdfNativeDoc * doc)11 SkString SkPdfGraphicsStateDictionary::Type(SkPdfNativeDoc* doc) {
12 SkPdfNativeObject* ret = get("Type", "");
13 if (doc) {ret = doc->resolveReference(ret);}
14 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
15 // TODO(edisonn): warn about missing default value for optional fields
16 return SkString();
17 }
18
has_Type() const19 bool SkPdfGraphicsStateDictionary::has_Type() const {
20 return get("Type", "") != NULL;
21 }
22
LW(SkPdfNativeDoc * doc)23 double SkPdfGraphicsStateDictionary::LW(SkPdfNativeDoc* doc) {
24 SkPdfNativeObject* ret = get("LW", "");
25 if (doc) {ret = doc->resolveReference(ret);}
26 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
27 // TODO(edisonn): warn about missing default value for optional fields
28 return 0;
29 }
30
has_LW() const31 bool SkPdfGraphicsStateDictionary::has_LW() const {
32 return get("LW", "") != NULL;
33 }
34
LC(SkPdfNativeDoc * doc)35 int64_t SkPdfGraphicsStateDictionary::LC(SkPdfNativeDoc* doc) {
36 SkPdfNativeObject* ret = get("LC", "");
37 if (doc) {ret = doc->resolveReference(ret);}
38 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
39 // TODO(edisonn): warn about missing default value for optional fields
40 return 0;
41 }
42
has_LC() const43 bool SkPdfGraphicsStateDictionary::has_LC() const {
44 return get("LC", "") != NULL;
45 }
46
LJ(SkPdfNativeDoc * doc)47 int64_t SkPdfGraphicsStateDictionary::LJ(SkPdfNativeDoc* doc) {
48 SkPdfNativeObject* ret = get("LJ", "");
49 if (doc) {ret = doc->resolveReference(ret);}
50 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
51 // TODO(edisonn): warn about missing default value for optional fields
52 return 0;
53 }
54
has_LJ() const55 bool SkPdfGraphicsStateDictionary::has_LJ() const {
56 return get("LJ", "") != NULL;
57 }
58
ML(SkPdfNativeDoc * doc)59 double SkPdfGraphicsStateDictionary::ML(SkPdfNativeDoc* doc) {
60 SkPdfNativeObject* ret = get("ML", "");
61 if (doc) {ret = doc->resolveReference(ret);}
62 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
63 // TODO(edisonn): warn about missing default value for optional fields
64 return 0;
65 }
66
has_ML() const67 bool SkPdfGraphicsStateDictionary::has_ML() const {
68 return get("ML", "") != NULL;
69 }
70
D(SkPdfNativeDoc * doc)71 SkPdfArray* SkPdfGraphicsStateDictionary::D(SkPdfNativeDoc* doc) {
72 SkPdfNativeObject* ret = get("D", "");
73 if (doc) {ret = doc->resolveReference(ret);}
74 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
75 // TODO(edisonn): warn about missing default value for optional fields
76 return NULL;
77 }
78
has_D() const79 bool SkPdfGraphicsStateDictionary::has_D() const {
80 return get("D", "") != NULL;
81 }
82
RI(SkPdfNativeDoc * doc)83 SkString SkPdfGraphicsStateDictionary::RI(SkPdfNativeDoc* doc) {
84 SkPdfNativeObject* ret = get("RI", "");
85 if (doc) {ret = doc->resolveReference(ret);}
86 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
87 // TODO(edisonn): warn about missing default value for optional fields
88 return SkString();
89 }
90
has_RI() const91 bool SkPdfGraphicsStateDictionary::has_RI() const {
92 return get("RI", "") != NULL;
93 }
94
OP(SkPdfNativeDoc * doc)95 bool SkPdfGraphicsStateDictionary::OP(SkPdfNativeDoc* doc) {
96 SkPdfNativeObject* ret = get("OP", "");
97 if (doc) {ret = doc->resolveReference(ret);}
98 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
99 // TODO(edisonn): warn about missing default value for optional fields
100 return false;
101 }
102
has_OP() const103 bool SkPdfGraphicsStateDictionary::has_OP() const {
104 return get("OP", "") != NULL;
105 }
106
op(SkPdfNativeDoc * doc)107 bool SkPdfGraphicsStateDictionary::op(SkPdfNativeDoc* doc) {
108 SkPdfNativeObject* ret = get("op", "");
109 if (doc) {ret = doc->resolveReference(ret);}
110 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
111 // TODO(edisonn): warn about missing default value for optional fields
112 return false;
113 }
114
has_op() const115 bool SkPdfGraphicsStateDictionary::has_op() const {
116 return get("op", "") != NULL;
117 }
118
OPM(SkPdfNativeDoc * doc)119 int64_t SkPdfGraphicsStateDictionary::OPM(SkPdfNativeDoc* doc) {
120 SkPdfNativeObject* ret = get("OPM", "");
121 if (doc) {ret = doc->resolveReference(ret);}
122 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
123 // TODO(edisonn): warn about missing default value for optional fields
124 return 0;
125 }
126
has_OPM() const127 bool SkPdfGraphicsStateDictionary::has_OPM() const {
128 return get("OPM", "") != NULL;
129 }
130
Font(SkPdfNativeDoc * doc)131 SkPdfArray* SkPdfGraphicsStateDictionary::Font(SkPdfNativeDoc* doc) {
132 SkPdfNativeObject* ret = get("Font", "");
133 if (doc) {ret = doc->resolveReference(ret);}
134 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
135 // TODO(edisonn): warn about missing default value for optional fields
136 return NULL;
137 }
138
has_Font() const139 bool SkPdfGraphicsStateDictionary::has_Font() const {
140 return get("Font", "") != NULL;
141 }
142
BG(SkPdfNativeDoc * doc)143 SkPdfFunction SkPdfGraphicsStateDictionary::BG(SkPdfNativeDoc* doc) {
144 SkPdfNativeObject* ret = get("BG", "");
145 if (doc) {ret = doc->resolveReference(ret);}
146 if ((ret != NULL && ret->isFunction()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->functionValue();
147 // TODO(edisonn): warn about missing default value for optional fields
148 return SkPdfFunction();
149 }
150
has_BG() const151 bool SkPdfGraphicsStateDictionary::has_BG() const {
152 return get("BG", "") != NULL;
153 }
154
isBG2AFunction(SkPdfNativeDoc * doc)155 bool SkPdfGraphicsStateDictionary::isBG2AFunction(SkPdfNativeDoc* doc) {
156 SkPdfNativeObject* ret = get("BG2", "");
157 if (doc) {ret = doc->resolveReference(ret);}
158 return ret != NULL && ret->isFunction();
159 }
160
getBG2AsFunction(SkPdfNativeDoc * doc)161 SkPdfFunction SkPdfGraphicsStateDictionary::getBG2AsFunction(SkPdfNativeDoc* doc) {
162 SkPdfNativeObject* ret = get("BG2", "");
163 if (doc) {ret = doc->resolveReference(ret);}
164 if ((ret != NULL && ret->isFunction()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->functionValue();
165 // TODO(edisonn): warn about missing default value for optional fields
166 return SkPdfFunction();
167 }
168
isBG2AName(SkPdfNativeDoc * doc)169 bool SkPdfGraphicsStateDictionary::isBG2AName(SkPdfNativeDoc* doc) {
170 SkPdfNativeObject* ret = get("BG2", "");
171 if (doc) {ret = doc->resolveReference(ret);}
172 return ret != NULL && ret->isName();
173 }
174
getBG2AsName(SkPdfNativeDoc * doc)175 SkString SkPdfGraphicsStateDictionary::getBG2AsName(SkPdfNativeDoc* doc) {
176 SkPdfNativeObject* ret = get("BG2", "");
177 if (doc) {ret = doc->resolveReference(ret);}
178 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
179 // TODO(edisonn): warn about missing default value for optional fields
180 return SkString();
181 }
182
has_BG2() const183 bool SkPdfGraphicsStateDictionary::has_BG2() const {
184 return get("BG2", "") != NULL;
185 }
186
UCR(SkPdfNativeDoc * doc)187 SkPdfFunction SkPdfGraphicsStateDictionary::UCR(SkPdfNativeDoc* doc) {
188 SkPdfNativeObject* ret = get("UCR", "");
189 if (doc) {ret = doc->resolveReference(ret);}
190 if ((ret != NULL && ret->isFunction()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->functionValue();
191 // TODO(edisonn): warn about missing default value for optional fields
192 return SkPdfFunction();
193 }
194
has_UCR() const195 bool SkPdfGraphicsStateDictionary::has_UCR() const {
196 return get("UCR", "") != NULL;
197 }
198
isUCR2AFunction(SkPdfNativeDoc * doc)199 bool SkPdfGraphicsStateDictionary::isUCR2AFunction(SkPdfNativeDoc* doc) {
200 SkPdfNativeObject* ret = get("UCR2", "");
201 if (doc) {ret = doc->resolveReference(ret);}
202 return ret != NULL && ret->isFunction();
203 }
204
getUCR2AsFunction(SkPdfNativeDoc * doc)205 SkPdfFunction SkPdfGraphicsStateDictionary::getUCR2AsFunction(SkPdfNativeDoc* doc) {
206 SkPdfNativeObject* ret = get("UCR2", "");
207 if (doc) {ret = doc->resolveReference(ret);}
208 if ((ret != NULL && ret->isFunction()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->functionValue();
209 // TODO(edisonn): warn about missing default value for optional fields
210 return SkPdfFunction();
211 }
212
isUCR2AName(SkPdfNativeDoc * doc)213 bool SkPdfGraphicsStateDictionary::isUCR2AName(SkPdfNativeDoc* doc) {
214 SkPdfNativeObject* ret = get("UCR2", "");
215 if (doc) {ret = doc->resolveReference(ret);}
216 return ret != NULL && ret->isName();
217 }
218
getUCR2AsName(SkPdfNativeDoc * doc)219 SkString SkPdfGraphicsStateDictionary::getUCR2AsName(SkPdfNativeDoc* doc) {
220 SkPdfNativeObject* ret = get("UCR2", "");
221 if (doc) {ret = doc->resolveReference(ret);}
222 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
223 // TODO(edisonn): warn about missing default value for optional fields
224 return SkString();
225 }
226
has_UCR2() const227 bool SkPdfGraphicsStateDictionary::has_UCR2() const {
228 return get("UCR2", "") != NULL;
229 }
230
isTRAFunction(SkPdfNativeDoc * doc)231 bool SkPdfGraphicsStateDictionary::isTRAFunction(SkPdfNativeDoc* doc) {
232 SkPdfNativeObject* ret = get("TR", "");
233 if (doc) {ret = doc->resolveReference(ret);}
234 return ret != NULL && ret->isFunction();
235 }
236
getTRAsFunction(SkPdfNativeDoc * doc)237 SkPdfFunction SkPdfGraphicsStateDictionary::getTRAsFunction(SkPdfNativeDoc* doc) {
238 SkPdfNativeObject* ret = get("TR", "");
239 if (doc) {ret = doc->resolveReference(ret);}
240 if ((ret != NULL && ret->isFunction()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->functionValue();
241 // TODO(edisonn): warn about missing default value for optional fields
242 return SkPdfFunction();
243 }
244
isTRAArray(SkPdfNativeDoc * doc)245 bool SkPdfGraphicsStateDictionary::isTRAArray(SkPdfNativeDoc* doc) {
246 SkPdfNativeObject* ret = get("TR", "");
247 if (doc) {ret = doc->resolveReference(ret);}
248 return ret != NULL && ret->isArray();
249 }
250
getTRAsArray(SkPdfNativeDoc * doc)251 SkPdfArray* SkPdfGraphicsStateDictionary::getTRAsArray(SkPdfNativeDoc* doc) {
252 SkPdfNativeObject* ret = get("TR", "");
253 if (doc) {ret = doc->resolveReference(ret);}
254 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
255 // TODO(edisonn): warn about missing default value for optional fields
256 return NULL;
257 }
258
isTRAName(SkPdfNativeDoc * doc)259 bool SkPdfGraphicsStateDictionary::isTRAName(SkPdfNativeDoc* doc) {
260 SkPdfNativeObject* ret = get("TR", "");
261 if (doc) {ret = doc->resolveReference(ret);}
262 return ret != NULL && ret->isName();
263 }
264
getTRAsName(SkPdfNativeDoc * doc)265 SkString SkPdfGraphicsStateDictionary::getTRAsName(SkPdfNativeDoc* doc) {
266 SkPdfNativeObject* ret = get("TR", "");
267 if (doc) {ret = doc->resolveReference(ret);}
268 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
269 // TODO(edisonn): warn about missing default value for optional fields
270 return SkString();
271 }
272
has_TR() const273 bool SkPdfGraphicsStateDictionary::has_TR() const {
274 return get("TR", "") != NULL;
275 }
276
isTR2AFunction(SkPdfNativeDoc * doc)277 bool SkPdfGraphicsStateDictionary::isTR2AFunction(SkPdfNativeDoc* doc) {
278 SkPdfNativeObject* ret = get("TR2", "");
279 if (doc) {ret = doc->resolveReference(ret);}
280 return ret != NULL && ret->isFunction();
281 }
282
getTR2AsFunction(SkPdfNativeDoc * doc)283 SkPdfFunction SkPdfGraphicsStateDictionary::getTR2AsFunction(SkPdfNativeDoc* doc) {
284 SkPdfNativeObject* ret = get("TR2", "");
285 if (doc) {ret = doc->resolveReference(ret);}
286 if ((ret != NULL && ret->isFunction()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->functionValue();
287 // TODO(edisonn): warn about missing default value for optional fields
288 return SkPdfFunction();
289 }
290
isTR2AArray(SkPdfNativeDoc * doc)291 bool SkPdfGraphicsStateDictionary::isTR2AArray(SkPdfNativeDoc* doc) {
292 SkPdfNativeObject* ret = get("TR2", "");
293 if (doc) {ret = doc->resolveReference(ret);}
294 return ret != NULL && ret->isArray();
295 }
296
getTR2AsArray(SkPdfNativeDoc * doc)297 SkPdfArray* SkPdfGraphicsStateDictionary::getTR2AsArray(SkPdfNativeDoc* doc) {
298 SkPdfNativeObject* ret = get("TR2", "");
299 if (doc) {ret = doc->resolveReference(ret);}
300 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
301 // TODO(edisonn): warn about missing default value for optional fields
302 return NULL;
303 }
304
isTR2AName(SkPdfNativeDoc * doc)305 bool SkPdfGraphicsStateDictionary::isTR2AName(SkPdfNativeDoc* doc) {
306 SkPdfNativeObject* ret = get("TR2", "");
307 if (doc) {ret = doc->resolveReference(ret);}
308 return ret != NULL && ret->isName();
309 }
310
getTR2AsName(SkPdfNativeDoc * doc)311 SkString SkPdfGraphicsStateDictionary::getTR2AsName(SkPdfNativeDoc* doc) {
312 SkPdfNativeObject* ret = get("TR2", "");
313 if (doc) {ret = doc->resolveReference(ret);}
314 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
315 // TODO(edisonn): warn about missing default value for optional fields
316 return SkString();
317 }
318
has_TR2() const319 bool SkPdfGraphicsStateDictionary::has_TR2() const {
320 return get("TR2", "") != NULL;
321 }
322
isHTADictionary(SkPdfNativeDoc * doc)323 bool SkPdfGraphicsStateDictionary::isHTADictionary(SkPdfNativeDoc* doc) {
324 SkPdfNativeObject* ret = get("HT", "");
325 if (doc) {ret = doc->resolveReference(ret);}
326 return ret != NULL && ret->isDictionary();
327 }
328
getHTAsDictionary(SkPdfNativeDoc * doc)329 SkPdfDictionary* SkPdfGraphicsStateDictionary::getHTAsDictionary(SkPdfNativeDoc* doc) {
330 SkPdfNativeObject* ret = get("HT", "");
331 if (doc) {ret = doc->resolveReference(ret);}
332 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
333 // TODO(edisonn): warn about missing default value for optional fields
334 return NULL;
335 }
336
isHTAStream(SkPdfNativeDoc * doc)337 bool SkPdfGraphicsStateDictionary::isHTAStream(SkPdfNativeDoc* doc) {
338 SkPdfNativeObject* ret = get("HT", "");
339 if (doc) {ret = doc->resolveReference(ret);}
340 return ret != NULL && ret->hasStream();
341 }
342
getHTAsStream(SkPdfNativeDoc * doc)343 SkPdfStream* SkPdfGraphicsStateDictionary::getHTAsStream(SkPdfNativeDoc* doc) {
344 SkPdfNativeObject* ret = get("HT", "");
345 if (doc) {ret = doc->resolveReference(ret);}
346 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream();
347 // TODO(edisonn): warn about missing default value for optional fields
348 return NULL;
349 }
350
isHTAName(SkPdfNativeDoc * doc)351 bool SkPdfGraphicsStateDictionary::isHTAName(SkPdfNativeDoc* doc) {
352 SkPdfNativeObject* ret = get("HT", "");
353 if (doc) {ret = doc->resolveReference(ret);}
354 return ret != NULL && ret->isName();
355 }
356
getHTAsName(SkPdfNativeDoc * doc)357 SkString SkPdfGraphicsStateDictionary::getHTAsName(SkPdfNativeDoc* doc) {
358 SkPdfNativeObject* ret = get("HT", "");
359 if (doc) {ret = doc->resolveReference(ret);}
360 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
361 // TODO(edisonn): warn about missing default value for optional fields
362 return SkString();
363 }
364
has_HT() const365 bool SkPdfGraphicsStateDictionary::has_HT() const {
366 return get("HT", "") != NULL;
367 }
368
FL(SkPdfNativeDoc * doc)369 double SkPdfGraphicsStateDictionary::FL(SkPdfNativeDoc* doc) {
370 SkPdfNativeObject* ret = get("FL", "");
371 if (doc) {ret = doc->resolveReference(ret);}
372 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
373 // TODO(edisonn): warn about missing default value for optional fields
374 return 0;
375 }
376
has_FL() const377 bool SkPdfGraphicsStateDictionary::has_FL() const {
378 return get("FL", "") != NULL;
379 }
380
SM(SkPdfNativeDoc * doc)381 double SkPdfGraphicsStateDictionary::SM(SkPdfNativeDoc* doc) {
382 SkPdfNativeObject* ret = get("SM", "");
383 if (doc) {ret = doc->resolveReference(ret);}
384 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
385 // TODO(edisonn): warn about missing default value for optional fields
386 return 0;
387 }
388
has_SM() const389 bool SkPdfGraphicsStateDictionary::has_SM() const {
390 return get("SM", "") != NULL;
391 }
392
SA(SkPdfNativeDoc * doc)393 bool SkPdfGraphicsStateDictionary::SA(SkPdfNativeDoc* doc) {
394 SkPdfNativeObject* ret = get("SA", "");
395 if (doc) {ret = doc->resolveReference(ret);}
396 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
397 // TODO(edisonn): warn about missing default value for optional fields
398 return false;
399 }
400
has_SA() const401 bool SkPdfGraphicsStateDictionary::has_SA() const {
402 return get("SA", "") != NULL;
403 }
404
isBMAName(SkPdfNativeDoc * doc)405 bool SkPdfGraphicsStateDictionary::isBMAName(SkPdfNativeDoc* doc) {
406 SkPdfNativeObject* ret = get("BM", "");
407 if (doc) {ret = doc->resolveReference(ret);}
408 return ret != NULL && ret->isName();
409 }
410
getBMAsName(SkPdfNativeDoc * doc)411 SkString SkPdfGraphicsStateDictionary::getBMAsName(SkPdfNativeDoc* doc) {
412 SkPdfNativeObject* ret = get("BM", "");
413 if (doc) {ret = doc->resolveReference(ret);}
414 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
415 // TODO(edisonn): warn about missing default value for optional fields
416 return SkString();
417 }
418
isBMAArray(SkPdfNativeDoc * doc)419 bool SkPdfGraphicsStateDictionary::isBMAArray(SkPdfNativeDoc* doc) {
420 SkPdfNativeObject* ret = get("BM", "");
421 if (doc) {ret = doc->resolveReference(ret);}
422 return ret != NULL && ret->isArray();
423 }
424
getBMAsArray(SkPdfNativeDoc * doc)425 SkPdfArray* SkPdfGraphicsStateDictionary::getBMAsArray(SkPdfNativeDoc* doc) {
426 SkPdfNativeObject* ret = get("BM", "");
427 if (doc) {ret = doc->resolveReference(ret);}
428 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
429 // TODO(edisonn): warn about missing default value for optional fields
430 return NULL;
431 }
432
has_BM() const433 bool SkPdfGraphicsStateDictionary::has_BM() const {
434 return get("BM", "") != NULL;
435 }
436
isSMaskADictionary(SkPdfNativeDoc * doc)437 bool SkPdfGraphicsStateDictionary::isSMaskADictionary(SkPdfNativeDoc* doc) {
438 SkPdfNativeObject* ret = get("SMask", "");
439 if (doc) {ret = doc->resolveReference(ret);}
440 return ret != NULL && ret->isDictionary();
441 }
442
getSMaskAsDictionary(SkPdfNativeDoc * doc)443 SkPdfDictionary* SkPdfGraphicsStateDictionary::getSMaskAsDictionary(SkPdfNativeDoc* doc) {
444 SkPdfNativeObject* ret = get("SMask", "");
445 if (doc) {ret = doc->resolveReference(ret);}
446 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
447 // TODO(edisonn): warn about missing default value for optional fields
448 return NULL;
449 }
450
isSMaskAName(SkPdfNativeDoc * doc)451 bool SkPdfGraphicsStateDictionary::isSMaskAName(SkPdfNativeDoc* doc) {
452 SkPdfNativeObject* ret = get("SMask", "");
453 if (doc) {ret = doc->resolveReference(ret);}
454 return ret != NULL && ret->isName();
455 }
456
getSMaskAsName(SkPdfNativeDoc * doc)457 SkString SkPdfGraphicsStateDictionary::getSMaskAsName(SkPdfNativeDoc* doc) {
458 SkPdfNativeObject* ret = get("SMask", "");
459 if (doc) {ret = doc->resolveReference(ret);}
460 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2();
461 // TODO(edisonn): warn about missing default value for optional fields
462 return SkString();
463 }
464
has_SMask() const465 bool SkPdfGraphicsStateDictionary::has_SMask() const {
466 return get("SMask", "") != NULL;
467 }
468
CA(SkPdfNativeDoc * doc)469 double SkPdfGraphicsStateDictionary::CA(SkPdfNativeDoc* doc) {
470 SkPdfNativeObject* ret = get("CA", "");
471 if (doc) {ret = doc->resolveReference(ret);}
472 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
473 // TODO(edisonn): warn about missing default value for optional fields
474 return 0;
475 }
476
has_CA() const477 bool SkPdfGraphicsStateDictionary::has_CA() const {
478 return get("CA", "") != NULL;
479 }
480
ca(SkPdfNativeDoc * doc)481 double SkPdfGraphicsStateDictionary::ca(SkPdfNativeDoc* doc) {
482 SkPdfNativeObject* ret = get("ca", "");
483 if (doc) {ret = doc->resolveReference(ret);}
484 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->numberValue();
485 // TODO(edisonn): warn about missing default value for optional fields
486 return 0;
487 }
488
has_ca() const489 bool SkPdfGraphicsStateDictionary::has_ca() const {
490 return get("ca", "") != NULL;
491 }
492
AIS(SkPdfNativeDoc * doc)493 bool SkPdfGraphicsStateDictionary::AIS(SkPdfNativeDoc* doc) {
494 SkPdfNativeObject* ret = get("AIS", "");
495 if (doc) {ret = doc->resolveReference(ret);}
496 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
497 // TODO(edisonn): warn about missing default value for optional fields
498 return false;
499 }
500
has_AIS() const501 bool SkPdfGraphicsStateDictionary::has_AIS() const {
502 return get("AIS", "") != NULL;
503 }
504
TK(SkPdfNativeDoc * doc)505 bool SkPdfGraphicsStateDictionary::TK(SkPdfNativeDoc* doc) {
506 SkPdfNativeObject* ret = get("TK", "");
507 if (doc) {ret = doc->resolveReference(ret);}
508 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
509 // TODO(edisonn): warn about missing default value for optional fields
510 return false;
511 }
512
has_TK() const513 bool SkPdfGraphicsStateDictionary::has_TK() const {
514 return get("TK", "") != NULL;
515 }
516