Index: include/core/SkDocument.h |
diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..27c4667a16ff765cb9891c45d6265984598a6043 |
--- /dev/null |
+++ b/include/core/SkDocument.h |
@@ -0,0 +1,48 @@ |
+/* |
+ * Copyright 2013 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#ifndef SkDocument_DEFINED |
+#define SkDocument_DEFINED |
+ |
+#include "SkRect.h" |
+#include "SkRefCnt.h" |
+ |
+class SkCanvas; |
+class SkWStream; |
+ |
+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.
|
+public: |
+ static SkDocument* CreatePDF(const char filename[]); |
+ static SkDocument* CreatePDF(SkWStream*); |
+ |
+ SkCanvas* beginPage(SkScalar width, SkScalar height, |
+ const SkRect* content = NULL); |
+ void endPage(); |
+ void close(); |
+ |
+protected: |
+ SkDocument(SkWStream*); |
+ virtual ~SkDocument(); |
+ |
+ virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height, |
+ const SkRect& content) = 0; |
+ virtual void onEndPage() = 0; |
+ virtual void onClose(SkWStream*) = 0; |
+ |
+ enum State { |
+ kBetweenPages_State, |
+ kInPage_State, |
+ kClosed_State |
+ }; |
+ State getState() const { return fState; } |
+ |
+private: |
+ SkWStream* fStream; |
+ State fState; |
+}; |
+ |
+#endif |