OLD | NEW |
1 #ifndef __DEFINED__SkPdfSoftMaskDictionary | 1 #ifndef __DEFINED__SkPdfSoftMaskDictionary |
2 #define __DEFINED__SkPdfSoftMaskDictionary | 2 #define __DEFINED__SkPdfSoftMaskDictionary |
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 in a soft-mask dictionary |
8 class SkPdfSoftMaskDictionary : public SkPdfDictionary { | 9 class SkPdfSoftMaskDictionary : public SkPdfDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kSoftMaskDictionary_SkPdfObje
ctType;} | 11 virtual SkPdfObjectType getType() const { return kSoftMaskDictionary_SkPdfObje
ctType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kSoftMas
kDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kSoftMas
kDictionary_SkPdfObjectType + 1);} |
12 public: | 13 public: |
13 virtual SkPdfSoftMaskDictionary* asSoftMaskDictionary() {return this;} | 14 virtual SkPdfSoftMaskDictionary* asSoftMaskDictionary() {return this;} |
14 virtual const SkPdfSoftMaskDictionary* asSoftMaskDictionary() const {return th
is;} | 15 virtual const SkPdfSoftMaskDictionary* asSoftMaskDictionary() const {return th
is;} |
15 | 16 |
16 private: | 17 private: |
17 virtual SkPdfALinkAnnotationDictionary* asALinkAnnotationDictionary() {return
NULL;} | 18 virtual SkPdfALinkAnnotationDictionary* asALinkAnnotationDictionary() {return
NULL;} |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 515 |
515 public: | 516 public: |
516 private: | 517 private: |
517 public: | 518 public: |
518 SkPdfSoftMaskDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObjec
t* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} | 519 SkPdfSoftMaskDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObjec
t* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} |
519 | 520 |
520 virtual bool valid() const {return true;} | 521 virtual bool valid() const {return true;} |
521 | 522 |
522 SkPdfSoftMaskDictionary& operator=(const SkPdfSoftMaskDictionary& from) {this-
>fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;
} | 523 SkPdfSoftMaskDictionary& operator=(const SkPdfSoftMaskDictionary& from) {this-
>fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *this;
} |
523 | 524 |
| 525 /** (Optional) The type of PDF object that this dictionary describes; if present
, |
| 526 * must be Mask for a soft-mask dictionary. |
| 527 **/ |
| 528 bool has_Type() const { |
| 529 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); |
| 530 } |
| 531 |
524 std::string Type() const { | 532 std::string Type() const { |
525 std::string ret; | 533 std::string ret; |
526 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | 534 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; |
527 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 535 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
528 return ""; | 536 return ""; |
529 } | 537 } |
530 | 538 |
| 539 /** (Required) A subtype specifying the method to be used in deriving the mask |
| 540 * values from the transparency group specified by the G entry: |
| 541 * Alpha Use the group's computed alpha, disregarding its color (se
e |
| 542 * Section 7.4.1, "Deriving a Soft Mask from Group Alpha"). |
| 543 * Luminosity Convert the group's computed color to a single-component |
| 544 * luminosity value (see Section 7.4.2, "Deriving a Soft Mask |
| 545 * from Group Luminosity"). |
| 546 **/ |
| 547 bool has_S() const { |
| 548 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "S", "
", NULL)); |
| 549 } |
| 550 |
531 std::string S() const { | 551 std::string S() const { |
532 std::string ret; | 552 std::string ret; |
533 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "S", "", &re
t)) return ret; | 553 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "S", "", &re
t)) return ret; |
534 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 554 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
535 return ""; | 555 return ""; |
536 } | 556 } |
537 | 557 |
| 558 /** (Required) A transparency group XObject (see Section 7.5.5, "Transparency |
| 559 * Group XObjects") to be used as the source of alpha or color values for deriv
- |
| 560 * ing the mask. If the subtype S is Luminosity, the group attributes dictionar
y |
| 561 * must contain a CS entry defining the color space in which the compositing |
| 562 * computation is to be performed. |
| 563 **/ |
| 564 bool has_G() const { |
| 565 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "G", "
", NULL)); |
| 566 } |
| 567 |
538 SkPdfStream G() const { | 568 SkPdfStream G() const { |
539 SkPdfStream ret; | 569 SkPdfStream ret; |
540 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "G", "", &
ret)) return ret; | 570 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "G", "", &
ret)) return ret; |
541 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 571 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
542 return SkPdfStream(); | 572 return SkPdfStream(); |
543 } | 573 } |
544 | 574 |
| 575 /** (Optional) An array of component values specifying the color to be used as |
| 576 * the backdrop against which to composite the transparency group XObject G. |
| 577 * This entry is consulted only if the subtype S is Luminosity. The array consi
sts |
| 578 * of n numbers, where n is the number of components in the color space speci- |
| 579 * fied by the CS entry in the group attributes dictionary (see Section 7.5.5, |
| 580 * "Transparency Group XObjects"). Default value: the color space's initial |
| 581 * value, representing black. |
| 582 **/ |
| 583 bool has_BC() const { |
| 584 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BC",
"", NULL)); |
| 585 } |
| 586 |
545 SkPdfArray BC() const { | 587 SkPdfArray BC() const { |
546 SkPdfArray ret; | 588 SkPdfArray ret; |
547 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BC", "", &
ret)) return ret; | 589 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BC", "", &
ret)) return ret; |
548 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 590 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
549 return SkPdfArray(); | 591 return SkPdfArray(); |
550 } | 592 } |
551 | 593 |
| 594 /** (Optional) A function object (see Section 3.9, "Functions") specifying the |
| 595 * transfer function to be used in deriving the mask values. The function ac- |
| 596 * cepts one input, the computed group alpha or luminosity (depending on the |
| 597 * value of the subtype S), and returns one output, the resulting mask value. |
| 598 * Both the input and output must be in the range 0.0 to 1.0; if the computed |
| 599 * output falls outside this range, it is forced to the nearest valid value. Th
e |
| 600 * name Identity may be specified in place of a function object to designate th
e |
| 601 * identity function. Default value: Identity. |
| 602 **/ |
| 603 bool has_TR() const { |
| 604 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR",
"", NULL)); |
| 605 } |
| 606 |
552 bool isTRAFunction() const { | 607 bool isTRAFunction() const { |
553 SkPdfObject* ret = NULL; | 608 SkPdfObject* ret = NULL; |
554 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "",
&ret)) return false; | 609 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "",
&ret)) return false; |
555 return ret->podofo()->GetDataType() == ePdfDataType_Reference; | 610 return ret->podofo()->GetDataType() == ePdfDataType_Reference; |
556 } | 611 } |
557 | 612 |
558 SkPdfFunction getTRAsFunction() const { | 613 SkPdfFunction getTRAsFunction() const { |
559 SkPdfFunction ret = SkPdfFunction(); | 614 SkPdfFunction ret = SkPdfFunction(); |
560 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", ""
, &ret)) return ret; | 615 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", ""
, &ret)) return ret; |
561 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 616 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
562 return SkPdfFunction(); | 617 return SkPdfFunction(); |
563 } | 618 } |
564 | 619 |
565 bool isTRAName() const { | 620 bool isTRAName() const { |
566 SkPdfObject* ret = NULL; | 621 SkPdfObject* ret = NULL; |
567 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "",
&ret)) return false; | 622 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "",
&ret)) return false; |
568 return ret->podofo()->GetDataType() == ePdfDataType_Name; | 623 return ret->podofo()->GetDataType() == ePdfDataType_Name; |
569 } | 624 } |
570 | 625 |
571 std::string getTRAsName() const { | 626 std::string getTRAsName() const { |
572 std::string ret = ""; | 627 std::string ret = ""; |
573 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", &r
et)) return ret; | 628 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", &r
et)) return ret; |
574 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 629 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
575 return ""; | 630 return ""; |
576 } | 631 } |
577 | 632 |
578 }; | 633 }; |
579 | 634 |
580 #endif // __DEFINED__SkPdfSoftMaskDictionary | 635 #endif // __DEFINED__SkPdfSoftMaskDictionary |
OLD | NEW |