OLD | NEW |
(Empty) | |
| 1 #ifndef __DEFINED__SkPdfType2ShadingDictionary |
| 2 #define __DEFINED__SkPdfType2ShadingDictionary |
| 3 |
| 4 #include "SkPdfUtils.h" |
| 5 #include "SkPdfEnums_autogen.h" |
| 6 #include "SkPdfArray_autogen.h" |
| 7 #include "SkPdfShadingDictionary_autogen.h" |
| 8 |
| 9 // Additional entries specific to a type 2 shading dictionary |
| 10 class SkPdfType2ShadingDictionary : public SkPdfShadingDictionary { |
| 11 public: |
| 12 virtual SkPdfObjectType getType() const { return kType2ShadingDictionary_SkPdf
ObjectType;} |
| 13 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType2Sh
adingDictionary_SkPdfObjectType + 1);} |
| 14 public: |
| 15 virtual SkPdfType2ShadingDictionary* asType2ShadingDictionary() {return this;} |
| 16 virtual const SkPdfType2ShadingDictionary* asType2ShadingDictionary() const {r
eturn this;} |
| 17 |
| 18 private: |
| 19 virtual SkPdfType1ShadingDictionary* asType1ShadingDictionary() {return NULL;} |
| 20 virtual const SkPdfType1ShadingDictionary* asType1ShadingDictionary() const {r
eturn NULL;} |
| 21 |
| 22 virtual SkPdfType3ShadingDictionary* asType3ShadingDictionary() {return NULL;} |
| 23 virtual const SkPdfType3ShadingDictionary* asType3ShadingDictionary() const {r
eturn NULL;} |
| 24 |
| 25 virtual SkPdfType4ShadingDictionary* asType4ShadingDictionary() {return NULL;} |
| 26 virtual const SkPdfType4ShadingDictionary* asType4ShadingDictionary() const {r
eturn NULL;} |
| 27 |
| 28 virtual SkPdfType5ShadingDictionary* asType5ShadingDictionary() {return NULL;} |
| 29 virtual const SkPdfType5ShadingDictionary* asType5ShadingDictionary() const {r
eturn NULL;} |
| 30 |
| 31 virtual SkPdfType6ShadingDictionary* asType6ShadingDictionary() {return NULL;} |
| 32 virtual const SkPdfType6ShadingDictionary* asType6ShadingDictionary() const {r
eturn NULL;} |
| 33 |
| 34 public: |
| 35 private: |
| 36 public: |
| 37 SkPdfType2ShadingDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfO
bject* podofoObj = NULL) : SkPdfShadingDictionary(podofoDoc, podofoObj) {} |
| 38 |
| 39 SkPdfType2ShadingDictionary(const SkPdfType2ShadingDictionary& from) : SkPdfSh
adingDictionary(from.fPodofoDoc, from.fPodofoObj) {} |
| 40 |
| 41 virtual bool valid() const {return true;} |
| 42 |
| 43 SkPdfType2ShadingDictionary& operator=(const SkPdfType2ShadingDictionary& from
) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; retur
n *this;} |
| 44 |
| 45 /** (Required) An array of four numbers [ x0 y0 x1 y1 ] specifying the starting
and |
| 46 * ending coordinates of the axis, expressed in the shading's target coordinate |
| 47 * space. |
| 48 **/ |
| 49 bool has_Coords() const { |
| 50 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Coord
s", "", NULL)); |
| 51 } |
| 52 |
| 53 SkPdfArray* Coords() const { |
| 54 SkPdfArray* ret; |
| 55 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Coords", "
", &ret)) return ret; |
| 56 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 57 return NULL; |
| 58 } |
| 59 |
| 60 /** (Optional) An array of two numbers [ t0 t1 ] specifying the limiting values
of a |
| 61 * parametric variable t. The variable is considered to vary linearly between t
hese |
| 62 * two values as the color gradient varies between the starting and ending poin
ts of |
| 63 * the axis. The variable t becomes the input argument to the color function(s)
. |
| 64 * Default value: [0.0 1.0]. |
| 65 **/ |
| 66 bool has_Domain() const { |
| 67 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Domai
n", "", NULL)); |
| 68 } |
| 69 |
| 70 SkPdfArray* Domain() const { |
| 71 SkPdfArray* ret; |
| 72 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Domain", "
", &ret)) return ret; |
| 73 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 74 return NULL; |
| 75 } |
| 76 |
| 77 /** (Required) A 1-in, n-out function or an array of n 1-in, 1-out functions (wh
ere n |
| 78 * is the number of color components in the shading dictionary's color space).
The |
| 79 * function(s) are called with values of the parametric variable t in the domai
n de- |
| 80 * fined by the Domain entry. Each function's domain must be a superset of that
of |
| 81 * the shading dictionary. If the value returned by the function for a given co
lor |
| 82 * component is out of range, it will be adjusted to the nearest valid value. |
| 83 **/ |
| 84 bool has_Function() const { |
| 85 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Funct
ion", "", NULL)); |
| 86 } |
| 87 |
| 88 SkPdfFunction Function() const { |
| 89 SkPdfFunction ret; |
| 90 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Functio
n", "", &ret)) return ret; |
| 91 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 92 return SkPdfFunction(); |
| 93 } |
| 94 |
| 95 /** (Optional) An array of two boolean values specifying whether to extend the |
| 96 * shading beyond the starting and ending points of the axis, respectively. Def
ault |
| 97 * value: [false false]. |
| 98 **/ |
| 99 bool has_Extend() const { |
| 100 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Exten
d", "", NULL)); |
| 101 } |
| 102 |
| 103 SkPdfArray* Extend() const { |
| 104 SkPdfArray* ret; |
| 105 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Extend", "
", &ret)) return ret; |
| 106 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 107 return NULL; |
| 108 } |
| 109 |
| 110 }; |
| 111 |
| 112 #endif // __DEFINED__SkPdfType2ShadingDictionary |
OLD | NEW |