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

Unified Diff: include/core/SkDocument.h

Issue 1359943003: SkPDF: add basic metadata support (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: style change Created 5 years, 3 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
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | include/core/SkTArray.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkDocument.h
diff --git a/include/core/SkDocument.h b/include/core/SkDocument.h
index a35f448208701d4c76af7eafb9a57ab56618fbd9..316d15a253429ea07c7b40e102a8e22f36e8e6d8 100644
--- a/include/core/SkDocument.h
+++ b/include/core/SkDocument.h
@@ -12,6 +12,8 @@
#include "SkPicture.h"
#include "SkRect.h"
#include "SkRefCnt.h"
+#include "SkString.h"
+#include "SkTime.h"
class SkCanvas;
class SkWStream;
@@ -104,6 +106,33 @@ public:
*/
void abort();
+ /**
+ * Set the document's metadata, if supported by the document
+ * type. The creationDate and modifiedDate parameters can be
+ * nullptr. For example:
+ *
+ * SkDocument* make_doc(SkWStream* output) {
+ * SkTArray<SkDocument::Attribute> info;
+ * info.emplace_back(SkString("Title"), SkString("..."));
+ * info.emplace_back(SkString("Author"), SkString("..."));
+ * info.emplace_back(SkString("Subject"), SkString("..."));
+ * info.emplace_back(SkString("Keywords"), SkString("..."));
+ * info.emplace_back(SkString("Creator"), SkString("..."));
+ * SkTime::DateTime now;
+ * SkTime::GetDateTime(&now);
+ * SkDocument* doc = SkDocument::CreatePDF(output);
+ * doc->setMetadata(info, &now, &now);
+ * return doc;
+ * }
+ */
+ struct Attribute {
+ SkString fKey, fValue;
+ Attribute(const SkString& k, const SkString& v) : fKey(k), fValue(v) {}
+ };
+ virtual void setMetadata(const SkTArray<SkDocument::Attribute>&,
+ const SkTime::DateTime* /* creationDate */,
+ const SkTime::DateTime* /* modifiedDate */) {}
+
protected:
SkDocument(SkWStream*, void (*)(SkWStream*, bool aborted));
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | include/core/SkTArray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698