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

Unified Diff: include/core/SkDocument.h

Issue 32233003: Add DPI stettings to SkDocument::CreatePDF(). Tests will be added in a future cl, once DPI will be … (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add comments Created 7 years, 2 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 | « no previous file | include/pdf/SkPDFDevice.h » ('j') | include/pdf/SkPDFDevice.h » ('J')
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 b941d1bd19ce775be0c83c474dcb42ba5e0f4dc9..66946fe7c5a20a0db7b87bd2af826111ba352012 100644
--- a/include/core/SkDocument.h
+++ b/include/core/SkDocument.h
@@ -16,6 +16,10 @@
class SkCanvas;
class SkWStream;
+/** SK_ScalarDefaultDPI is 72 DPI.
+*/
+#define SK_ScalarDefaultRasterDPI SkFloatToScalar(72.0f)
+
/**
* High-level API for creating a document-based canvas. To use..
*
@@ -35,9 +39,19 @@ public:
* If there is an error trying to create the doc, returns NULL.
* encoder sets the DCTEncoder for images, to encode a bitmap
* as JPEG (DCT).
+ * rasterDpi - the DPI at which features without native PDF support
+ * will be rasterized (e.g. draw image with perspective,
+ * draw text with perspective, ...)
+ * A larger DPI would create a PDF that reflects the original
+ * intent with better fidelity, but it can make for larger
+ * PDF files too, which would use more memory while rendering,
+ * and it would be slower to be processed or sent online or
+ * to printer.
*/
- static SkDocument* CreatePDF(const char filename[],
- SkPicture::EncodeBitmap encoder = NULL);
+ static SkDocument* CreatePDF(
+ const char filename[],
+ SkPicture::EncodeBitmap encoder = NULL,
+ SkScalar rasterDpi = SK_ScalarDefaultRasterDPI);
/**
* Create a PDF-backed document, writing the results into a stream.
@@ -50,9 +64,18 @@ public:
* The proc can delete the stream, or whatever it needs to do.
* encoder sets the DCTEncoder for images, to encode a bitmap
* as JPEG (DCT).
- */
- static SkDocument* CreatePDF(SkWStream*, void (*Done)(SkWStream*) = NULL,
- SkPicture::EncodeBitmap encoder = NULL);
+ * rasterDpi - the DPI at which features without native PDF support
+ * will be rasterized (e.g. draw image with perspective,
+ * draw text with perspective, ...)
+ * A larger DPI would create a PDF that reflects the original
+ * intent with better fidelity, but it can make for larger
+ * PDF files too, which would use more memory while rendering,
+ * and it would be slower to be processed or sent online or
+ * to printer. */
+ static SkDocument* CreatePDF(
+ SkWStream*, void (*Done)(SkWStream*) = NULL,
+ SkPicture::EncodeBitmap encoder = NULL,
+ SkScalar rasterDpi = SK_ScalarDefaultRasterDPI);
/**
* Begin a new page for the document, returning the canvas that will draw
« no previous file with comments | « no previous file | include/pdf/SkPDFDevice.h » ('j') | include/pdf/SkPDFDevice.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698