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

Side by Side Diff: site/user/sample/pdf.md

Issue 2377473002: SkPDF/Documentation: backend limitations (Closed)
Patch Set: more tweeks Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Using Skia's PDF Backend 1 Using Skia's PDF Backend
2 ======================== 2 ========================
3 3
4 Here is an example of using Skia's PDF backend in the recommended way: 4 Here is an example of using Skia's PDF backend (SkPDF) via the
5 via the SkDocument and SkCanvas APIs. 5 SkDocument and SkCanvas APIs.
6 6
7 <!--?prettify lang=cc?--> 7 <!--?prettify lang=cc?-->
8 8
9 #include "SkDocument.h" 9 #include "SkDocument.h"
10 10
11 bool WritePDF(SkWStream* outputStream) { 11 bool WritePDF(SkWStream* outputStream) {
12 SkDocument::PDFMetadata metadata; 12 SkDocument::PDFMetadata metadata;
13 metadata.fCreator = "creator...."; 13 metadata.fCreator = "creator....";
14 metadata.fTitle = "title..."; 14 metadata.fTitle = "title...";
15 metadata.fAuthor = "author..."; 15 metadata.fAuthor = "author...";
(...skipping 16 matching lines...) Expand all
32 SkScalar pageHeight = ....; 32 SkScalar pageHeight = ....;
33 SkCanvas* pageCanvas = 33 SkCanvas* pageCanvas =
34 pdfDocument->beginPage(pageWidth, pageHeight); 34 pdfDocument->beginPage(pageWidth, pageHeight);
35 35
36 // ....insert canvas draw commands here.... 36 // ....insert canvas draw commands here....
37 37
38 pdfDocument->endPage(); 38 pdfDocument->endPage();
39 } 39 }
40 return pdfDocument->close(); 40 return pdfDocument->close();
41 } 41 }
42
43 * * *
44
45 <span id="limits">SkPDF Limitations</span>
46 ------------------------------------------
47
48 There are several corners of Skia's public API that SkPDF currently
49 does not handle because either no known client uses the feature or
50 there is no simple PDF-ish way to handle it.
51
52 In this document:
53
54 + **drop** means to draw nothing.
55
56 + **ignore** mean to draw without the effect
57
58 + **expand** means to implement something in a non-PDF-ish way.
59 This may mean to rasterize vector graphics, to expand paths with
60 path effects into many individual paths, or to convert text to
61 paths.
62
63 <style scoped><!--
64 #pdftable {border-collapse:collapse;}
65 #pdftable tr th, #pdftable tr td {border:#888888 2px solid;padding: 5px;}
66 --></style>
67 <table id="pdftable">
68 <tr><th>Effect</th> <th>text</th> <th>images</th> <th>everyth ing
69 else</t h></tr>
70 <tr><th>SkMaskFilter</th> <td>drop</td> <td>ignore</td> <td>ignore< /td></tr>
71 <tr><th>SkPathEffect</th> <td>ignore</td> <td>n/a</td> <td>expand< /td></tr>
72 <tr><th>SkColorFilter</th> <td>ignore</td> <td>expand</td> <td>ignore< /td></tr>
73 <tr><th>SkImageFilter</th> <td>expand</td> <td>expand</td> <td>expand< /td></tr>
74 <tr><th>unsupported SkXferModes</th> <td>ignore</td> <td>ignore</td> <td>ignore< /td></tr>
75 <tr><th>non-gradient SkShader</th> <td>expand</td> <td>n/a</td> <td>expand< /td></tr>
76 </table>
77
78 Notes:
79
80 - *SkImageFilter*: When SkImageFilter is expanded, text-as-text is lost.
81
82 - *SkXferMode*: The following transfer modes are not natively
83 supported by PDF: DstOver, SrcIn, DstIn, SrcOut, DstOut, SrcATop,
84 DstATop, and Modulate.
85
86 Other limitations:
87
88 - *drawText with VerticalText* — drop. No known clients seem to make use
89 of the VerticalText flag.
90
91 - *drawTextOnPath* — expand. (Text-as-text is lost.)
92
93 - *drawVertices* — drop.
94
95 - *drawPatch* — drop.
96
97 * * *
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698