1cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com/* 2cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com * Copyright 2013 Google Inc. 38cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com 4cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com * Use of this source code is governed by a BSD-style license that can be 5cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com * found in the LICENSE file. 6cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com */ 78cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com 8cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com#include "SkPdfType2ShadingDictionary_autogen.h" 98cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com#include "SkPdfNativeDoc.h" 10cf2cfa174ca878c144e17e9fc60ca8e9070d7dededisonn@google.com 118cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.comSkPdfArray* SkPdfType2ShadingDictionary::Coords(SkPdfNativeDoc* doc) { 128cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com SkPdfNativeObject* ret = get("Coords", ""); 138cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com if (doc) {ret = doc->resolveReference(ret);} 148cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret; 158cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com // TODO(edisonn): warn about missing required field, assert for known good pdfs 168cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com return NULL; 178cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com} 188cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com 198cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.combool SkPdfType2ShadingDictionary::has_Coords() const { 208cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com return get("Coords", "") != NULL; 218cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com} 228cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com 238cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.comSkPdfArray* SkPdfType2ShadingDictionary::Domain(SkPdfNativeDoc* doc) { 248cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com SkPdfNativeObject* ret = get("Domain", ""); 258cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com if (doc) {ret = doc->resolveReference(ret);} 268cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret; 278cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com // TODO(edisonn): warn about missing default value for optional fields 288cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com return NULL; 298cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com} 308cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com 318cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.combool SkPdfType2ShadingDictionary::has_Domain() const { 328cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com return get("Domain", "") != NULL; 338cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com} 348cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com 358cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.comSkPdfFunction SkPdfType2ShadingDictionary::Function(SkPdfNativeDoc* doc) { 368cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com SkPdfNativeObject* ret = get("Function", ""); 378cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com if (doc) {ret = doc->resolveReference(ret);} 388cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com if ((ret != NULL && ret->isFunction()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->functionValue(); 398cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com // TODO(edisonn): warn about missing required field, assert for known good pdfs 408cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com return SkPdfFunction(); 418cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com} 428cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com 438cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.combool SkPdfType2ShadingDictionary::has_Function() const { 448cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com return get("Function", "") != NULL; 458cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com} 468cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com 478cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.comSkPdfArray* SkPdfType2ShadingDictionary::Extend(SkPdfNativeDoc* doc) { 488cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com SkPdfNativeObject* ret = get("Extend", ""); 498cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com if (doc) {ret = doc->resolveReference(ret);} 508cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret; 518cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com // TODO(edisonn): warn about missing default value for optional fields 528cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com return NULL; 538cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com} 548cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com 558cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.combool SkPdfType2ShadingDictionary::has_Extend() const { 568cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com return get("Extend", "") != NULL; 578cee797901763ab0922eb9ef484cfdcbc94bee54edisonn@google.com} 58