OLD | NEW |
(Empty) | |
| 1 #ifndef __DEFINED__SkPdfType3ShadingDictionary |
| 2 #define __DEFINED__SkPdfType3ShadingDictionary |
| 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 3 shading dictionary |
| 10 class SkPdfType3ShadingDictionary : public SkPdfShadingDictionary { |
| 11 public: |
| 12 virtual SkPdfObjectType getType() const { return kType3ShadingDictionary_SkPdf
ObjectType;} |
| 13 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType3Sh
adingDictionary_SkPdfObjectType + 1);} |
| 14 public: |
| 15 virtual SkPdfType3ShadingDictionary* asType3ShadingDictionary() {return this;} |
| 16 virtual const SkPdfType3ShadingDictionary* asType3ShadingDictionary() 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 SkPdfType2ShadingDictionary* asType2ShadingDictionary() {return NULL;} |
| 23 virtual const SkPdfType2ShadingDictionary* asType2ShadingDictionary() 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 SkPdfType3ShadingDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfO
bject* podofoObj = NULL) : SkPdfShadingDictionary(podofoDoc, podofoObj) {} |
| 38 |
| 39 SkPdfType3ShadingDictionary(const SkPdfType3ShadingDictionary& from) : SkPdfSh
adingDictionary(from.fPodofoDoc, from.fPodofoObj) {} |
| 40 |
| 41 virtual bool valid() const {return true;} |
| 42 |
| 43 SkPdfType3ShadingDictionary& operator=(const SkPdfType3ShadingDictionary& from
) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; retur
n *this;} |
| 44 |
| 45 /** (Required) An array of six numbers [ x0 y0 r0 x1 y1 r1 ] specifying the cent
ers and |
| 46 * radii of the starting and ending circles, expressed in the shading's target
coor- |
| 47 * dinate space. The radii r0 and r1 must both be greater than or equal to 0. I
f one |
| 48 * radius is 0, the corresponding circle is treated as a point; if both are 0,
nothing is |
| 49 * painted. |
| 50 **/ |
| 51 bool has_Coords() const { |
| 52 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Coord
s", "", NULL)); |
| 53 } |
| 54 |
| 55 SkPdfArray* Coords() const { |
| 56 SkPdfArray* ret; |
| 57 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Coords", "
", &ret)) return ret; |
| 58 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 59 return NULL; |
| 60 } |
| 61 |
| 62 /** (Optional) An array of two numbers [ t0 t1 ] specifying the limiting values
of a |
| 63 * parametric variable t. The variable is considered to vary linearly between t
hese |
| 64 * two values as the color gradient varies between the starting and ending circ
les. |
| 65 * The variable t becomes the input argument to the color function(s). Default |
| 66 * value: [0.0 1.0]. |
| 67 **/ |
| 68 bool has_Domain() const { |
| 69 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Domai
n", "", NULL)); |
| 70 } |
| 71 |
| 72 SkPdfArray* Domain() const { |
| 73 SkPdfArray* ret; |
| 74 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Domain", "
", &ret)) return ret; |
| 75 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 76 return NULL; |
| 77 } |
| 78 |
| 79 /** (Required) A 1-in, n-out function or an array of n 1-in, 1-out functions (wh
ere n |
| 80 * is the number of color components in the shading dictionary's color space).
The |
| 81 * function(s) are called with values of the parametric variable t in the domai
n de- |
| 82 * fined by the shading dictionary's Domain entry. Each function's domain must
be |
| 83 * a superset of that of the shading dictionary. If the value returned by the f
unction |
| 84 * for a given color component is out of range, it will be adjusted to the near
est |
| 85 * valid value. |
| 86 **/ |
| 87 bool has_Function() const { |
| 88 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Funct
ion", "", NULL)); |
| 89 } |
| 90 |
| 91 SkPdfFunction Function() const { |
| 92 SkPdfFunction ret; |
| 93 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Functio
n", "", &ret)) return ret; |
| 94 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 95 return SkPdfFunction(); |
| 96 } |
| 97 |
| 98 /** (Optional) An array of two boolean values specifying whether to extend the |
| 99 * shading beyond the starting and ending circles, respectively. Default value: |
| 100 * [false false]. |
| 101 **/ |
| 102 bool has_Extend() const { |
| 103 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Exten
d", "", NULL)); |
| 104 } |
| 105 |
| 106 SkPdfArray* Extend() const { |
| 107 SkPdfArray* ret; |
| 108 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Extend", "
", &ret)) return ret; |
| 109 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
| 110 return NULL; |
| 111 } |
| 112 |
| 113 }; |
| 114 |
| 115 #endif // __DEFINED__SkPdfType3ShadingDictionary |
OLD | NEW |