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 "SkPdfTransparencyGroupDictionary_autogen.h" 9 #include "SkPdfNativeDoc.h" 10 11 SkString SkPdfTransparencyGroupDictionary::S(SkPdfNativeDoc* doc) { 12 SkPdfNativeObject* ret = get("S", ""); 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 required field, assert for known good pdfs 16 return SkString(); 17 } 18 19 bool SkPdfTransparencyGroupDictionary::has_S() const { 20 return get("S", "") != NULL; 21 } 22 23 bool SkPdfTransparencyGroupDictionary::isCSAName(SkPdfNativeDoc* doc) { 24 SkPdfNativeObject* ret = get("CS", ""); 25 if (doc) {ret = doc->resolveReference(ret);} 26 return ret != NULL && ret->isName(); 27 } 28 29 SkString SkPdfTransparencyGroupDictionary::getCSAsName(SkPdfNativeDoc* doc) { 30 SkPdfNativeObject* ret = get("CS", ""); 31 if (doc) {ret = doc->resolveReference(ret);} 32 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2(); 33 // TODO(edisonn): warn about missing default value for optional fields 34 return SkString(); 35 } 36 37 bool SkPdfTransparencyGroupDictionary::isCSAArray(SkPdfNativeDoc* doc) { 38 SkPdfNativeObject* ret = get("CS", ""); 39 if (doc) {ret = doc->resolveReference(ret);} 40 return ret != NULL && ret->isArray(); 41 } 42 43 SkPdfArray* SkPdfTransparencyGroupDictionary::getCSAsArray(SkPdfNativeDoc* doc) { 44 SkPdfNativeObject* ret = get("CS", ""); 45 if (doc) {ret = doc->resolveReference(ret);} 46 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret; 47 // TODO(edisonn): warn about missing default value for optional fields 48 return NULL; 49 } 50 51 bool SkPdfTransparencyGroupDictionary::has_CS() const { 52 return get("CS", "") != NULL; 53 } 54 55 bool SkPdfTransparencyGroupDictionary::I(SkPdfNativeDoc* doc) { 56 SkPdfNativeObject* ret = get("I", ""); 57 if (doc) {ret = doc->resolveReference(ret);} 58 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue(); 59 // TODO(edisonn): warn about missing default value for optional fields 60 return false; 61 } 62 63 bool SkPdfTransparencyGroupDictionary::has_I() const { 64 return get("I", "") != NULL; 65 } 66 67 bool SkPdfTransparencyGroupDictionary::K(SkPdfNativeDoc* doc) { 68 SkPdfNativeObject* ret = get("K", ""); 69 if (doc) {ret = doc->resolveReference(ret);} 70 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue(); 71 // TODO(edisonn): warn about missing default value for optional fields 72 return false; 73 } 74 75 bool SkPdfTransparencyGroupDictionary::has_K() const { 76 return get("K", "") != NULL; 77 } 78