OLD | NEW |
1 #ifndef __DEFINED__SkPdfIccProfileStreamDictionary | 1 #ifndef __DEFINED__SkPdfIccProfileStreamDictionary |
2 #define __DEFINED__SkPdfIccProfileStreamDictionary | 2 #define __DEFINED__SkPdfIccProfileStreamDictionary |
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 // Additional entries specific to an ICC profile stream dictionary |
8 class SkPdfIccProfileStreamDictionary : public SkPdfDictionary { | 9 class SkPdfIccProfileStreamDictionary : public SkPdfDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kIccProfileStreamDictionary_S
kPdfObjectType;} | 11 virtual SkPdfObjectType getType() const { return kIccProfileStreamDictionary_S
kPdfObjectType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kIccProf
ileStreamDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kIccProf
ileStreamDictionary_SkPdfObjectType + 1);} |
12 public: | 13 public: |
13 virtual SkPdfIccProfileStreamDictionary* asIccProfileStreamDictionary() {retur
n this;} | 14 virtual SkPdfIccProfileStreamDictionary* asIccProfileStreamDictionary() {retur
n this;} |
14 virtual const SkPdfIccProfileStreamDictionary* asIccProfileStreamDictionary()
const {return this;} | 15 virtual const SkPdfIccProfileStreamDictionary* asIccProfileStreamDictionary()
const {return this;} |
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 SkPdfIccProfileStreamDictionary(const PdfMemDocument* podofoDoc = NULL, const
PdfObject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} | 519 SkPdfIccProfileStreamDictionary(const PdfMemDocument* podofoDoc = NULL, const
PdfObject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} |
519 | 520 |
520 virtual bool valid() const {return true;} | 521 virtual bool valid() const {return true;} |
521 | 522 |
522 SkPdfIccProfileStreamDictionary& operator=(const SkPdfIccProfileStreamDictiona
ry& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoOb
j; return *this;} | 523 SkPdfIccProfileStreamDictionary& operator=(const SkPdfIccProfileStreamDictiona
ry& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoOb
j; return *this;} |
523 | 524 |
| 525 /** (Required) The number of color components in the color space described by th
e ICC |
| 526 * profile data. This number must match the number of components actually in th
e ICC |
| 527 * profile. As of PDF 1.4, N must be 1, 3, or 4. |
| 528 **/ |
| 529 bool has_N() const { |
| 530 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "N", "
", NULL)); |
| 531 } |
| 532 |
524 long N() const { | 533 long N() const { |
525 long ret; | 534 long ret; |
526 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "N", "", &re
t)) return ret; | 535 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "N", "", &re
t)) return ret; |
527 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 536 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
528 return 0; | 537 return 0; |
529 } | 538 } |
530 | 539 |
| 540 /** (Optional) An alternate color space to be used in case the one specified in
the stream |
| 541 * data is not supported (for example, by viewer applications designed for earl
ier |
| 542 * versions of PDF). The alternate space may be any valid color space (except a
Pattern |
| 543 * color space) that has the number of components specified by N. If this entry
is omit- |
| 544 * ted and the viewer application does not understand the ICC profile data, the
color |
| 545 * space used will be DeviceGray, DeviceRGB, or DeviceCMYK, depending on whethe
r |
| 546 * the value of N is 1, 3, or 4, respectively. |
| 547 * Note: Note that there is no conversion of source color values, such as a tin
t transforma- |
| 548 * tion, when using the alternate color space. Color values that are within the
range of the |
| 549 * ICCBased color space might not be within the range of the alternate color sp
ace. In this |
| 550 * case, the nearest values within the range of the alternate space will be sub
stituted. |
| 551 **/ |
| 552 bool has_Alternate() const { |
| 553 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alter
nate", "", NULL)); |
| 554 } |
| 555 |
531 bool isAlternateAArray() const { | 556 bool isAlternateAArray() const { |
532 SkPdfObject* ret = NULL; | 557 SkPdfObject* ret = NULL; |
533 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alternat
e", "", &ret)) return false; | 558 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alternat
e", "", &ret)) return false; |
534 return ret->podofo()->GetDataType() == ePdfDataType_Array; | 559 return ret->podofo()->GetDataType() == ePdfDataType_Array; |
535 } | 560 } |
536 | 561 |
537 SkPdfArray getAlternateAsArray() const { | 562 SkPdfArray getAlternateAsArray() const { |
538 SkPdfArray ret = SkPdfArray(); | 563 SkPdfArray ret = SkPdfArray(); |
539 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alternate"
, "", &ret)) return ret; | 564 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alternate"
, "", &ret)) return ret; |
540 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 565 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
541 return SkPdfArray(); | 566 return SkPdfArray(); |
542 } | 567 } |
543 | 568 |
544 bool isAlternateAName() const { | 569 bool isAlternateAName() const { |
545 SkPdfObject* ret = NULL; | 570 SkPdfObject* ret = NULL; |
546 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alternat
e", "", &ret)) return false; | 571 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alternat
e", "", &ret)) return false; |
547 return ret->podofo()->GetDataType() == ePdfDataType_Name; | 572 return ret->podofo()->GetDataType() == ePdfDataType_Name; |
548 } | 573 } |
549 | 574 |
550 std::string getAlternateAsName() const { | 575 std::string getAlternateAsName() const { |
551 std::string ret = ""; | 576 std::string ret = ""; |
552 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alternate",
"", &ret)) return ret; | 577 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alternate",
"", &ret)) return ret; |
553 // 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 |
554 return ""; | 579 return ""; |
555 } | 580 } |
556 | 581 |
| 582 /** (Optional) An array of 2 x N numbers [min0 max0 min1 max1 ... ] specifying t
he |
| 583 * minimum and maximum valid values of the corresponding color components. |
| 584 * These values must match the information in the ICC profile. Default value: |
| 585 * [0.0 1.0 0.0 1.0 ...]. |
| 586 **/ |
| 587 bool has_Range() const { |
| 588 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Range
", "", NULL)); |
| 589 } |
| 590 |
557 SkPdfArray Range() const { | 591 SkPdfArray Range() const { |
558 SkPdfArray ret; | 592 SkPdfArray ret; |
559 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Range", ""
, &ret)) return ret; | 593 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Range", ""
, &ret)) return ret; |
560 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 594 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
561 return SkPdfArray(); | 595 return SkPdfArray(); |
562 } | 596 } |
563 | 597 |
| 598 /** (Optional; PDF 1.4) A metadata stream containing metadata for the color spac
e (see |
| 599 * Section 9.2.2, "Metadata Streams"). |
| 600 **/ |
| 601 bool has_Metadata() const { |
| 602 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metad
ata", "", NULL)); |
| 603 } |
| 604 |
564 SkPdfStream Metadata() const { | 605 SkPdfStream Metadata() const { |
565 SkPdfStream ret; | 606 SkPdfStream ret; |
566 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metadata"
, "", &ret)) return ret; | 607 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metadata"
, "", &ret)) return ret; |
567 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 608 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
568 return SkPdfStream(); | 609 return SkPdfStream(); |
569 } | 610 } |
570 | 611 |
571 }; | 612 }; |
572 | 613 |
573 #endif // __DEFINED__SkPdfIccProfileStreamDictionary | 614 #endif // __DEFINED__SkPdfIccProfileStreamDictionary |
OLD | NEW |