| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2010 The Android Open Source Project | 3 * Copyright 2010 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #ifndef SkPDFDocument_DEFINED | 10 #ifndef SkPDFDocument_DEFINED |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class SkPDFObject; | 22 class SkPDFObject; |
| 23 class SkWStream; | 23 class SkWStream; |
| 24 template <typename T> class SkTSet; | 24 template <typename T> class SkTSet; |
| 25 | 25 |
| 26 /** \class SkPDFDocument | 26 /** \class SkPDFDocument |
| 27 | 27 |
| 28 A SkPDFDocument assembles pages together and generates the final PDF file. | 28 A SkPDFDocument assembles pages together and generates the final PDF file. |
| 29 */ | 29 */ |
| 30 class SkPDFDocument { | 30 class SkPDFDocument { |
| 31 public: | 31 public: |
| 32 SK_API SkPDFDocument(); | 32 SkPDFDocument(); |
| 33 SK_API ~SkPDFDocument(); | 33 ~SkPDFDocument(); |
| 34 | 34 |
| 35 /** Output the PDF to the passed stream. It is an error to call this (it | 35 /** Output the PDF to the passed stream. It is an error to call this (it |
| 36 * will return false and not modify stream) if no pages have been added | 36 * will return false and not modify stream) if no pages have been added |
| 37 * or there are pages missing (i.e. page 1 and 3 have been added, but not | 37 * or there are pages missing (i.e. page 1 and 3 have been added, but not |
| 38 * page 2). | 38 * page 2). |
| 39 * | 39 * |
| 40 * @param stream The writable output stream to send the PDF to. | 40 * @param stream The writable output stream to send the PDF to. |
| 41 */ | 41 */ |
| 42 SK_API bool emitPDF(SkWStream* stream); | 42 bool emitPDF(SkWStream* stream); |
| 43 | 43 |
| 44 /** Sets the specific page to the passed PDF device. If the specified | 44 /** Sets the specific page to the passed PDF device. If the specified |
| 45 * page is already set, this overrides it. Returns true if successful. | 45 * page is already set, this overrides it. Returns true if successful. |
| 46 * Will fail if the document has already been emitted. | 46 * Will fail if the document has already been emitted. |
| 47 * | 47 * |
| 48 * @param pageNumber The position to add the passed device (1 based). | 48 * @param pageNumber The position to add the passed device (1 based). |
| 49 * @param pdfDevice The page to add to this document. | 49 * @param pdfDevice The page to add to this document. |
| 50 */ | 50 */ |
| 51 SK_API bool setPage(int pageNumber, SkPDFDevice* pdfDevice); | 51 bool setPage(int pageNumber, SkPDFDevice* pdfDevice); |
| 52 | 52 |
| 53 /** Append the passed pdf device to the document as a new page. Returns | 53 /** Append the passed pdf device to the document as a new page. Returns |
| 54 * true if successful. Will fail if the document has already been emitted. | 54 * true if successful. Will fail if the document has already been emitted. |
| 55 * | 55 * |
| 56 * @param pdfDevice The page to add to this document. | 56 * @param pdfDevice The page to add to this document. |
| 57 */ | 57 */ |
| 58 SK_API bool appendPage(SkPDFDevice* pdfDevice); | 58 bool appendPage(SkPDFDevice* pdfDevice); |
| 59 | 59 |
| 60 /** Get the count of unique font types used in the document. | 60 /** Get the count of unique font types used in the document. |
| 61 * DEPRECATED. | 61 * DEPRECATED. |
| 62 */ | 62 */ |
| 63 SK_API void getCountOfFontTypes( | 63 void getCountOfFontTypes( |
| 64 int counts[SkAdvancedTypefaceMetrics::kOther_Font + 2]) const; | 64 int counts[SkAdvancedTypefaceMetrics::kOther_Font + 2]) const; |
| 65 | 65 |
| 66 /** Get the count of unique font types used in the document. | 66 /** Get the count of unique font types used in the document. |
| 67 */ | 67 */ |
| 68 SK_API void getCountOfFontTypes( | 68 void getCountOfFontTypes( |
| 69 int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1], | 69 int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1], |
| 70 int* notSubsettableCount, | 70 int* notSubsettableCount, |
| 71 int* notEmbedddableCount) const; | 71 int* notEmbedddableCount) const; |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 SkAutoTDelete<SkPDFCatalog> fCatalog; | 74 SkAutoTDelete<SkPDFCatalog> fCatalog; |
| 75 int64_t fXRefFileOffset; | 75 int64_t fXRefFileOffset; |
| 76 | 76 |
| 77 SkTDArray<SkPDFPage*> fPages; | 77 SkTDArray<SkPDFPage*> fPages; |
| 78 SkTDArray<SkPDFDict*> fPageTree; | 78 SkTDArray<SkPDFDict*> fPageTree; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 93 size_t headerSize(); | 93 size_t headerSize(); |
| 94 | 94 |
| 95 /** Output the PDF footer to the passed stream. | 95 /** Output the PDF footer to the passed stream. |
| 96 * @param stream The writable output stream to send the footer to. | 96 * @param stream The writable output stream to send the footer to. |
| 97 * @param objCount The number of objects in the PDF. | 97 * @param objCount The number of objects in the PDF. |
| 98 */ | 98 */ |
| 99 void emitFooter(SkWStream* stream, int64_t objCount); | 99 void emitFooter(SkWStream* stream, int64_t objCount); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 #endif | 102 #endif |
| OLD | NEW |