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 | 8 |
9 #ifndef SkPdfRenderer_DEFINED | 9 #ifndef SkPdfRenderer_DEFINED |
10 #define SkPdfRenderer_DEFINED | 10 #define SkPdfRenderer_DEFINED |
11 | 11 |
12 class SkBitmap; | 12 class SkBitmap; |
13 class SkCanvas; | 13 class SkCanvas; |
14 class SkNativeParsedPDF; | 14 class SkPdfNativeDoc; |
15 struct SkRect; | 15 struct SkRect; |
16 class SkStream; | 16 class SkStream; |
17 | 17 |
18 enum SkPdfContent { | 18 enum SkPdfContent { |
19 kNoForms_SkPdfContent, | 19 kNoForms_SkPdfContent, |
20 kAll_SkPdfContent, | 20 kAll_SkPdfContent, |
21 }; | 21 }; |
22 | 22 |
23 // TODO(edisonn): move in another file | 23 // TODO(edisonn): move in another file |
24 class SkPdfRenderer : public SkRefCnt { | 24 class SkPdfRenderer : public SkRefCnt { |
25 SkNativeParsedPDF* fPdfDoc; | 25 SkPdfNativeDoc* fPdfDoc; |
26 public: | 26 public: |
27 SkPdfRenderer() : fPdfDoc(NULL) {} | 27 SkPdfRenderer() : fPdfDoc(NULL) {} |
28 virtual ~SkPdfRenderer() {unload();} | 28 virtual ~SkPdfRenderer() {unload();} |
29 | 29 |
30 // TODO(edisonn): add options to render forms, or not | 30 // TODO(edisonn): add options to render forms, or not |
31 bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const; | 31 bool renderPage(int page, SkCanvas* canvas, const SkRect& dst) const; |
32 | 32 |
33 bool load(const SkString inputFileName); | 33 bool load(const SkString inputFileName); |
34 bool load(SkStream* stream); | 34 bool load(SkStream* stream); |
35 bool loaded() const {return fPdfDoc != NULL;} | 35 bool loaded() const {return fPdfDoc != NULL;} |
36 int pages() const; | 36 int pages() const; |
37 void unload(); | 37 void unload(); |
38 SkRect MediaBox(int page) const; | 38 SkRect MediaBox(int page) const; |
39 size_t bytesUsed() const; | 39 size_t bytesUsed() const; |
40 }; | 40 }; |
41 | 41 |
42 void reportPdfRenderStats(); | 42 void reportPdfRenderStats(); |
43 | 43 |
44 bool SkPDFNativeRenderToBitmap(SkStream* stream, | 44 bool SkPDFNativeRenderToBitmap(SkStream* stream, |
45 SkBitmap* output, | 45 SkBitmap* output, |
46 int page = 0, | 46 int page = 0, |
47 SkPdfContent content = kAll_SkPdfContent, | 47 SkPdfContent content = kAll_SkPdfContent, |
48 double dpi = 72.0); | 48 double dpi = 72.0); |
49 | 49 |
50 #endif // SkPdfRenderer_DEFINED | 50 #endif // SkPdfRenderer_DEFINED |
OLD | NEW |