~centralelyon2010/inkscape/imagelinks2

« back to all changes in this revision

Viewing changes to src/extension/internal/pdf-cairo.h

  • Committer: Ted Gould
  • Date: 2008-11-21 05:24:08 UTC
  • Revision ID: ted@canonical.com-20081121052408-tilucis2pjrrpzxx
MergeĀ fromĀ fe-moved

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef EXTENSION_INTERNAL_PDF_CAIRO_H_SEEN
2
 
#define EXTENSION_INTERNAL_PDF_CAIRO_H_SEEN
3
 
 
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
 
 */
15
 
 
16
 
#ifdef HAVE_CONFIG_H
17
 
# include "config.h"
18
 
#endif
19
 
 
20
 
#ifdef HAVE_CAIRO_PDF
21
 
 
22
 
#include "extension/extension.h"
23
 
#include "extension/implementation/implementation.h"
24
 
#include <set>
25
 
#include <string>
26
 
 
27
 
#include "libnrtype/font-instance.h"
28
 
 
29
 
#include "svg/stringstream.h"
30
 
#include "sp-gradient.h"
31
 
 
32
 
#include <cairo.h>
33
 
 
34
 
namespace Inkscape {
35
 
namespace Extension {
36
 
namespace Internal {
37
 
 
38
 
class PrintCairoPDF : public Inkscape::Extension::Implementation::Implementation {
39
 
    float _width;
40
 
    float _height;
41
 
    FILE *_stream;
42
 
    cairo_t *cr;
43
 
    cairo_surface_t *pdf_surface;
44
 
    PangoLayout *_layout;
45
 
//    PangoContext *_context;
46
 
    std::vector<float> _alpha_stack;
47
 
    double _last_tx, _last_ty;
48
 
    
49
 
    unsigned short _dpi;
50
 
    bool _bitmap;
51
 
 
52
 
    cairo_pattern_t *create_pattern_for_paint(SPPaintServer const *const paintserver, NRRect const *pbox, float alpha);
53
 
    
54
 
    void print_fill_style(cairo_t *cr, SPStyle const *const style, NRRect const *pbox);
55
 
    void print_stroke_style(cairo_t *cr, SPStyle const *style, NRRect const *pbox);
56
 
 
57
 
#ifndef RENDER_WITH_PANGO_CAIRO
58
 
    Geom::Point draw_glyphs(cairo_t *cr, Geom::Point p, PangoFont *font, PangoGlyphString *glyph_string,
59
 
                          bool vertical, bool stroke);
60
 
#endif
61
 
 
62
 
public:
63
 
    PrintCairoPDF(void);
64
 
    virtual ~PrintCairoPDF(void);
65
 
 
66
 
    /* Print functions */
67
 
    virtual unsigned int setup(Inkscape::Extension::Print *module);
68
 
    /*
69
 
      virtual unsigned int set_preview(Inkscape::Extension::Print *module);
70
 
    */
71
 
 
72
 
    virtual unsigned int begin(Inkscape::Extension::Print *module, SPDocument *doc);
73
 
    virtual unsigned int finish(Inkscape::Extension::Print *module);
74
 
 
75
 
    /* Rendering methods */
76
 
    virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Matrix const *transform, float opacity);
77
 
    virtual unsigned int release(Inkscape::Extension::Print *module);
78
 
    virtual unsigned int comment(Inkscape::Extension::Print *module, char const *comment);
79
 
    virtual unsigned int fill(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, Geom::Matrix const *ctm, SPStyle const *style,
80
 
                              NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
81
 
    virtual unsigned int stroke(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, Geom::Matrix const *transform, SPStyle const *style,
82
 
                                NRRect const *pbox, NRRect const *dbox, NRRect const *bbox);
83
 
    virtual unsigned int image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs,
84
 
                               Geom::Matrix const *transform, SPStyle const *style);
85
 
    virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
86
 
                              Geom::Point p, SPStyle const *style);
87
 
 
88
 
    bool textToPath(Inkscape::Extension::Print *ext);
89
 
    static void init(void);
90
 
};
91
 
 
92
 
}  /* namespace Internal */
93
 
}  /* namespace Extension */
94
 
}  /* namespace Inkscape */
95
 
 
96
 
#endif /* HAVE_CAIRO_PDF */
97
 
 
98
 
#endif /* !EXTENSION_INTERNAL_PDF_CAIRO_H_SEEN */
99
 
 
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 :