1 #ifndef __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__
2 #define __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__
4 /*
5 * Enhanced Metafile Printing.
6 *
7 * Author:
8 * Ulf Erikson <ulferikson@users.sf.net>
9 *
10 * Copyright (C) 2006-2008 Authors
11 *
12 * Released under GNU GPL, read the file 'COPYING' for more information
13 */
15 #ifdef WIN32
17 #ifdef HAVE_CONFIG_H
18 # include "config.h"
19 #endif
21 #include "extension/implementation/implementation.h"
22 #include "extension/extension.h"
24 #include "svg/stringstream.h"
25 #include "libnr/nr-matrix.h"
26 #include "libnr/nr-rect.h"
28 #define WIN32_LEAN_AND_MEAN
29 #include <windows.h>
31 #include <stack>
33 namespace Inkscape {
34 namespace Extension {
35 namespace Internal {
37 class PrintEmfWin32 : public Inkscape::Extension::Implementation::Implementation
38 {
39 double _width;
40 double _height;
41 HDC hdc;
42 RECT rc;
44 HBRUSH hbrush, hbrushOld;
45 HPEN hpen, hpenOld;
47 std::stack<NR::Matrix> m_tr_stack;
48 NArtBpath *fill_path;
49 NArtBpath *fill_path_copy;
50 NR::Matrix fill_transform;
51 NRRect fill_pbox;
52 // NR::Matrix text_transform;
53 bool stroke_and_fill;
54 bool fill_only;
55 bool simple_shape;
57 unsigned int print_bpath (const NArtBpath *bp, const NR::Matrix *transform, NRRect const *pbox);
58 bool print_simple_shape (const NArtBpath *bp, const NR::Matrix *transform, NRRect const *pbox);
60 public:
61 PrintEmfWin32 (void);
62 virtual ~PrintEmfWin32 (void);
64 /* Print functions */
65 virtual unsigned int setup (Inkscape::Extension::Print * module);
67 virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc);
68 virtual unsigned int finish (Inkscape::Extension::Print * module);
70 /* Rendering methods */
71 virtual unsigned int bind(Inkscape::Extension::Print *module, NR::Matrix const *transform, float opacity);
72 virtual unsigned int release(Inkscape::Extension::Print *module);
73 virtual unsigned int fill (Inkscape::Extension::Print * module,
74 const const_NRBPath *bpath, const NR::Matrix *ctm, const SPStyle *style,
75 const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
76 virtual unsigned int stroke (Inkscape::Extension::Print * module,
77 const const_NRBPath *bpath, const NR::Matrix *transform, const SPStyle *style,
78 const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
79 virtual unsigned int comment(Inkscape::Extension::Print *module, const char * comment);
80 virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
81 NR::Point p, SPStyle const *style);
82 bool textToPath (Inkscape::Extension::Print * ext);
84 static void init (void);
86 protected:
87 int create_brush(SPStyle const *style);
89 void destroy_brush();
91 void create_pen(SPStyle const *style, const NR::Matrix *transform);
93 void destroy_pen();
95 void flush_fill();
97 NArtBpath *copy_bpath(const NArtBpath *bp);
98 int cmp_bpath(const NArtBpath *bp1, const NArtBpath *bp2);
100 };
102 } /* namespace Internal */
103 } /* namespace Extension */
104 } /* namespace Inkscape */
106 #endif /* WIN32 */
108 #endif /* __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__ */
110 /*
111 Local Variables:
112 mode:cpp
113 c-file-style:"stroustrup"
114 c-file-offsets:((innamespace . 0)(inline-open . 0))
115 indent-tabs-mode:nil
116 fill-column:99
117 End:
118 */
119 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :