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 |
11 #define SkPDFDocument_DEFINED | 11 #define SkPDFDocument_DEFINED |
12 | 12 |
13 #include "SkAdvancedTypefaceMetrics.h" | 13 #include "SkAdvancedTypefaceMetrics.h" |
14 #include "SkRefCnt.h" | 14 #include "SkPDFDevice.h" |
15 #include "SkTDArray.h" | 15 #include "SkTDArray.h" |
16 #include "SkTemplates.h" | |
17 | 16 |
18 class SkPDFCatalog; | |
19 class SkPDFDevice; | |
20 class SkPDFDict; | |
21 class SkPDFPage; | |
22 class SkPDFObject; | |
23 class SkWStream; | 17 class SkWStream; |
24 template <typename T> class SkTSet; | |
25 | 18 |
26 /** \class SkPDFDocument | 19 /** \class SkPDFDocument |
27 | 20 |
28 A SkPDFDocument assembles pages together and generates the final PDF file. | 21 A SkPDFDocument assembles pages together and generates the final PDF file. |
29 */ | 22 */ |
30 class SkPDFDocument { | 23 class SkPDFDocument { |
31 public: | 24 public: |
32 SkPDFDocument(); | 25 SkPDFDocument(); |
33 ~SkPDFDocument(); | 26 ~SkPDFDocument(); |
34 | 27 |
35 /** Output the PDF to the passed stream. It is an error to call this (it | 28 /** 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 | 29 * 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 | 30 * or there are pages missing (i.e. page 1 and 3 have been added, but not |
38 * page 2). | 31 * page 2). |
39 * | 32 * |
40 * @param stream The writable output stream to send the PDF to. | 33 * @param stream The writable output stream to send the PDF to. |
41 */ | 34 */ |
42 bool emitPDF(SkWStream* stream); | 35 bool emitPDF(SkWStream* stream); |
43 | 36 |
44 /** Append the passed pdf device to the document as a new page. Returns | 37 /** Append the passed pdf device to the document as a new page. Returns |
45 * true if successful. Will fail if the document has already been emitted. | 38 * true if successful. Will fail if the document has already been emitted. |
46 * | 39 * |
47 * @param pdfDevice The page to add to this document. | 40 * @param pdfDevice The page to add to this document. |
48 */ | 41 */ |
49 bool appendPage(SkPDFDevice* pdfDevice) { | 42 bool appendPage(const SkPDFDevice* pdfDevice) { |
50 fPageDevices.push(SkRef(pdfDevice)); | 43 fPageDevices.push(SkRef(pdfDevice)); |
51 return true; | 44 return true; |
52 } | 45 } |
53 | 46 |
54 /** Get the count of unique font types used in the document. | 47 /** Get the count of unique font types used in the document. |
55 */ | 48 */ |
56 void getCountOfFontTypes( | 49 void getCountOfFontTypes( |
57 int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1], | 50 int counts[SkAdvancedTypefaceMetrics::kOther_Font + 1], |
58 int* notSubsettableCount, | 51 int* notSubsettableCount, |
59 int* notEmbedddableCount) const; | 52 int* notEmbedddableCount) const; |
60 | 53 |
61 private: | 54 private: |
62 SkTDArray<SkPDFDevice*> fPageDevices; | 55 SkTDArray<const SkPDFDevice*> fPageDevices; |
63 }; | 56 }; |
64 | 57 |
65 #endif | 58 #endif |
OLD | NEW |