Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: experimental/PdfViewer/autogen/SkPdfGraphicsStateDictionary_autogen.h

Issue 17856004: refactoring for pdf viewer lib (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #ifndef __DEFINED__SkPdfGraphicsStateDictionary 1 #ifndef __DEFINED__SkPdfGraphicsStateDictionary
2 #define __DEFINED__SkPdfGraphicsStateDictionary 2 #define __DEFINED__SkPdfGraphicsStateDictionary
3 3
4 #include "SkPdfUtils.h" 4 #include "SkPdfUtils.h"
5 #include "SkPdfEnums_autogen.h" 5 #include "SkPdfEnums_autogen.h"
6 #include "SkPdfArray_autogen.h" 6 #include "SkPdfArray_autogen.h"
7 #include "SkPdfDictionary_autogen.h" 7 #include "SkPdfDictionary_autogen.h"
8 8
9 // Entries in a graphics state parameter dictionary 9 // Entries in a graphics state parameter dictionary
10 class SkPdfGraphicsStateDictionary : public SkPdfDictionary { 10 class SkPdfGraphicsStateDictionary : public SkPdfDictionary {
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 SkPdfGraphicsStateDictionary& operator=(const SkPdfGraphicsStateDictionary& fr om) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; ret urn *this;} 526 SkPdfGraphicsStateDictionary& operator=(const SkPdfGraphicsStateDictionary& fr om) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; ret urn *this;}
527 527
528 /** (Optional) The type of PDF object that this dictionary describes; must be 528 /** (Optional) The type of PDF object that this dictionary describes; must be
529 * ExtGState for a graphics state parameter dictionary. 529 * ExtGState for a graphics state parameter dictionary.
530 **/ 530 **/
531 bool has_Type() const { 531 bool has_Type() const {
532 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type" , "", NULL)); 532 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type" , "", NULL));
533 } 533 }
534 534
535 std::string Type() const { 535 std::string Type() const;
536 std::string ret;
537 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "", &ret)) return ret;
538 // TODO(edisonn): warn about missing required field, assert for known good p dfs
539 return "";
540 }
541
542 /** (Optional; PDF 1.3) The line width (see "Line Width" on page 152). 536 /** (Optional; PDF 1.3) The line width (see "Line Width" on page 152).
543 **/ 537 **/
544 bool has_LW() const { 538 bool has_LW() const {
545 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LW", "", NULL)); 539 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LW", "", NULL));
546 } 540 }
547 541
548 double LW() const { 542 double LW() const;
549 double ret;
550 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LW", "", &ret)) return ret;
551 // TODO(edisonn): warn about missing required field, assert for known good p dfs
552 return 0;
553 }
554
555 /** (Optional; PDF 1.3) The line cap style (see "Line Cap Style" on page 153). 543 /** (Optional; PDF 1.3) The line cap style (see "Line Cap Style" on page 153).
556 **/ 544 **/
557 bool has_LC() const { 545 bool has_LC() const {
558 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LC", "", NULL)); 546 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LC", "", NULL));
559 } 547 }
560 548
561 long LC() const { 549 long LC() const;
562 long ret;
563 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LC", "", &r et)) return ret;
564 // TODO(edisonn): warn about missing required field, assert for known good p dfs
565 return 0;
566 }
567
568 /** (Optional; PDF 1.3) The line join style (see "Line Join Style" on page 153). 550 /** (Optional; PDF 1.3) The line join style (see "Line Join Style" on page 153).
569 **/ 551 **/
570 bool has_LJ() const { 552 bool has_LJ() const {
571 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LJ", "", NULL)); 553 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LJ", "", NULL));
572 } 554 }
573 555
574 long LJ() const { 556 long LJ() const;
575 long ret;
576 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LJ", "", &r et)) return ret;
577 // TODO(edisonn): warn about missing required field, assert for known good p dfs
578 return 0;
579 }
580
581 /** (Optional; PDF 1.3) The miter limit (see "Miter Limit" on page 153). 557 /** (Optional; PDF 1.3) The miter limit (see "Miter Limit" on page 153).
582 **/ 558 **/
583 bool has_ML() const { 559 bool has_ML() const {
584 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ML", "", NULL)); 560 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ML", "", NULL));
585 } 561 }
586 562
587 double ML() const { 563 double ML() const;
588 double ret;
589 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ML", "", &ret)) return ret;
590 // TODO(edisonn): warn about missing required field, assert for known good p dfs
591 return 0;
592 }
593
594 /** (Optional; PDF 1.3) The line dash pattern, expressed as an array of the form 564 /** (Optional; PDF 1.3) The line dash pattern, expressed as an array of the form
595 * [dashArray dashPhase], where dashArray is itself an array and dashPhase is a n 565 * [dashArray dashPhase], where dashArray is itself an array and dashPhase is a n
596 * integer (see "Line Dash Pattern" on page 155). 566 * integer (see "Line Dash Pattern" on page 155).
597 **/ 567 **/
598 bool has_D() const { 568 bool has_D() const {
599 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "D", " ", NULL)); 569 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "D", " ", NULL));
600 } 570 }
601 571
602 SkPdfArray* D() const { 572 SkPdfArray* D() const;
603 SkPdfArray* ret;
604 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "D", "", &r et)) return ret;
605 // TODO(edisonn): warn about missing required field, assert for known good p dfs
606 return NULL;
607 }
608
609 /** (Optional; PDF 1.3) The name of the rendering intent (see "Rendering 573 /** (Optional; PDF 1.3) The name of the rendering intent (see "Rendering
610 * Intents" on page 197). 574 * Intents" on page 197).
611 **/ 575 **/
612 bool has_RI() const { 576 bool has_RI() const {
613 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "RI", "", NULL)); 577 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "RI", "", NULL));
614 } 578 }
615 579
616 std::string RI() const { 580 std::string RI() const;
617 std::string ret;
618 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "RI", "", &r et)) return ret;
619 // TODO(edisonn): warn about missing required field, assert for known good p dfs
620 return "";
621 }
622
623 /** (Optional) A flag specifying whether to apply overprint (see Section 4.5.6, 581 /** (Optional) A flag specifying whether to apply overprint (see Section 4.5.6,
624 * "Overprint Control"). In PDF 1.2 and earlier, there is a single overprint 582 * "Overprint Control"). In PDF 1.2 and earlier, there is a single overprint
625 * parameter that applies to all painting operations. Beginning with PDF 1.3, 583 * parameter that applies to all painting operations. Beginning with PDF 1.3,
626 * there are two separate overprint parameters: one for stroking and one for al l 584 * there are two separate overprint parameters: one for stroking and one for al l
627 * other painting operations. Specifying an OP entry sets both parameters un- 585 * other painting operations. Specifying an OP entry sets both parameters un-
628 * less there is also an op entry in the same graphics state parameter dictiona ry, 586 * less there is also an op entry in the same graphics state parameter dictiona ry,
629 * in which case the OP entry sets only the overprint parameter for stroking. 587 * in which case the OP entry sets only the overprint parameter for stroking.
630 **/ 588 **/
631 bool has_OP() const { 589 bool has_OP() const {
632 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OP", "", NULL)); 590 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OP", "", NULL));
633 } 591 }
634 592
635 bool OP() const { 593 bool OP() const;
636 bool ret;
637 if (BoolFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OP", "", &r et)) return ret;
638 // TODO(edisonn): warn about missing required field, assert for known good p dfs
639 return false;
640 }
641
642 /** (Optional; PDF 1.3) A flag specifying whether to apply overprint (see Sectio n 594 /** (Optional; PDF 1.3) A flag specifying whether to apply overprint (see Sectio n
643 * 4.5.6, "Overprint Control") for painting operations other than stroking. If 595 * 4.5.6, "Overprint Control") for painting operations other than stroking. If
644 * this entry is absent, the OP entry, if any, sets this parameter. 596 * this entry is absent, the OP entry, if any, sets this parameter.
645 **/ 597 **/
646 bool has_op() const { 598 bool has_op() const {
647 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "op", "", NULL)); 599 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "op", "", NULL));
648 } 600 }
649 601
650 bool op() const { 602 bool op() const;
651 bool ret;
652 if (BoolFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "op", "", &r et)) return ret;
653 // TODO(edisonn): warn about missing required field, assert for known good p dfs
654 return false;
655 }
656
657 /** (Optional; PDF 1.3) The overprint mode (see Section 4.5.6, "Overprint Con- 603 /** (Optional; PDF 1.3) The overprint mode (see Section 4.5.6, "Overprint Con-
658 * trol"). 604 * trol").
659 **/ 605 **/
660 bool has_OPM() const { 606 bool has_OPM() const {
661 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPM", "", NULL)); 607 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPM", "", NULL));
662 } 608 }
663 609
664 long OPM() const { 610 long OPM() const;
665 long ret;
666 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPM", "", & ret)) return ret;
667 // TODO(edisonn): warn about missing required field, assert for known good p dfs
668 return 0;
669 }
670
671 /** (Optional; PDF 1.3) An array of the form [font size], where font is an indir ect 611 /** (Optional; PDF 1.3) An array of the form [font size], where font is an indir ect
672 * reference to a font dictionary and size is a number expressed in text space 612 * reference to a font dictionary and size is a number expressed in text space
673 * units. These two objects correspond to the operands of the Tf operator (see 613 * units. These two objects correspond to the operands of the Tf operator (see
674 * Section 5.2, "Text State Parameters and Operators"); however, the first oper - 614 * Section 5.2, "Text State Parameters and Operators"); however, the first oper -
675 * and is an indirect object reference instead of a resource name. 615 * and is an indirect object reference instead of a resource name.
676 **/ 616 **/
677 bool has_Font() const { 617 bool has_Font() const {
678 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Font" , "", NULL)); 618 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Font" , "", NULL));
679 } 619 }
680 620
681 SkPdfArray* Font() const { 621 SkPdfArray* Font() const;
682 SkPdfArray* ret;
683 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Font", "", &ret)) return ret;
684 // TODO(edisonn): warn about missing required field, assert for known good p dfs
685 return NULL;
686 }
687
688 /** (Optional) The black-generation function, which maps the interval [0.0 1.0] 622 /** (Optional) The black-generation function, which maps the interval [0.0 1.0]
689 * to the interval [0.0 1.0] (see Section 6.2.3, "Conversion from DeviceRGB to 623 * to the interval [0.0 1.0] (see Section 6.2.3, "Conversion from DeviceRGB to
690 * DeviceCMYK"). 624 * DeviceCMYK").
691 **/ 625 **/
692 bool has_BG() const { 626 bool has_BG() const {
693 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG", "", NULL)); 627 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG", "", NULL));
694 } 628 }
695 629
696 SkPdfFunction BG() const { 630 SkPdfFunction BG() const;
697 SkPdfFunction ret;
698 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG", "" , &ret)) return ret;
699 // TODO(edisonn): warn about missing required field, assert for known good p dfs
700 return SkPdfFunction();
701 }
702
703 /** (Optional; PDF 1.3) Same as BG except that the value may also be the name 631 /** (Optional; PDF 1.3) Same as BG except that the value may also be the name
704 * Default, denoting the black-generation function that was in effect at the st art 632 * Default, denoting the black-generation function that was in effect at the st art
705 * of the page. If both BG and BG2 are present in the same graphics state param - 633 * of the page. If both BG and BG2 are present in the same graphics state param -
706 * eter dictionary, BG2 takes precedence. 634 * eter dictionary, BG2 takes precedence.
707 **/ 635 **/
708 bool has_BG2() const { 636 bool has_BG2() const {
709 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG2", "", NULL)); 637 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG2", "", NULL));
710 } 638 }
711 639
712 bool isBG2AFunction() const { 640 bool isBG2AFunction() const {
713 SkPdfObject* ret = NULL; 641 SkPdfObject* ret = NULL;
714 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG2", "" , &ret)) return false; 642 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG2", "" , &ret)) return false;
715 return ret->podofo()->GetDataType() == ePdfDataType_Reference; 643 return ret->podofo()->GetDataType() == ePdfDataType_Reference;
716 } 644 }
717 645
718 SkPdfFunction getBG2AsFunction() const { 646 SkPdfFunction getBG2AsFunction() const;
719 SkPdfFunction ret = SkPdfFunction();
720 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG2", " ", &ret)) return ret;
721 // TODO(edisonn): warn about missing required field, assert for known good p dfs
722 return SkPdfFunction();
723 }
724
725 bool isBG2AName() const { 647 bool isBG2AName() const {
726 SkPdfObject* ret = NULL; 648 SkPdfObject* ret = NULL;
727 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG2", "" , &ret)) return false; 649 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG2", "" , &ret)) return false;
728 return ret->podofo()->GetDataType() == ePdfDataType_Name; 650 return ret->podofo()->GetDataType() == ePdfDataType_Name;
729 } 651 }
730 652
731 std::string getBG2AsName() const { 653 std::string getBG2AsName() const;
732 std::string ret = "";
733 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BG2", "", & ret)) return ret;
734 // TODO(edisonn): warn about missing required field, assert for known good p dfs
735 return "";
736 }
737
738 /** (Optional) The undercolor-removal function, which maps the interval 654 /** (Optional) The undercolor-removal function, which maps the interval
739 * [0.0 1.0] to the interval [-1.0 1.0] (see Section 6.2.3, "Conversion from 655 * [0.0 1.0] to the interval [-1.0 1.0] (see Section 6.2.3, "Conversion from
740 * DeviceRGB to DeviceCMYK"). 656 * DeviceRGB to DeviceCMYK").
741 **/ 657 **/
742 bool has_UCR() const { 658 bool has_UCR() const {
743 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR", "", NULL)); 659 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR", "", NULL));
744 } 660 }
745 661
746 SkPdfFunction UCR() const { 662 SkPdfFunction UCR() const;
747 SkPdfFunction ret;
748 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR", " ", &ret)) return ret;
749 // TODO(edisonn): warn about missing required field, assert for known good p dfs
750 return SkPdfFunction();
751 }
752
753 /** (Optional; PDF 1.3) Same as UCR except that the value may also be the name 663 /** (Optional; PDF 1.3) Same as UCR except that the value may also be the name
754 * Default, denoting the undercolor-removal function that was in effect at the 664 * Default, denoting the undercolor-removal function that was in effect at the
755 * start of the page. If both UCR and UCR2 are present in the same graphics sta te 665 * start of the page. If both UCR and UCR2 are present in the same graphics sta te
756 * parameter dictionary, UCR2 takes precedence. 666 * parameter dictionary, UCR2 takes precedence.
757 **/ 667 **/
758 bool has_UCR2() const { 668 bool has_UCR2() const {
759 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR2" , "", NULL)); 669 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR2" , "", NULL));
760 } 670 }
761 671
762 bool isUCR2AFunction() const { 672 bool isUCR2AFunction() const {
763 SkPdfObject* ret = NULL; 673 SkPdfObject* ret = NULL;
764 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR2", " ", &ret)) return false; 674 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR2", " ", &ret)) return false;
765 return ret->podofo()->GetDataType() == ePdfDataType_Reference; 675 return ret->podofo()->GetDataType() == ePdfDataType_Reference;
766 } 676 }
767 677
768 SkPdfFunction getUCR2AsFunction() const { 678 SkPdfFunction getUCR2AsFunction() const;
769 SkPdfFunction ret = SkPdfFunction();
770 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR2", "", &ret)) return ret;
771 // TODO(edisonn): warn about missing required field, assert for known good p dfs
772 return SkPdfFunction();
773 }
774
775 bool isUCR2AName() const { 679 bool isUCR2AName() const {
776 SkPdfObject* ret = NULL; 680 SkPdfObject* ret = NULL;
777 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR2", " ", &ret)) return false; 681 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR2", " ", &ret)) return false;
778 return ret->podofo()->GetDataType() == ePdfDataType_Name; 682 return ret->podofo()->GetDataType() == ePdfDataType_Name;
779 } 683 }
780 684
781 std::string getUCR2AsName() const { 685 std::string getUCR2AsName() const;
782 std::string ret = "";
783 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "UCR2", "", &ret)) return ret;
784 // TODO(edisonn): warn about missing required field, assert for known good p dfs
785 return "";
786 }
787
788 /** (Optional) The transfer function, which maps the interval [0.0 1.0] to the 686 /** (Optional) The transfer function, which maps the interval [0.0 1.0] to the
789 * interval [0.0 1.0] (see Section 6.3, "Transfer Functions"). The value is eit her 687 * interval [0.0 1.0] (see Section 6.3, "Transfer Functions"). The value is eit her
790 * a single function (which applies to all process colorants) or an array of fo ur 688 * a single function (which applies to all process colorants) or an array of fo ur
791 * functions (which apply to the process colorants individually). The name 689 * functions (which apply to the process colorants individually). The name
792 * Identity may be used to represent the identity function. 690 * Identity may be used to represent the identity function.
793 **/ 691 **/
794 bool has_TR() const { 692 bool has_TR() const {
795 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", NULL)); 693 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", NULL));
796 } 694 }
797 695
798 bool isTRAFunction() const { 696 bool isTRAFunction() const {
799 SkPdfObject* ret = NULL; 697 SkPdfObject* ret = NULL;
800 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", &ret)) return false; 698 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", &ret)) return false;
801 return ret->podofo()->GetDataType() == ePdfDataType_Reference; 699 return ret->podofo()->GetDataType() == ePdfDataType_Reference;
802 } 700 }
803 701
804 SkPdfFunction getTRAsFunction() const { 702 SkPdfFunction getTRAsFunction() const;
805 SkPdfFunction ret = SkPdfFunction();
806 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "" , &ret)) return ret;
807 // TODO(edisonn): warn about missing required field, assert for known good p dfs
808 return SkPdfFunction();
809 }
810
811 bool isTRAArray() const { 703 bool isTRAArray() const {
812 SkPdfObject* ret = NULL; 704 SkPdfObject* ret = NULL;
813 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", &ret)) return false; 705 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", &ret)) return false;
814 return ret->podofo()->GetDataType() == ePdfDataType_Array; 706 return ret->podofo()->GetDataType() == ePdfDataType_Array;
815 } 707 }
816 708
817 SkPdfArray* getTRAsArray() const { 709 SkPdfArray* getTRAsArray() const;
818 SkPdfArray* ret = NULL;
819 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", & ret)) return ret;
820 // TODO(edisonn): warn about missing required field, assert for known good p dfs
821 return NULL;
822 }
823
824 bool isTRAName() const { 710 bool isTRAName() const {
825 SkPdfObject* ret = NULL; 711 SkPdfObject* ret = NULL;
826 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", &ret)) return false; 712 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", &ret)) return false;
827 return ret->podofo()->GetDataType() == ePdfDataType_Name; 713 return ret->podofo()->GetDataType() == ePdfDataType_Name;
828 } 714 }
829 715
830 std::string getTRAsName() const { 716 std::string getTRAsName() const;
831 std::string ret = "";
832 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR", "", &r et)) return ret;
833 // TODO(edisonn): warn about missing required field, assert for known good p dfs
834 return "";
835 }
836
837 /** (Optional; PDF 1.3) Same as TR except that the value may also be the name 717 /** (Optional; PDF 1.3) Same as TR except that the value may also be the name
838 * Default, denoting the transfer function that was in effect at the start of t he 718 * Default, denoting the transfer function that was in effect at the start of t he
839 * page. If both TR and TR2 are present in the same graphics state parameter di c- 719 * page. If both TR and TR2 are present in the same graphics state parameter di c-
840 * tionary, TR2 takes precedence. 720 * tionary, TR2 takes precedence.
841 **/ 721 **/
842 bool has_TR2() const { 722 bool has_TR2() const {
843 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", "", NULL)); 723 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", "", NULL));
844 } 724 }
845 725
846 bool isTR2AFunction() const { 726 bool isTR2AFunction() const {
847 SkPdfObject* ret = NULL; 727 SkPdfObject* ret = NULL;
848 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", "" , &ret)) return false; 728 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", "" , &ret)) return false;
849 return ret->podofo()->GetDataType() == ePdfDataType_Reference; 729 return ret->podofo()->GetDataType() == ePdfDataType_Reference;
850 } 730 }
851 731
852 SkPdfFunction getTR2AsFunction() const { 732 SkPdfFunction getTR2AsFunction() const;
853 SkPdfFunction ret = SkPdfFunction();
854 if (FunctionFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", " ", &ret)) return ret;
855 // TODO(edisonn): warn about missing required field, assert for known good p dfs
856 return SkPdfFunction();
857 }
858
859 bool isTR2AArray() const { 733 bool isTR2AArray() const {
860 SkPdfObject* ret = NULL; 734 SkPdfObject* ret = NULL;
861 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", "" , &ret)) return false; 735 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", "" , &ret)) return false;
862 return ret->podofo()->GetDataType() == ePdfDataType_Array; 736 return ret->podofo()->GetDataType() == ePdfDataType_Array;
863 } 737 }
864 738
865 SkPdfArray* getTR2AsArray() const { 739 SkPdfArray* getTR2AsArray() const;
866 SkPdfArray* ret = NULL;
867 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", "", &ret)) return ret;
868 // TODO(edisonn): warn about missing required field, assert for known good p dfs
869 return NULL;
870 }
871
872 bool isTR2AName() const { 740 bool isTR2AName() const {
873 SkPdfObject* ret = NULL; 741 SkPdfObject* ret = NULL;
874 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", "" , &ret)) return false; 742 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", "" , &ret)) return false;
875 return ret->podofo()->GetDataType() == ePdfDataType_Name; 743 return ret->podofo()->GetDataType() == ePdfDataType_Name;
876 } 744 }
877 745
878 std::string getTR2AsName() const { 746 std::string getTR2AsName() const;
879 std::string ret = "";
880 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TR2", "", & ret)) return ret;
881 // TODO(edisonn): warn about missing required field, assert for known good p dfs
882 return "";
883 }
884
885 /** (Optional) The halftone dictionary or stream (see Section 6.4, "Halftones") 747 /** (Optional) The halftone dictionary or stream (see Section 6.4, "Halftones")
886 * or the name Default, denoting the halftone that was in effect at the start o f the 748 * or the name Default, denoting the halftone that was in effect at the start o f the
887 * page. 749 * page.
888 **/ 750 **/
889 bool has_HT() const { 751 bool has_HT() const {
890 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", NULL)); 752 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", NULL));
891 } 753 }
892 754
893 bool isHTADictionary() const { 755 bool isHTADictionary() const {
894 SkPdfObject* ret = NULL; 756 SkPdfObject* ret = NULL;
895 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", &ret)) return false; 757 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", &ret)) return false;
896 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; 758 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary;
897 } 759 }
898 760
899 SkPdfDictionary* getHTAsDictionary() const { 761 SkPdfDictionary* getHTAsDictionary() const;
900 SkPdfDictionary* ret = NULL;
901 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", &ret)) return ret;
902 // TODO(edisonn): warn about missing required field, assert for known good p dfs
903 return NULL;
904 }
905
906 bool isHTAStream() const { 762 bool isHTAStream() const {
907 SkPdfObject* ret = NULL; 763 SkPdfObject* ret = NULL;
908 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", &ret)) return false; 764 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", &ret)) return false;
909 return ret->podofo()->HasStream(); 765 return ret->podofo()->HasStream();
910 } 766 }
911 767
912 SkPdfStream* getHTAsStream() const { 768 SkPdfStream* getHTAsStream() const;
913 SkPdfStream* ret = NULL;
914 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", &ret)) return ret;
915 // TODO(edisonn): warn about missing required field, assert for known good p dfs
916 return NULL;
917 }
918
919 bool isHTAName() const { 769 bool isHTAName() const {
920 SkPdfObject* ret = NULL; 770 SkPdfObject* ret = NULL;
921 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", &ret)) return false; 771 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", &ret)) return false;
922 return ret->podofo()->GetDataType() == ePdfDataType_Name; 772 return ret->podofo()->GetDataType() == ePdfDataType_Name;
923 } 773 }
924 774
925 std::string getHTAsName() const { 775 std::string getHTAsName() const;
926 std::string ret = "";
927 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "HT", "", &r et)) return ret;
928 // TODO(edisonn): warn about missing required field, assert for known good p dfs
929 return "";
930 }
931
932 /** (Optional; PDF 1.3) The flatness tolerance (see Section 6.5.1, "Flatness Tol er- 776 /** (Optional; PDF 1.3) The flatness tolerance (see Section 6.5.1, "Flatness Tol er-
933 * ance"). 777 * ance").
934 **/ 778 **/
935 bool has_FL() const { 779 bool has_FL() const {
936 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FL", "", NULL)); 780 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FL", "", NULL));
937 } 781 }
938 782
939 double FL() const { 783 double FL() const;
940 double ret;
941 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FL", "", &ret)) return ret;
942 // TODO(edisonn): warn about missing required field, assert for known good p dfs
943 return 0;
944 }
945
946 /** (Optional; PDF 1.3) The smoothness tolerance (see Section 6.5.2, "Smooth- 784 /** (Optional; PDF 1.3) The smoothness tolerance (see Section 6.5.2, "Smooth-
947 * ness Tolerance"). 785 * ness Tolerance").
948 **/ 786 **/
949 bool has_SM() const { 787 bool has_SM() const {
950 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SM", "", NULL)); 788 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SM", "", NULL));
951 } 789 }
952 790
953 double SM() const { 791 double SM() const;
954 double ret;
955 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SM", "", &ret)) return ret;
956 // TODO(edisonn): warn about missing required field, assert for known good p dfs
957 return 0;
958 }
959
960 /** (Optional) A flag specifying whether to apply automatic stroke adjustment 792 /** (Optional) A flag specifying whether to apply automatic stroke adjustment
961 * (see Section 6.5.4, "Automatic Stroke Adjustment"). 793 * (see Section 6.5.4, "Automatic Stroke Adjustment").
962 **/ 794 **/
963 bool has_SA() const { 795 bool has_SA() const {
964 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SA", "", NULL)); 796 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SA", "", NULL));
965 } 797 }
966 798
967 bool SA() const { 799 bool SA() const;
968 bool ret;
969 if (BoolFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SA", "", &r et)) return ret;
970 // TODO(edisonn): warn about missing required field, assert for known good p dfs
971 return false;
972 }
973
974 /** (Optional; PDF 1.4) The current blend mode to be used in the transparent 800 /** (Optional; PDF 1.4) The current blend mode to be used in the transparent
975 * imaging model (see Sections 7.2.4, "Blend Mode," and 7.5.2, "Specifying 801 * imaging model (see Sections 7.2.4, "Blend Mode," and 7.5.2, "Specifying
976 * Blending Color Space and Blend Mode"). 802 * Blending Color Space and Blend Mode").
977 **/ 803 **/
978 bool has_BM() const { 804 bool has_BM() const {
979 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BM", "", NULL)); 805 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BM", "", NULL));
980 } 806 }
981 807
982 bool isBMAName() const { 808 bool isBMAName() const {
983 SkPdfObject* ret = NULL; 809 SkPdfObject* ret = NULL;
984 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BM", "", &ret)) return false; 810 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BM", "", &ret)) return false;
985 return ret->podofo()->GetDataType() == ePdfDataType_Name; 811 return ret->podofo()->GetDataType() == ePdfDataType_Name;
986 } 812 }
987 813
988 std::string getBMAsName() const { 814 std::string getBMAsName() const;
989 std::string ret = "";
990 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BM", "", &r et)) return ret;
991 // TODO(edisonn): warn about missing required field, assert for known good p dfs
992 return "";
993 }
994
995 bool isBMAArray() const { 815 bool isBMAArray() const {
996 SkPdfObject* ret = NULL; 816 SkPdfObject* ret = NULL;
997 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BM", "", &ret)) return false; 817 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BM", "", &ret)) return false;
998 return ret->podofo()->GetDataType() == ePdfDataType_Array; 818 return ret->podofo()->GetDataType() == ePdfDataType_Array;
999 } 819 }
1000 820
1001 SkPdfArray* getBMAsArray() const { 821 SkPdfArray* getBMAsArray() const;
1002 SkPdfArray* ret = NULL;
1003 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BM", "", & ret)) return ret;
1004 // TODO(edisonn): warn about missing required field, assert for known good p dfs
1005 return NULL;
1006 }
1007
1008 /** (Optional; PDF 1.4) The current soft mask, specifying the mask shape or 822 /** (Optional; PDF 1.4) The current soft mask, specifying the mask shape or
1009 * mask opacity values to be used in the transparent imaging model (see 823 * mask opacity values to be used in the transparent imaging model (see
1010 * "Source Shape and Opacity" on page 421 and "Mask Shape and Opacity" on 824 * "Source Shape and Opacity" on page 421 and "Mask Shape and Opacity" on
1011 * page 443). 825 * page 443).
1012 * Note: Although the current soft mask is sometimes referred to as a "soft cli p," 826 * Note: Although the current soft mask is sometimes referred to as a "soft cli p,"
1013 * altering it with the gs operator completely replaces the old value with the new 827 * altering it with the gs operator completely replaces the old value with the new
1014 * one, rather than intersecting the two as is done with the current clipping p ath 828 * one, rather than intersecting the two as is done with the current clipping p ath
1015 * parameter (see Section 4.4.3, "Clipping Path Operators"). 829 * parameter (see Section 4.4.3, "Clipping Path Operators").
1016 **/ 830 **/
1017 bool has_SMask() const { 831 bool has_SMask() const {
1018 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SMask ", "", NULL)); 832 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SMask ", "", NULL));
1019 } 833 }
1020 834
1021 bool isSMaskADictionary() const { 835 bool isSMaskADictionary() const {
1022 SkPdfObject* ret = NULL; 836 SkPdfObject* ret = NULL;
1023 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SMask", "", &ret)) return false; 837 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SMask", "", &ret)) return false;
1024 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary; 838 return ret->podofo()->GetDataType() == ePdfDataType_Dictionary;
1025 } 839 }
1026 840
1027 SkPdfDictionary* getSMaskAsDictionary() const { 841 SkPdfDictionary* getSMaskAsDictionary() const;
1028 SkPdfDictionary* ret = NULL;
1029 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SMask ", "", &ret)) return ret;
1030 // TODO(edisonn): warn about missing required field, assert for known good p dfs
1031 return NULL;
1032 }
1033
1034 bool isSMaskAName() const { 842 bool isSMaskAName() const {
1035 SkPdfObject* ret = NULL; 843 SkPdfObject* ret = NULL;
1036 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SMask", "", &ret)) return false; 844 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SMask", "", &ret)) return false;
1037 return ret->podofo()->GetDataType() == ePdfDataType_Name; 845 return ret->podofo()->GetDataType() == ePdfDataType_Name;
1038 } 846 }
1039 847
1040 std::string getSMaskAsName() const { 848 std::string getSMaskAsName() const;
1041 std::string ret = "";
1042 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SMask", "", &ret)) return ret;
1043 // TODO(edisonn): warn about missing required field, assert for known good p dfs
1044 return "";
1045 }
1046
1047 /** (Optional; PDF 1.4) The current stroking alpha constant, specifying the con- 849 /** (Optional; PDF 1.4) The current stroking alpha constant, specifying the con-
1048 * stant shape or constant opacity value to be used for stroking operations in the 850 * stant shape or constant opacity value to be used for stroking operations in the
1049 * transparent imaging model (see "Source Shape and Opacity" on page 421 851 * transparent imaging model (see "Source Shape and Opacity" on page 421
1050 * and "Constant Shape and Opacity" on page 444). 852 * and "Constant Shape and Opacity" on page 444).
1051 **/ 853 **/
1052 bool has_CA() const { 854 bool has_CA() const {
1053 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CA", "", NULL)); 855 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CA", "", NULL));
1054 } 856 }
1055 857
1056 double CA() const { 858 double CA() const;
1057 double ret;
1058 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "CA", "", &ret)) return ret;
1059 // TODO(edisonn): warn about missing required field, assert for known good p dfs
1060 return 0;
1061 }
1062
1063 /** (Optional; PDF 1.4) Same as CA, but for nonstroking operations. 859 /** (Optional; PDF 1.4) Same as CA, but for nonstroking operations.
1064 **/ 860 **/
1065 bool has_ca() const { 861 bool has_ca() const {
1066 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ca", "", NULL)); 862 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ca", "", NULL));
1067 } 863 }
1068 864
1069 double ca() const { 865 double ca() const;
1070 double ret;
1071 if (DoubleFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ca", "", &ret)) return ret;
1072 // TODO(edisonn): warn about missing required field, assert for known good p dfs
1073 return 0;
1074 }
1075
1076 /** (Optional; PDF 1.4) The alpha source flag ("alpha is shape"), specifying 866 /** (Optional; PDF 1.4) The alpha source flag ("alpha is shape"), specifying
1077 * whether the current soft mask and alpha constant are to be interpreted as 867 * whether the current soft mask and alpha constant are to be interpreted as
1078 * shape values (true) or opacity values (false). 868 * shape values (true) or opacity values (false).
1079 **/ 869 **/
1080 bool has_AIS() const { 870 bool has_AIS() const {
1081 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "AIS", "", NULL)); 871 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "AIS", "", NULL));
1082 } 872 }
1083 873
1084 bool AIS() const { 874 bool AIS() const;
1085 bool ret;
1086 if (BoolFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "AIS", "", & ret)) return ret;
1087 // TODO(edisonn): warn about missing required field, assert for known good p dfs
1088 return false;
1089 }
1090
1091 /** (Optional; PDF 1.4) The text knockout flag, which determines the behavior 875 /** (Optional; PDF 1.4) The text knockout flag, which determines the behavior
1092 * of overlapping glyphs within a text object in the transparent imaging model 876 * of overlapping glyphs within a text object in the transparent imaging model
1093 * (see Section 5.2.7, "Text Knockout"). 877 * (see Section 5.2.7, "Text Knockout").
1094 **/ 878 **/
1095 bool has_TK() const { 879 bool has_TK() const {
1096 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TK", "", NULL)); 880 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TK", "", NULL));
1097 } 881 }
1098 882
1099 bool TK() const { 883 bool TK() const;
1100 bool ret;
1101 if (BoolFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "TK", "", &r et)) return ret;
1102 // TODO(edisonn): warn about missing required field, assert for known good p dfs
1103 return false;
1104 }
1105
1106 }; 884 };
1107 885
1108 #endif // __DEFINED__SkPdfGraphicsStateDictionary 886 #endif // __DEFINED__SkPdfGraphicsStateDictionary
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698