Code

fix build breakers
[inkscape.git] / src / extension / internal / pdf-cairo.h
1 #ifndef EXTENSION_INTERNAL_PDF_CAIRO_H_SEEN
2 #define EXTENSION_INTERNAL_PDF_CAIRO_H_SEEN
4 /** \file
5  * Declaration of PrintCairoPDF, the internal module used to do PDF printing with Cairo.
6  */
7 /*
8  * Authors:
9  *         Lauris Kaplinski <lauris@kaplinski.com>
10  *         Ted Gould <ted@gould.cx>
11  *
12  * Lauris' original code is in the public domain.
13  * Ted's changes are licensed under the GNU GPL.
14  */
16 #include <config.h>
17 #include "extension/extension.h"
18 #include "extension/implementation/implementation.h"
19 #include <set>
20 #include <string>
22 #include "libnr/nr-path.h"
23 #include "libnrtype/font-instance.h"
25 #include "svg/stringstream.h"
26 #include "sp-gradient.h"
28 #include <cairo.h>
30 namespace Inkscape {
31 namespace Extension {
32 namespace Internal {
34 class PrintCairoPDF : public Inkscape::Extension::Implementation::Implementation {
35     float _width;
36     float _height;
37     FILE *_stream;
38     cairo_t *cr;
39     cairo_surface_t *pdf_surface;
40     PangoLayout *_layout;
41 //    PangoContext *_context;
42     float *_alpha_stack;
43     int _num_alphas, _alpha_ptr;
44     double _last_tx, _last_ty;
45     
46     unsigned short _dpi;
47     bool _bitmap;
49     void print_bpath(cairo_t *cr, NArtBpath const *bp);
50     cairo_pattern_t *create_pattern_for_paint(SPPaintServer const *const paintserver, NRRect const *pbox, float alpha);
51     
52     void print_fill_style(cairo_t *cr, SPStyle const *const style, NRRect const *pbox);
53     void print_stroke_style(cairo_t *cr, SPStyle const *style, NRRect const *pbox);
55 #ifndef USE_PANGO_CAIRO
56     NR::Point draw_glyphs(cairo_t *cr, NR::Point p, PangoFont *font, PangoGlyphString *glyph_string,
57                           bool vertical, bool stroke);
58 #endif
60 public:
61     PrintCairoPDF(void);
62     virtual ~PrintCairoPDF(void);
64     /* Print functions */
65     virtual unsigned int setup(Inkscape::Extension::Print *module);
66     /*
67       virtual unsigned int set_preview(Inkscape::Extension::Print *module);
68     */
70     virtual unsigned int begin(Inkscape::Extension::Print *module, SPDocument *doc);
71     virtual unsigned int finish(Inkscape::Extension::Print *module);
73     /* Rendering methods */
74     virtual unsigned int bind(Inkscape::Extension::Print *module, NRMatrix const *transform, float opacity);
75     virtual unsigned int release(Inkscape::Extension::Print *module);
76     virtual unsigned int comment(Inkscape::Extension::Print *module, char const *comment);
77     virtual unsigned int fill(Inkscape::Extension::Print *module, NRBPath const *bpath, NRMatrix const *ctm, SPStyle const *style,
78                               NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
79     virtual unsigned int stroke(Inkscape::Extension::Print *module, NRBPath const *bpath, NRMatrix const *transform, SPStyle const *style,
80                                 NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
81     virtual unsigned int image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
82                                NRMatrix const *transform, SPStyle const *style);
83     virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
84                               NR::Point p, SPStyle const *style);
86     bool textToPath(Inkscape::Extension::Print *ext);
87     static void init(void);
88 };
90 }  /* namespace Internal */
91 }  /* namespace Extension */
92 }  /* namespace Inkscape */
95 #endif /* !EXTENSION_INTERNAL_PDF_CAIRO_H_SEEN */
97 /*
98   Local Variables:
99   mode:c++
100   c-file-style:"stroustrup"
101   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
102   indent-tabs-mode:nil
103   fill-column:99
104   End:
105 */
106 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :