Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: include/core/SkDocument.h

Issue 16660002: SkDocument base for pdf, xps, etc. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 {
+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
« no previous file with comments | « gyp/tools.gyp ('k') | src/doc/SkDocument.cpp » ('j') | src/doc/SkDocument_PDF.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698