From e74a1db5b3fcd1af2c8373e74791b918f5fe4ea7 Mon Sep 17 00:00:00 2001 From: Matthew Leibowitz Date: Mon, 20 Mar 2017 22:04:24 +0200 Subject: [PATCH] Added the bindings for XPS documents --- include/c/sk_document.h | 6 ++---- src/c/sk_document.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/include/c/sk_document.h b/include/c/sk_document.h index 23c6d94..4cc0097 100644 --- a/include/c/sk_document.h +++ b/include/c/sk_document.h @@ -21,16 +21,14 @@ SK_C_API sk_document_t* sk_document_create_pdf_from_stream(sk_wstream_t* stream, SK_C_API sk_document_t* sk_document_create_pdf_from_stream_with_metadata(sk_wstream_t* stream, float dpi, const sk_document_pdf_metadata_t* metadata); SK_C_API sk_document_t* sk_document_create_pdf_from_filename(const char* path, float dpi); -//SK_C_API sk_document_t* sk_document_create_xps_from_stream(sk_wstream_t* stream, float dpi); -//SK_C_API sk_document_t* sk_document_create_xps_from_filename(const char* path, float dpi); +SK_C_API sk_document_t* sk_document_create_xps_from_stream(sk_wstream_t* stream, float dpi); +SK_C_API sk_document_t* sk_document_create_xps_from_filename(const char* path, float dpi); SK_C_API sk_canvas_t* sk_document_begin_page(sk_document_t* document, float width, float height, const sk_rect_t* content); SK_C_API void sk_document_end_page(sk_document_t* document); SK_C_API void sk_document_close(sk_document_t* document); SK_C_API void sk_document_abort(sk_document_t* document); -// TODO: setMetadata - SK_C_PLUS_PLUS_END_GUARD #endif diff --git a/src/c/sk_document.cpp b/src/c/sk_document.cpp index 2b4be05..3587a43 100644 --- a/src/c/sk_document.cpp +++ b/src/c/sk_document.cpp @@ -29,13 +29,13 @@ sk_document_t* sk_document_create_pdf_from_filename(const char* path, float dpi) return ToDocument(SkDocument::MakePDF(path, dpi).release()); } -//sk_document_t* sk_document_create_xps_from_stream(sk_wstream_t* stream, float dpi) { -// return ToDocument(SkDocument::CreateXPS(AsWStream(stream), dpi)); -//} -// -//sk_document_t* sk_document_create_xps_from_filename(const char* path, float dpi) { -// return ToDocument(SkDocument::CreateXPS(path, dpi)); -//} +sk_document_t* sk_document_create_xps_from_stream(sk_wstream_t* stream, float dpi) { + return ToDocument(SkDocument::MakeXPS(AsWStream(stream), dpi).release()); +} + +sk_document_t* sk_document_create_xps_from_filename(const char* path, float dpi) { + return ToDocument(SkDocument::MakeXPS(path, dpi).release()); +} sk_canvas_t* sk_document_begin_page(sk_document_t* document, float width, float height, const sk_rect_t* content) { return ToCanvas(AsDocument(document)->beginPage(width, height, AsRect(content))); -- 2.7.4