Code

change HAVE_PANGO_CAIRO to RENDER_WITH_PANGO_CAIRO
[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 #ifdef HAVE_CONFIG_H
17 # include "config.h"
18 #endif
20 #include "extension/extension.h"
21 #include "extension/implementation/implementation.h"
22 #include <set>
23 #include <string>
25 #include "libnr/nr-path.h"
26 #include "libnrtype/font-instance.h"
28 #include "svg/stringstream.h"
29 #include "sp-gradient.h"
31 #include <cairo.h>
33 namespace Inkscape {
34 namespace Extension {
35 namespace Internal {
37 class PrintCairoPDF : public Inkscape::Extension::Implementation::Implementation {
38     float _width;
39     float _height;
40     FILE *_stream;
41     cairo_t *cr;
42     cairo_surface_t *pdf_surface;
43     PangoLayout *_layout;
44 //    PangoContext *_context;
45     float *_alpha_stack;
46     int _num_alphas, _alpha_ptr;
47     double _last_tx, _last_ty;
48     
49     unsigned short _dpi;
50     bool _bitmap;
52     void print_bpath(cairo_t *cr, NArtBpath const *bp);
53     cairo_pattern_t *create_pattern_for_paint(SPPaintServer const *const paintserver, NRRect const *pbox, float alpha);
54     
55     void print_fill_style(cairo_t *cr, SPStyle const *const style, NRRect const *pbox);
56     void print_stroke_style(cairo_t *cr, SPStyle const *style, NRRect const *pbox);
58 #ifndef RENDER_WITH_PANGO_CAIRO
59     NR::Point draw_glyphs(cairo_t *cr, NR::Point p, PangoFont *font, PangoGlyphString *glyph_string,
60                           bool vertical, bool stroke);
61 #endif
63 public:
64     PrintCairoPDF(void);
65     virtual ~PrintCairoPDF(void);
67     /* Print functions */
68     virtual unsigned int setup(Inkscape::Extension::Print *module);
69     /*
70       virtual unsigned int set_preview(Inkscape::Extension::Print *module);
71     */
73     virtual unsigned int begin(Inkscape::Extension::Print *module, SPDocument *doc);
74     virtual unsigned int finish(Inkscape::Extension::Print *module);
76     /* Rendering methods */
77     virtual unsigned int bind(Inkscape::Extension::Print *module, NRMatrix const *transform, float opacity);
78     virtual unsigned int release(Inkscape::Extension::Print *module);
79     virtual unsigned int comment(Inkscape::Extension::Print *module, char const *comment);
80     virtual unsigned int fill(Inkscape::Extension::Print *module, NRBPath const *bpath, NRMatrix const *ctm, SPStyle const *style,
81                               NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
82     virtual unsigned int stroke(Inkscape::Extension::Print *module, NRBPath const *bpath, NRMatrix const *transform, SPStyle const *style,
83                                 NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
84     virtual unsigned int image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
85                                NRMatrix const *transform, SPStyle const *style);
86     virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
87                               NR::Point p, SPStyle const *style);
89     bool textToPath(Inkscape::Extension::Print *ext);
90     static void init(void);
91 };
93 }  /* namespace Internal */
94 }  /* namespace Extension */
95 }  /* namespace Inkscape */
98 #endif /* !EXTENSION_INTERNAL_PDF_CAIRO_H_SEEN */
100 /*
101   Local Variables:
102   mode:c++
103   c-file-style:"stroustrup"
104   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
105   indent-tabs-mode:nil
106   fill-column:99
107   End:
108 */
109 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :