1 /** @file
2 * @brief Enhanced Metafile printing - implementation
3 */
4 /* Author:
5 * Ulf Erikson <ulferikson@users.sf.net>
6 *
7 * Copyright (C) 2006-2008 Authors
8 *
9 * Released under GNU GPL, read the file 'COPYING' for more information
10 */
11 #ifndef __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__
12 #define __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__
14 #ifdef WIN32
16 #ifdef HAVE_CONFIG_H
17 # include "config.h"
18 #endif
20 #include "extension/implementation/implementation.h"
21 //#include "extension/extension.h"
23 //#include "libnr/nr-matrix.h"
24 //#include "libnr/nr-rect.h"
25 #include <2geom/pathvector.h>
27 #include <stack>
29 namespace Inkscape {
30 namespace Extension {
31 namespace Internal {
33 class PrintEmfWin32 : public Inkscape::Extension::Implementation::Implementation
34 {
35 double _width;
36 double _height;
37 HDC hdc;
38 RECT rc;
40 HBRUSH hbrush, hbrushOld;
41 HPEN hpen, hpenOld;
43 std::stack<Geom::Matrix> m_tr_stack;
44 Geom::PathVector fill_pathv;
45 Geom::Matrix fill_transform;
46 bool stroke_and_fill;
47 bool fill_only;
48 bool simple_shape;
50 unsigned int print_pathv (Geom::PathVector const &pathv, const Geom::Matrix &transform);
51 bool print_simple_shape (Geom::PathVector const &pathv, const Geom::Matrix &transform);
53 public:
54 PrintEmfWin32 (void);
55 virtual ~PrintEmfWin32 (void);
57 /* Print functions */
58 virtual unsigned int setup (Inkscape::Extension::Print * module);
60 virtual unsigned int begin (Inkscape::Extension::Print * module, SPDocument *doc);
61 virtual unsigned int finish (Inkscape::Extension::Print * module);
63 /* Rendering methods */
64 virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Matrix const *transform, float opacity);
65 virtual unsigned int release(Inkscape::Extension::Print *module);
66 virtual unsigned int fill (Inkscape::Extension::Print * module,
67 Geom::PathVector const &pathv, const Geom::Matrix *ctm, const SPStyle *style,
68 const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
69 virtual unsigned int stroke (Inkscape::Extension::Print * module,
70 Geom::PathVector const &pathv, const Geom::Matrix *transform, const SPStyle *style,
71 const NRRect *pbox, const NRRect *dbox, const NRRect *bbox);
72 virtual unsigned int comment(Inkscape::Extension::Print *module, const char * comment);
73 virtual unsigned int text(Inkscape::Extension::Print *module, char const *text,
74 Geom::Point p, SPStyle const *style);
75 bool textToPath (Inkscape::Extension::Print * ext);
77 static void init (void);
79 protected:
80 int create_brush(SPStyle const *style);
82 void destroy_brush();
84 void create_pen(SPStyle const *style, const Geom::Matrix &transform);
86 void destroy_pen();
88 void flush_fill();
90 };
92 } /* namespace Internal */
93 } /* namespace Extension */
94 } /* namespace Inkscape */
96 #endif /* WIN32 */
98 #endif /* __INKSCAPE_EXTENSION_INTERNAL_PRINT_EMF_WIN32_H__ */
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 :