OLD | NEW |
| (Empty) |
1 #ifndef __DEFINED__SkPdfType6ShadingDictionary | |
2 #define __DEFINED__SkPdfType6ShadingDictionary | |
3 | |
4 #include "SkPdfEnums_autogen.h" | |
5 #include "SkPdfArray_autogen.h" | |
6 #include "SkPdfShadingDictionary_autogen.h" | |
7 | |
8 // Additional entries specific to a type 6 shading dictionary | |
9 class SkPdfType6ShadingDictionary : public SkPdfShadingDictionary { | |
10 public: | |
11 virtual SkPdfObjectType getType() const { return kType6ShadingDictionary_SkPdf
ObjectType;} | |
12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType6Sh
adingDictionary_SkPdfObjectType + 1);} | |
13 public: | |
14 virtual SkPdfType6ShadingDictionary* asType6ShadingDictionary() {return this;} | |
15 virtual const SkPdfType6ShadingDictionary* asType6ShadingDictionary() 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 SkPdfType2ShadingDictionary* asType2ShadingDictionary() {return NULL;} | |
22 virtual const SkPdfType2ShadingDictionary* asType2ShadingDictionary() const {r
eturn NULL;} | |
23 | |
24 virtual SkPdfType3ShadingDictionary* asType3ShadingDictionary() {return NULL;} | |
25 virtual const SkPdfType3ShadingDictionary* asType3ShadingDictionary() const {r
eturn NULL;} | |
26 | |
27 virtual SkPdfType4ShadingDictionary* asType4ShadingDictionary() {return NULL;} | |
28 virtual const SkPdfType4ShadingDictionary* asType4ShadingDictionary() const {r
eturn NULL;} | |
29 | |
30 virtual SkPdfType5ShadingDictionary* asType5ShadingDictionary() {return NULL;} | |
31 virtual const SkPdfType5ShadingDictionary* asType5ShadingDictionary() const {r
eturn NULL;} | |
32 | |
33 public: | |
34 private: | |
35 public: | |
36 SkPdfType6ShadingDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfO
bject* podofoObj = NULL) : SkPdfShadingDictionary(podofoDoc, podofoObj) {} | |
37 | |
38 virtual bool valid() const {return true;} | |
39 | |
40 SkPdfType6ShadingDictionary& operator=(const SkPdfType6ShadingDictionary& from
) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; retur
n *this;} | |
41 | |
42 /** (Required) The number of bits used to represent each geometric coordi- | |
43 * nate. Valid values are 1, 2, 4, 8, 12, 16, 24, and 32. | |
44 **/ | |
45 bool has_BitsPerCoordinate() const { | |
46 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BitsP
erCoordinate", "", NULL)); | |
47 } | |
48 | |
49 long BitsPerCoordinate() const { | |
50 long ret; | |
51 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BitsPerCoor
dinate", "", &ret)) return ret; | |
52 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
53 return 0; | |
54 } | |
55 | |
56 /** (Required) The number of bits used to represent each color component. | |
57 * Valid values are 1, 2, 4, 8, 12, and 16. | |
58 **/ | |
59 bool has_BitsPerComponent() const { | |
60 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BitsP
erComponent", "", NULL)); | |
61 } | |
62 | |
63 long BitsPerComponent() const { | |
64 long ret; | |
65 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BitsPerComp
onent", "", &ret)) return ret; | |
66 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
67 return 0; | |
68 } | |
69 | |
70 /** (Required) The number of bits used to represent the edge flag for each | |
71 * patch (see below). Valid values of BitsPerFlag are 2, 4, and 8, but only the | |
72 * least significant 2 bits in each flag value are used. Valid values for the e
dge | |
73 * flag itself are 0, 1, 2, and 3. | |
74 **/ | |
75 bool has_BitsPerFlag() const { | |
76 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BitsP
erFlag", "", NULL)); | |
77 } | |
78 | |
79 long BitsPerFlag() const { | |
80 long ret; | |
81 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BitsPerFlag
", "", &ret)) return ret; | |
82 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
83 return 0; | |
84 } | |
85 | |
86 /** (Required) An array of numbers specifying how to map coordinates and | |
87 * color components into the appropriate ranges of values. The decoding | |
88 * method is similar to that used in image dictionaries (see "Decode Arrays" | |
89 * on page 271). The ranges are specified as follows: | |
90 * [ xmin xmax ymin ymax c1,min c1,max ... cn,min cn,max ] | |
91 * Note that only one pair of c values should be specified if a Function entry | |
92 * is present. | |
93 **/ | |
94 bool has_Decode() const { | |
95 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Decod
e", "", NULL)); | |
96 } | |
97 | |
98 SkPdfArray Decode() const { | |
99 SkPdfArray ret; | |
100 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Decode", "
", &ret)) return ret; | |
101 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
102 return SkPdfArray(); | |
103 } | |
104 | |
105 /** (Optional) A 1-in, n-out function or an array of n 1-in, 1-out functions | |
106 * (where n is the number of color components in the shading dictionary's | |
107 * color space). If this entry is present, the color data for each vertex must
be | |
108 * specified by a single parametric variable rather than by n separate color | |
109 * components; the designated function(s) will be called with each interpo- | |
110 * lated value of the parametric variable to determine the actual color at each | |
111 * point. Each input value will be forced into the range interval specified for | |
112 * the corresponding color component in the shading dictionary's Decode | |
113 * array. Each function's domain must be a superset of that interval. If the | |
114 * value returned by the function for a given color component is out of | |
115 * range, it will be adjusted to the nearest valid value. | |
116 * This entry may not be used with an Indexed color space. | |
117 **/ | |
118 bool has_Function() const { | |
119 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Funct
ion", "", NULL)); | |
120 } | |
121 | |
122 SkPdfFunction Function() const { | |
123 SkPdfFunction ret; | |
124 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Functio
n", "", &ret)) return ret; | |
125 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
126 return SkPdfFunction(); | |
127 } | |
128 | |
129 }; | |
130 | |
131 #endif // __DEFINED__SkPdfType6ShadingDictionary | |
OLD | NEW |