1 #ifndef EXTENSION_INTERNAL_PDF_H_SEEN\r
2 #define EXTENSION_INTERNAL_PDF_H_SEEN\r
3 \r
4 /*\r
5 * Authors:\r
6 * Lauris Kaplinski <lauris@kaplinski.com>\r
7 * Ted Gould <ted@gould.cx>\r
8 * Ulf Erikson <ulferikson@users.sf.net>\r
9 *\r
10 * Lauris' original code is in the public domain.\r
11 * Ted's changes are licensed under the GNU GPL.\r
12 */\r
13 \r
14 #include <config.h>\r
15 #include "extension/extension.h"\r
16 #include "extension/implementation/implementation.h"\r
17 #include <set>\r
18 #include <string>\r
19 \r
20 #include "libnr/nr-path.h"\r
21 \r
22 #include "svg/stringstream.h"\r
23 \r
24 class PdfFile;\r
25 class PdfObject;\r
26 \r
27 namespace Inkscape {\r
28 namespace Extension {\r
29 namespace Internal {\r
30 \r
31 class PrintPDF : public Inkscape::Extension::Implementation::Implementation {\r
32 float _width;\r
33 float _height;\r
34 FILE *_stream;\r
35 PdfFile *pdf_file;\r
36 PdfObject *doc_info;\r
37 PdfObject *page_stream;\r
38 std::vector<float> _pushed_alphas;\r
39 unsigned short _dpi;\r
40 bool _bitmap;\r
41 std::set<std::string> _latin1_encoded_fonts;\r
42 bool _newlatin1font_proc_defined;\r
43 \r
44 void print_bpath(SVGOStringStream &os, NArtBpath const *bp);\r
45 \r
46 void print_fill_style(SVGOStringStream &os, SPStyle const *style, NRRect const *pbox);\r
47 void print_fill_alpha(SVGOStringStream &os, SPStyle const *style, NRRect const *pbox);\r
48 void print_stroke_style(SVGOStringStream &os, SPStyle const *style);\r
49 \r
50 char const *PSFontName(SPStyle const *style);\r
51 \r
52 unsigned int print_image(FILE *ofp, guchar *px, unsigned int width, unsigned int height, unsigned int rs,\r
53 NRMatrix const *transform);\r
54 void compress_packbits(int nin, guchar *src, int *nout, guchar *dst);\r
55 \r
56 /* ASCII 85 variables */\r
57 guint32 ascii85_buf;\r
58 int ascii85_len;\r
59 int ascii85_linewidth;\r
60 /* ASCII 85 Functions */\r
61 void ascii85_init(void);\r
62 void ascii85_flush(SVGOStringStream &os);\r
63 inline void ascii85_out(guchar byte, SVGOStringStream &os);\r
64 void ascii85_nout(int n, guchar *uptr, SVGOStringStream &os);\r
65 void ascii85_done(SVGOStringStream &os);\r
66 \r
67 \r
68 public:\r
69 PrintPDF(void);\r
70 virtual ~PrintPDF(void);\r
71 \r
72 /* Print functions */\r
73 virtual unsigned int setup(Inkscape::Extension::Print *module);\r
74 /*\r
75 virtual unsigned int set_preview(Inkscape::Extension::Print *module);\r
76 */\r
77 \r
78 virtual unsigned int begin(Inkscape::Extension::Print *module, SPDocument *doc);\r
79 virtual unsigned int finish(Inkscape::Extension::Print *module);\r
80 \r
81 /* Rendering methods */\r
82 virtual unsigned int bind(Inkscape::Extension::Print *module, NRMatrix const *transform, float opacity);\r
83 virtual unsigned int release(Inkscape::Extension::Print *module);\r
84 virtual unsigned int comment(Inkscape::Extension::Print *module, char const *comment);\r
85 virtual unsigned int fill(Inkscape::Extension::Print *module, NRBPath const *bpath, NRMatrix const *ctm, SPStyle const *style,\r
86 NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);\r
87 virtual unsigned int stroke(Inkscape::Extension::Print *module, NRBPath const *bpath, NRMatrix const *transform, SPStyle const *style,\r
88 NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);\r
89 virtual unsigned int image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,\r
90 NRMatrix const *transform, SPStyle const *style);\r
91 virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,\r
92 NR::Point p, SPStyle const *style);\r
93 \r
94 bool textToPath(Inkscape::Extension::Print *ext);\r
95 static void init(void);\r
96 };\r
97 \r
98 } /* namespace Internal */\r
99 } /* namespace Extension */\r
100 } /* namespace Inkscape */\r
101 \r
102 \r
103 #endif /* !EXTENSION_INTERNAL_PDF_H_SEEN */\r
104 \r
105 /*\r
106 Local Variables:\r
107 mode:c++\r
108 c-file-style:"stroustrup"\r
109 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))\r
110 indent-tabs-mode:nil\r
111 fill-column:99\r
112 End:\r
113 */\r
114 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :\r