OLD | NEW |
1 #ifndef __DEFINED__SkPdfShadingDictionary | 1 #ifndef __DEFINED__SkPdfShadingDictionary |
2 #define __DEFINED__SkPdfShadingDictionary | 2 #define __DEFINED__SkPdfShadingDictionary |
3 | 3 |
4 #include "SkPdfEnums_autogen.h" | 4 #include "SkPdfEnums_autogen.h" |
5 #include "SkPdfArray_autogen.h" | 5 #include "SkPdfArray_autogen.h" |
6 #include "SkPdfDictionary_autogen.h" | 6 #include "SkPdfDictionary_autogen.h" |
7 | 7 |
| 8 // Entries common to all shading dictionaries |
8 class SkPdfShadingDictionary : public SkPdfDictionary { | 9 class SkPdfShadingDictionary : public SkPdfDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kShadingDictionary_SkPdfObjec
tType;} | 11 virtual SkPdfObjectType getType() const { return kShadingDictionary_SkPdfObjec
tType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return kShadingDictionary__End_Sk
PdfObjectType;} | 12 virtual SkPdfObjectType getTypeEnd() const { return kShadingDictionary__End_Sk
PdfObjectType;} |
12 public: | 13 public: |
13 virtual SkPdfShadingDictionary* asShadingDictionary() {return this;} | 14 virtual SkPdfShadingDictionary* asShadingDictionary() {return this;} |
14 virtual const SkPdfShadingDictionary* asShadingDictionary() const {return this
;} | 15 virtual const SkPdfShadingDictionary* asShadingDictionary() const {return this
;} |
15 | 16 |
16 private: | 17 private: |
17 virtual SkPdfALinkAnnotationDictionary* asALinkAnnotationDictionary() {return
NULL;} | 18 virtual SkPdfALinkAnnotationDictionary* asALinkAnnotationDictionary() {return
NULL;} |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 | 497 |
497 public: | 498 public: |
498 private: | 499 private: |
499 public: | 500 public: |
500 SkPdfShadingDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObject
* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} | 501 SkPdfShadingDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObject
* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} |
501 | 502 |
502 virtual bool valid() const {return true;} | 503 virtual bool valid() const {return true;} |
503 | 504 |
504 SkPdfShadingDictionary& operator=(const SkPdfShadingDictionary& from) {this->f
PodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;} | 505 SkPdfShadingDictionary& operator=(const SkPdfShadingDictionary& from) {this->f
PodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;} |
505 | 506 |
| 507 /** (Required) The shading type: |
| 508 * 1 Function-based shading |
| 509 * 2 Axial shading |
| 510 * 3 Radial shading |
| 511 * 4 Free-form Gouraud-shaded triangle mesh |
| 512 * 5 Lattice-form Gouraud-shaded triangle mesh |
| 513 * 6 Coons patch mesh |
| 514 * 7 Tensor-product patch mesh |
| 515 **/ |
| 516 bool has_ShadingType() const { |
| 517 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Shadi
ngType", "", NULL)); |
| 518 } |
| 519 |
506 long ShadingType() const { | 520 long ShadingType() const { |
507 long ret; | 521 long ret; |
508 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ShadingType
", "", &ret)) return ret; | 522 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ShadingType
", "", &ret)) return ret; |
509 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 523 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
510 return 0; | 524 return 0; |
511 } | 525 } |
512 | 526 |
| 527 /** (Required) The color space in which color values are expressed. This may be |
| 528 * any device, CIE-based, or special color space except a Pattern space. See |
| 529 * "Color Space: Special Considerations," below, for further information. |
| 530 **/ |
| 531 bool has_ColorSpace() const { |
| 532 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Color
Space", "", NULL)); |
| 533 } |
| 534 |
513 bool isColorSpaceAName() const { | 535 bool isColorSpaceAName() const { |
514 SkPdfObject* ret = NULL; | 536 SkPdfObject* ret = NULL; |
515 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpa
ce", "", &ret)) return false; | 537 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpa
ce", "", &ret)) return false; |
516 return ret->podofo()->GetDataType() == ePdfDataType_Name; | 538 return ret->podofo()->GetDataType() == ePdfDataType_Name; |
517 } | 539 } |
518 | 540 |
519 std::string getColorSpaceAsName() const { | 541 std::string getColorSpaceAsName() const { |
520 std::string ret = ""; | 542 std::string ret = ""; |
521 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpace"
, "", &ret)) return ret; | 543 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpace"
, "", &ret)) return ret; |
522 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 544 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
523 return ""; | 545 return ""; |
524 } | 546 } |
525 | 547 |
526 bool isColorSpaceAArray() const { | 548 bool isColorSpaceAArray() const { |
527 SkPdfObject* ret = NULL; | 549 SkPdfObject* ret = NULL; |
528 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpa
ce", "", &ret)) return false; | 550 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpa
ce", "", &ret)) return false; |
529 return ret->podofo()->GetDataType() == ePdfDataType_Array; | 551 return ret->podofo()->GetDataType() == ePdfDataType_Array; |
530 } | 552 } |
531 | 553 |
532 SkPdfArray getColorSpaceAsArray() const { | 554 SkPdfArray getColorSpaceAsArray() const { |
533 SkPdfArray ret = SkPdfArray(); | 555 SkPdfArray ret = SkPdfArray(); |
534 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpace
", "", &ret)) return ret; | 556 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ColorSpace
", "", &ret)) return ret; |
535 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 557 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
536 return SkPdfArray(); | 558 return SkPdfArray(); |
537 } | 559 } |
538 | 560 |
| 561 /** (Optional) An array of color components appropriate to the color space, |
| 562 * specifying a single background color value. If present, this color is used b
e- |
| 563 * fore any painting operation involving the shading, to fill those portions of
the |
| 564 * area to be painted that lie outside the bounds of the shading object itself.
In |
| 565 * the opaque imaging model, the effect is as if the painting operation were |
| 566 * performed twice: first with the background color and then again with the |
| 567 * shading. |
| 568 * Note: The background color is applied only when the shading is used as part
of a |
| 569 * shading pattern, not when it is painted directly with the sh operator. |
| 570 **/ |
| 571 bool has_Background() const { |
| 572 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Backg
round", "", NULL)); |
| 573 } |
| 574 |
539 SkPdfArray Background() const { | 575 SkPdfArray Background() const { |
540 SkPdfArray ret; | 576 SkPdfArray ret; |
541 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Background
", "", &ret)) return ret; | 577 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Background
", "", &ret)) return ret; |
542 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 578 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
543 return SkPdfArray(); | 579 return SkPdfArray(); |
544 } | 580 } |
545 | 581 |
| 582 /** (Optional) An array of four numbers giving the left, bottom, right, and top |
| 583 * coordinates, respectively, of the shading's bounding box. The coordinates ar
e |
| 584 * interpreted in the shading's target coordinate space. If present, this bound
ing |
| 585 * box is applied as a temporary clipping boundary when the shading is painted, |
| 586 * in addition to the current clipping path and any other clipping boundaries i
n |
| 587 * effect at that time. |
| 588 **/ |
| 589 bool has_BBox() const { |
| 590 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BBox"
, "", NULL)); |
| 591 } |
| 592 |
546 SkRect BBox() const { | 593 SkRect BBox() const { |
547 SkRect ret; | 594 SkRect ret; |
548 if (SkRectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BBox", ""
, &ret)) return ret; | 595 if (SkRectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BBox", ""
, &ret)) return ret; |
549 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 596 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
550 return SkRect(); | 597 return SkRect(); |
551 } | 598 } |
552 | 599 |
| 600 /** (Optional) A flag indicating whether to filter the shading function to preve
nt |
| 601 * aliasing artifacts. The shading operators sample shading functions at a rate |
| 602 * determined by the resolution of the output device. Aliasing can occur if the |
| 603 * function is not smooth-that is, if it has a high spatial frequency relative
to |
| 604 * the sampling rate. Anti-aliasing can be computationally expensive and is usu
- |
| 605 * ally unnecessary, since most shading functions are smooth enough, or are |
| 606 * sampled at a high enough frequency, to avoid aliasing effects. Anti-aliasing |
| 607 * may not be implemented on some output devices, in which case this flag is |
| 608 * ignored. Default value: false. |
| 609 **/ |
| 610 bool has_AntiAlias() const { |
| 611 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "AntiA
lias", "", NULL)); |
| 612 } |
| 613 |
553 bool AntiAlias() const { | 614 bool AntiAlias() const { |
554 bool ret; | 615 bool ret; |
555 if (BoolFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "AntiAlias",
"", &ret)) return ret; | 616 if (BoolFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "AntiAlias",
"", &ret)) return ret; |
556 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 617 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
557 return false; | 618 return false; |
558 } | 619 } |
559 | 620 |
560 }; | 621 }; |
561 | 622 |
562 #endif // __DEFINED__SkPdfShadingDictionary | 623 #endif // __DEFINED__SkPdfShadingDictionary |
OLD | NEW |