OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkDocument_DEFINED | 8 #ifndef SkDocument_DEFINED |
9 #define SkDocument_DEFINED | 9 #define SkDocument_DEFINED |
10 | 10 |
11 #include "SkRect.h" | 11 #include "SkRect.h" |
12 #include "SkRefCnt.h" | 12 #include "SkRefCnt.h" |
13 | 13 |
14 class SkCanvas; | 14 class SkCanvas; |
15 class SkWStream; | 15 class SkWStream; |
16 | 16 |
17 /** | 17 /** |
18 * High-level API for creating a document-based canvas. To use.. | 18 * High-level API for creating a document-based canvas. To use.. |
19 * | 19 * |
20 * 1. Create a document, specifying a stream to store the output. | 20 * 1. Create a document, specifying a stream to store the output. |
21 * 2. For each "page" of content: | 21 * 2. For each "page" of content: |
22 * a. canvas = doc->beginPage(...) | 22 * a. canvas = doc->beginPage(...) |
23 * b. draw_my_content(canvas); | 23 * b. draw_my_content(canvas); |
24 * c. doc->endPage(); | 24 * c. doc->endPage(); |
25 * 3. Close the document with doc->close(). | 25 * 3. Close the document with doc->close(). |
26 */ | 26 */ |
27 class SkDocument : public SkRefCnt { | 27 class SkDocument : public SkRefCnt { |
28 public: | 28 public: |
| 29 SK_DECLARE_INST_COUNT(SkDocument) |
| 30 |
29 /** | 31 /** |
30 * Create a PDF-backed document, writing the results into a file. | 32 * Create a PDF-backed document, writing the results into a file. |
31 * If there is an error trying to create the doc, returns NULL. | 33 * If there is an error trying to create the doc, returns NULL. |
32 */ | 34 */ |
33 static SkDocument* CreatePDF(const char filename[]); | 35 static SkDocument* CreatePDF(const char filename[]); |
34 | 36 |
35 /** | 37 /** |
36 * Create a PDF-backed document, writing the results into a stream. | 38 * Create a PDF-backed document, writing the results into a stream. |
37 * If there is an error trying to create the doc, returns NULL. | 39 * If there is an error trying to create the doc, returns NULL. |
38 * | 40 * |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 kBetweenPages_State, | 84 kBetweenPages_State, |
83 kInPage_State, | 85 kInPage_State, |
84 kClosed_State | 86 kClosed_State |
85 }; | 87 }; |
86 State getState() const { return fState; } | 88 State getState() const { return fState; } |
87 | 89 |
88 private: | 90 private: |
89 SkWStream* fStream; | 91 SkWStream* fStream; |
90 void (*fDoneProc)(SkWStream*); | 92 void (*fDoneProc)(SkWStream*); |
91 State fState; | 93 State fState; |
| 94 |
| 95 typedef SkRefCnt INHERITED; |
92 }; | 96 }; |
93 | 97 |
94 #endif | 98 #endif |
OLD | NEW |