OLD | NEW |
| (Empty) |
1 #ifndef __DEFINED__SkPdfType1ShadingDictionary | |
2 #define __DEFINED__SkPdfType1ShadingDictionary | |
3 | |
4 #include "SkPdfEnums_autogen.h" | |
5 #include "SkPdfArray_autogen.h" | |
6 #include "SkPdfShadingDictionary_autogen.h" | |
7 | |
8 // Additional entries specific to a type 1 shading dictionary | |
9 class SkPdfType1ShadingDictionary : public SkPdfShadingDictionary { | |
10 public: | |
11 virtual SkPdfObjectType getType() const { return kType1ShadingDictionary_SkPdf
ObjectType;} | |
12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType1Sh
adingDictionary_SkPdfObjectType + 1);} | |
13 public: | |
14 virtual SkPdfType1ShadingDictionary* asType1ShadingDictionary() {return this;} | |
15 virtual const SkPdfType1ShadingDictionary* asType1ShadingDictionary() const {r
eturn this;} | |
16 | |
17 private: | |
18 virtual SkPdfType2ShadingDictionary* asType2ShadingDictionary() {return NULL;} | |
19 virtual const SkPdfType2ShadingDictionary* asType2ShadingDictionary() 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 SkPdfType1ShadingDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfO
bject* podofoObj = NULL) : SkPdfShadingDictionary(podofoDoc, podofoObj) {} | |
37 | |
38 virtual bool valid() const {return true;} | |
39 | |
40 SkPdfType1ShadingDictionary& operator=(const SkPdfType1ShadingDictionary& from
) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; retur
n *this;} | |
41 | |
42 /** (Optional) An array of four numbers [ xmin xmax ymin ymax ] specifying the r
ec- | |
43 * tangular domain of coordinates over which the color function(s) are defined. | |
44 * Default value: [0.0 1.0 0.0 1.0]. | |
45 **/ | |
46 bool has_Domain() const { | |
47 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Domai
n", "", NULL)); | |
48 } | |
49 | |
50 SkPdfArray Domain() const { | |
51 SkPdfArray ret; | |
52 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Domain", "
", &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 six numbers specifying a transformation matrix mappin
g | |
58 * the coordinate space specified by the Domain entry into the shading's target
co- | |
59 * ordinate space. For example, to map the domain rectangle [0.0 1.0 0.0 1.0] t
o a | |
60 * 1-inch square with lower-left corner at coordinates (100, 100) in default us
er | |
61 * space, the Matrix value would be [72 0 0 72 100 100]. Default value: the ide
n- | |
62 * tity matrix [1 0 0 1 0 0]. | |
63 **/ | |
64 bool has_Matrix() const { | |
65 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Matri
x", "", NULL)); | |
66 } | |
67 | |
68 SkPdfArray Matrix() const { | |
69 SkPdfArray ret; | |
70 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Matrix", "
", &ret)) return ret; | |
71 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
72 return SkPdfArray(); | |
73 } | |
74 | |
75 /** (Required) A 2-in, n-out function or an array of n 2-in, 1-out functions (wh
ere n | |
76 * is the number of color components in the shading dictionary's color space). | |
77 * Each function's domain must be a superset of that of the shading dictionary.
If | |
78 * the value returned by the function for a given color component is out of ran
ge, it | |
79 * 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 }; | |
93 | |
94 #endif // __DEFINED__SkPdfType1ShadingDictionary | |
OLD | NEW |