| OLD | NEW |
| (Empty) |
| 1 | |
| 2 /* | |
| 3 * Copyright 2010 The Android Open Source Project | |
| 4 * | |
| 5 * Use of this source code is governed by a BSD-style license that can be | |
| 6 * found in the LICENSE file. | |
| 7 */ | |
| 8 | |
| 9 | |
| 10 #ifndef SkPDFPage_DEFINED | |
| 11 #define SkPDFPage_DEFINED | |
| 12 | |
| 13 #include "SkPDFTypes.h" | |
| 14 #include "SkPDFStream.h" | |
| 15 #include "SkRefCnt.h" | |
| 16 #include "SkTDArray.h" | |
| 17 | |
| 18 class SkPDFCatalog; | |
| 19 class SkPDFDevice; | |
| 20 class SkWStream; | |
| 21 | |
| 22 /** \class SkPDFPage | |
| 23 | |
| 24 A SkPDFPage contains meta information about a page, is used in the page | |
| 25 tree and points to the content of the page. | |
| 26 */ | |
| 27 class SkPDFPage : public SkPDFDict { | |
| 28 SK_DECLARE_INST_COUNT(SkPDFPage) | |
| 29 public: | |
| 30 /** Create a PDF page with the passed PDF device. The device need not | |
| 31 * have content on it yet. | |
| 32 * @param content The page content. | |
| 33 */ | |
| 34 explicit SkPDFPage(const SkPDFDevice* content); | |
| 35 ~SkPDFPage(); | |
| 36 | |
| 37 /** Before a page and its contents can be sized and emitted, it must | |
| 38 * be finalized. No changes to the PDFDevice will be honored after | |
| 39 * finalizePage has been called. | |
| 40 */ | |
| 41 void finalizePage(); | |
| 42 | |
| 43 /** Add destinations for this page to the supplied dictionary. | |
| 44 * @param dict Dictionary to add destinations to. | |
| 45 */ | |
| 46 void appendDestinations(SkPDFDict* dict); | |
| 47 | |
| 48 /** Generate a page tree for the passed vector of pages. New objects are | |
| 49 * added to the catalog. The pageTree vector is populated with all of | |
| 50 * the 'Pages' dictionaries as well as the 'Page' objects. Page trees | |
| 51 * have both parent and children links, creating reference cycles, so | |
| 52 * it must be torn down explicitly. The first page is not added to | |
| 53 * the pageTree dictionary array so the caller can handle it specially. | |
| 54 * @param pages The ordered vector of page objects. | |
| 55 * @param pageTree An output vector with all of the internal and leaf | |
| 56 * nodes of the pageTree. | |
| 57 * @param rootNode An output parameter set to the root node. | |
| 58 */ | |
| 59 static void GeneratePageTree(const SkTDArray<SkPDFPage*>& pages, | |
| 60 SkTDArray<SkPDFDict*>* pageTree, | |
| 61 SkPDFDict** rootNode); | |
| 62 | |
| 63 /** Get the fonts used on this page. | |
| 64 */ | |
| 65 const SkTDArray<SkPDFFont*>& getFontResources() const; | |
| 66 | |
| 67 /** Returns a SkPDFGlyphSetMap which represents glyph usage of every font | |
| 68 * that shows on this page. | |
| 69 */ | |
| 70 const SkPDFGlyphSetMap& getFontGlyphUsage() const; | |
| 71 | |
| 72 SkPDFObject* getContentStream() const; | |
| 73 | |
| 74 private: | |
| 75 // Multiple pages may reference the content. | |
| 76 SkAutoTUnref<const SkPDFDevice> fDevice; | |
| 77 | |
| 78 // Once the content is finalized, put it into a stream for output. | |
| 79 SkAutoTUnref<SkPDFStream> fContentStream; | |
| 80 typedef SkPDFDict INHERITED; | |
| 81 }; | |
| 82 | |
| 83 #endif | |
| OLD | NEW |