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