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