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