Scribus
Open source desktop publishing at your fingertips
wmfcontext.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 
8 #ifndef WMFCONTEXT_H
9 #define WMFCONTEXT_H
10 
11 #include <QBrush>
12 #include <QFont>
13 #include <QTransform>
14 #include <QPen>
15 #include <QPoint>
16 #include <QSize>
17 #include <QStack>
18 #include "fpointarray.h"
19 
21 {
22 protected:
23 
24  QPointF windowOrg;
25  QSizeF windowExt;
26  QPointF viewportOrg;
27  QSizeF viewportExt;
28 
29  void updateWorldMatrix(void);
30 
31 public:
32  QFont font;
33  QPoint position;
34  QPen pen;
35  QBrush brush;
36  QColor backgroundColor;
37  Qt::BGMode backgroundMode;
38  QColor textColor;
39  int textAlign;
40  int textCharset;
41  double textRotation;
42  bool windingFill;
43  FPointArray path;
44  QTransform worldMatrix;
45 
46 public:
47  WMFGraphicsState(void);
48 
49  void setWindowOrg(double x, double y);
50  void setWindowExt(double x, double y);
51  void setViewportOrg(double x, double y);
52  void setViewportExt(double x, double y);
53 };
54 
55 class WMFContext : public QStack<WMFGraphicsState>
56 {
57 public:
58 
59  WMFContext(void);
60 
61  void save(void);
62  void restore(void);
63  void reset(void);
64 
65  WMFGraphicsState& current(void);
66 
67  QFont font(void) { return current().font; }
68  QPoint position(void) { return current().position; }
69  QPen pen(void) { return current().pen; }
70  QBrush brush(void) { return current().brush; }
71  QColor backgroundColor(void) { return current().backgroundColor; }
72  Qt::BGMode backgroundMode(void) { return current().backgroundMode; }
73  QColor textColor(void) { return current().textColor; }
74  int textAlign(void) { return current().textAlign; }
75  int textCharSet(void) { return current().textCharset; }
76  double textRotation(void) { return current().textRotation; }
77  bool windingFill(void) { return current().windingFill; }
78  FPointArray& path (void) { return current().path; }
79  QTransform& worldMatrix (void) { return current().worldMatrix; }
80  void setFont (const QFont& font) { current().font = font; }
81  void setPosition (const QPoint& pos) { current().position = pos; }
82  void setPen (const QPen& pen) { current().pen = pen; }
83  void setBrush (const QBrush& brush) { current().brush = brush; }
84  void setBackgroundColor (const QColor& color) { current().backgroundColor = color; }
85  void setBackgroundMode (const Qt::BGMode& mode) { current().backgroundMode = mode; }
86  void setTextColor (const QColor& color) { current().textColor = color; }
87  void setTextAlign (int align) { current().textAlign = align; }
88  void setTextCharset(int align) { current().textCharset = align; }
89  void setTextRotation (double rot) { current().textRotation = rot; }
90  void setWindingFill (const bool winding) { current().windingFill = winding; }
91  void setPath (const FPointArray& path) { current().path = path; }
92  void setWorldMatrix (const QTransform& matrix) { current().worldMatrix = matrix; }
93 
94  // window operations
95  void setWindowOrg(double x, double y) { current().setWindowOrg(x, y); }
96  void setWindowExt(double x, double y) { current().setWindowExt(x, y); }
97  void setViewportOrg(double x, double y) { current().setViewportOrg(x, y); }
98  void setViewportExt(double x, double y) { current().setViewportExt(x, y); }
99 
100  // matrix operations
101  void translate (double x, double y) { current().worldMatrix.translate(x, y); }
102  void scale (double x, double y) { current().worldMatrix.scale(x, y); }
103  void rotate (double deg) { current().worldMatrix.rotate(deg); }
104 };
105 
106 
107 #endif
Definition: wmfcontext.h:20
Definition: wmfcontext.h:55
Definition: fpointarray.h:42