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 "libnr/nr-matrix.h"
25 //#include "libnr/nr-rect.h"
26 #include <2geom/pathvector.h>
28 #include <stack>
30 namespace Inkscape {
31 namespace Extension {
32 namespace Internal {
34 class PrintEmfWin32 : public Inkscape::Extension::Implementation::Implementation
35 {
36 double _width;
37 double _height;
38 HDC hdc;
39 RECT rc;
41 HBRUSH hbrush, hbrushOld;
42 HPEN hpen, hpenOld;
44 std::stack<Geom::Matrix> m_tr_stack;
45 Geom::PathVector fill_pathv;
46 Geom::Matrix fill_transform;
47 bool stroke_and_fill;
48 bool fill_only;
49 bool simple_shape;
51 unsigned int print_pathv (Geom::PathVector const &pathv, const Geom::Matrix &transform);
52 bool print_simple_shape (Geom::PathVector const &pathv, const Geom::Matrix &transform);
54 public:
55 PrintEmfWin32 (void);
56 virtual ~PrintEmfWin32 (void);
58 /* Print functions */
59 virtual unsigned int setup (Inkscape::Extension::Print * module);
61 virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc);
62 virtual unsigned int finish (Inkscape::Extension::Print * module);
64 /* Rendering methods */
65 virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Matrix const *transform, float opacity);
66 virtual unsigned int release(Inkscape::Extension::Print *module);
67 virtual unsigned int fill (Inkscape::Extension::Print * module,
68 Geom::PathVector const &pathv, const Geom::Matrix *ctm, const SPStyle *style,
69 const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
70 virtual unsigned int stroke (Inkscape::Extension::Print * module,
71 Geom::PathVector const &pathv, const Geom::Matrix *transform, const SPStyle *style,
72 const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
73 virtual unsigned int comment(Inkscape::Extension::Print *module, const char * comment);
74 virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
75 Geom::Point p, SPStyle const *style);
76 bool textToPath (Inkscape::Extension::Print * ext);
78 static void init (void);
80 protected:
81 int create_brush(SPStyle const *style);
83 void destroy_brush();
85 void create_pen(SPStyle const *style, const Geom::Matrix &transform);
87 void destroy_pen();
89 void flush_fill();
91 };
93 } /* namespace Internal */
94 } /* namespace Extension */
95 } /* namespace Inkscape */
97 #endif /* WIN32 */
99 #endif /* __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__ */
101 /*
102 Local Variables:
103 mode:cpp
104 c-file-style:"stroustrup"
105 c-file-offsets:((innamespace . 0)(inline-open . 0))
106 indent-tabs-mode:nil
107 fill-column:99
108 End:
109 */
110 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :