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