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"
27 #include <2geom/pathvector.h>
29 #define WIN32_LEAN_AND_MEAN
30 #include <windows.h>
32 #include <stack>
34 namespace Inkscape {
35 namespace Extension {
36 namespace Internal {
38 class PrintEmfWin32 : public Inkscape::Extension::Implementation::Implementation
39 {
40 double _width;
41 double _height;
42 HDC hdc;
43 RECT rc;
45 HBRUSH hbrush, hbrushOld;
46 HPEN hpen, hpenOld;
48 std::stack<Geom::Matrix> m_tr_stack;
49 NArtBpath *fill_path;
50 Geom::Matrix fill_transform;
51 // Geom::Matrix text_transform;
52 bool stroke_and_fill;
53 bool fill_only;
54 bool simple_shape;
56 unsigned int print_bpath (const NArtBpath *bp, const Geom::Matrix &transform);
57 bool print_simple_shape (const NArtBpath *bp, const Geom::Matrix &transform);
59 public:
60 PrintEmfWin32 (void);
61 virtual ~PrintEmfWin32 (void);
63 /* Print functions */
64 virtual unsigned int setup (Inkscape::Extension::Print * module);
66 virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc);
67 virtual unsigned int finish (Inkscape::Extension::Print * module);
69 /* Rendering methods */
70 virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Matrix const *transform, float opacity);
71 virtual unsigned int release(Inkscape::Extension::Print *module);
72 virtual unsigned int fill (Inkscape::Extension::Print * module,
73 Geom::PathVector const &pathv, const Geom::Matrix *ctm, const SPStyle *style,
74 const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
75 virtual unsigned int stroke (Inkscape::Extension::Print * module,
76 Geom::PathVector const &pathv, const Geom::Matrix *transform, const SPStyle *style,
77 const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
78 virtual unsigned int comment(Inkscape::Extension::Print *module, const char * comment);
79 virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
80 Geom::Point p, SPStyle const *style);
81 bool textToPath (Inkscape::Extension::Print * ext);
83 static void init (void);
85 protected:
86 int create_brush(SPStyle const *style);
88 void destroy_brush();
90 void create_pen(SPStyle const *style, const Geom::Matrix *transform);
92 void destroy_pen();
94 void flush_fill();
96 NArtBpath *copy_bpath(const NArtBpath *bp);
97 int cmp_bpath(const NArtBpath *bp1, const NArtBpath *bp2);
99 };
101 } /* namespace Internal */
102 } /* namespace Extension */
103 } /* namespace Inkscape */
105 #endif /* WIN32 */
107 #endif /* __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__ */
109 /*
110 Local Variables:
111 mode:cpp
112 c-file-style:"stroustrup"
113 c-file-offsets:((innamespace . 0)(inline-open . 0))
114 indent-tabs-mode:nil
115 fill-column:99
116 End:
117 */
118 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :