Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2013 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SkDocument_DEFINED | |
| 9 #define SkDocument_DEFINED | |
| 10 | |
| 11 #include "SkRect.h" | |
| 12 #include "SkRefCnt.h" | |
| 13 | |
| 14 class SkCanvas; | |
| 15 class SkWStream; | |
| 16 | |
| 17 class SkDocument : public SkRefCnt { | |
|
epoger
2013/06/07 19:39:04
Since this is going in include/core , can you plea
reed1
2013/06/07 19:50:40
Done.
| |
| 18 public: | |
| 19 static SkDocument* CreatePDF(const char filename[]); | |
| 20 static SkDocument* CreatePDF(SkWStream*); | |
| 21 | |
| 22 SkCanvas* beginPage(SkScalar width, SkScalar height, | |
| 23 const SkRect* content = NULL); | |
| 24 void endPage(); | |
| 25 void close(); | |
| 26 | |
| 27 protected: | |
| 28 SkDocument(SkWStream*); | |
| 29 virtual ~SkDocument(); | |
| 30 | |
| 31 virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height, | |
| 32 const SkRect& content) = 0; | |
| 33 virtual void onEndPage() = 0; | |
| 34 virtual void onClose(SkWStream*) = 0; | |
| 35 | |
| 36 enum State { | |
| 37 kBetweenPages_State, | |
| 38 kInPage_State, | |
| 39 kClosed_State | |
| 40 }; | |
| 41 State getState() const { return fState; } | |
| 42 | |
| 43 private: | |
| 44 SkWStream* fStream; | |
| 45 State fState; | |
| 46 }; | |
| 47 | |
| 48 #endif | |
| OLD | NEW |