OpenASIP  2.0
EPSDC.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file EPSDC.hh
26  *
27  * Declaration of EPSDC class.
28  *
29  * @author Veli-Pekka Jääskeläinen 2005 (vjaaskel-no.spam-cs.tut.fi)
30  * @note rating: red
31  */
32 
33 #ifndef TTA_EPS_DC_HH
34 #define TTA_EPS_DC_HH
35 
36 #include <wx/wx.h>
37 #include "EPSGenerator.hh"
38 
39 // TODO: this module is commented out for wxwidgets version 3
40 // and needs to be rewritten
41 #if !wxCHECK_VERSION(3, 0, 0)
42 /**
43  * Encapsulated postscript device context.
44  *
45  * EPSDC is a wxWidgets device context for drawing graphics and text to
46  * an eps file.
47  */
48 class EPSDC : public wxDC {
49 public:
50  EPSDC();
51  virtual ~EPSDC();
52 
53  virtual bool Ok() const;
54  virtual void BeginDrawing();
55  virtual void EndDrawing();
56 
57  virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
58  virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
59  virtual void DoCrossHair(wxCoord x, wxCoord y);
60  virtual void DoDrawPoint(wxCoord x, wxCoord y);
61  virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
62  virtual void DoDrawLines(
63  int n,
64  wxPoint points[],
65  wxCoord xoffset,
66  wxCoord yoffset);
67 
68  virtual void DoDrawArc(
69  wxCoord x1,
70  wxCoord y1,
71  wxCoord x2,
72  wxCoord y2,
73  wxCoord xc,
74  wxCoord yc);
75 
76  virtual void DoDrawEllipticArc(
77  wxCoord x,
78  wxCoord y,
79  wxCoord width,
80  wxCoord height,
81  double start,
82  double end);
83 
84  virtual bool DoFloodFill(
85  wxCoord x,
86  wxCoord y,
87  const wxColour& colour,
88  int style);
89 
90  virtual void DoDrawBitmap(
91  const wxBitmap& bitmap,
92  wxCoord x,
93  wxCoord y,
94  bool transparent);
95 
96  virtual void DoDrawPolygon(
97  int n,
98  wxPoint points[],
99  wxCoord xoffset = 0,
100  wxCoord yoffset = 0,
101  int fillStyle = wxODDEVEN_RULE);
102 
103  virtual void DoDrawRectangle(
104  wxCoord x,
105  wxCoord y,
106  wxCoord width,
107  wxCoord height);
108 
109  virtual void DoDrawRoundedRectangle(
110  wxCoord x,
111  wxCoord y,
112  wxCoord width,
113  wxCoord height,
114  double radius = 20);
115 
116  virtual void DoDrawEllipse(
117  wxCoord x,
118  wxCoord y,
119  wxCoord width,
120  wxCoord height);
121 
122  virtual void DoDrawRotatedText(
123  const wxString& text,
124  wxCoord x,
125  wxCoord y,
126  double angle);
127 
128  virtual bool DoBlit(
129  wxCoord xdest,
130  wxCoord ydest,
131  wxCoord width,
132  wxCoord height,
133  wxDC* source,
134  wxCoord xsrc,
135  wxCoord ysrc,
136  int logicalFunc = wxCOPY,
137  bool useMask = false,
138  wxCoord xsrcMask = -1,
139  wxCoord ysrcMask = -1);
140 
141  virtual void DoGetSize(wxCoord* width, wxCoord* height) const;
142 
143  virtual void DoGetTextExtent(
144  const wxString& text,
145  wxCoord* w,
146  wxCoord* h,
147  wxCoord* descent = NULL,
148  wxCoord* externalLeading = NULL,
149  wxFont* font = NULL) const;
150 
151  virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour* colour) const;
152 
153  virtual void DoSetClippingRegionAsRegion(const wxRegion& region);
154 
155  virtual bool CanDrawBitmap() const;
156  virtual bool CanGetTextExtent() const;
157 
158  virtual void Clear();
159 
160  virtual void SetFont(const wxFont& font);
161  virtual void SetPen(const wxPen& pen);
162  virtual void SetBrush(const wxBrush& brush);
163  virtual void SetBackground(const wxBrush& brush);
164  virtual void SetBackgroundMode(int mode);
165  virtual void SetPalette(const wxPalette& palette);
166  virtual void SetLogicalFunction(int function);
167 
168  virtual wxCoord GetCharHeight() const;
169  virtual wxCoord GetCharWidth() const;
170  virtual int GetDepth() const;
171 
172  virtual bool StartDoc(const wxString& message);
173  virtual void EndDoc();
174  virtual void StartPage();
175  virtual void EndPage();
176 
177  void setTitle(const std::string& title);
178  void setCreator(const std::string& creator);
179 
180  void writeToStream(std::ostream& stream);
181 
182 private:
183 
184  void setLineColour(const wxColour& colour);
185  void setFillColour(const wxColour& colour);
186  void drawCircle(int x, int y, unsigned radius);
187 
188  /// EPSGenerator generating the postscript code.
190  /// True, if background brush is set to fill the shapes.
191  bool fill_;
192  /// Current font size.
193  unsigned fontSize_;
194 };
195 
196 #endif
197 #endif
EPSDC::DoDrawRectangle
virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
Definition: EPSDC.cc:111
EPSDC::GetCharHeight
virtual wxCoord GetCharHeight() const
Definition: EPSDC.cc:532
EPSDC::SetPen
virtual void SetPen(const wxPen &pen)
Definition: EPSDC.cc:158
EPSDC::DoBlit
virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, int logicalFunc=wxCOPY, bool useMask=false, wxCoord xsrcMask=-1, wxCoord ysrcMask=-1)
Definition: EPSDC.cc:386
EPSDC::EndDoc
virtual void EndDoc()
Definition: EPSDC.cc:576
EPSDC::setLineColour
void setLineColour(const wxColour &colour)
Definition: EPSDC.cc:408
EPSDC::DoFloodFill
virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour &colour, int style)
Definition: EPSDC.cc:255
EPSGenerator.hh
EPSDC::Ok
virtual bool Ok() const
Definition: EPSDC.cc:57
mode
mode
Definition: tceopgen.cc:45
EPSDC::StartDoc
virtual bool StartDoc(const wxString &message)
Definition: EPSDC.cc:231
EPSDC::DoSetClippingRegionAsRegion
virtual void DoSetClippingRegionAsRegion(const wxRegion &region)
Definition: EPSDC.cc:480
EPSGenerator
Definition: EPSGenerator.hh:54
EPSDC::DoDrawBitmap
virtual void DoDrawBitmap(const wxBitmap &bitmap, wxCoord x, wxCoord y, bool transparent)
Definition: EPSDC.cc:293
EPSDC::setFillColour
void setFillColour(const wxColour &colour)
Definition: EPSDC.cc:421
EPSDC::~EPSDC
virtual ~EPSDC()
Definition: EPSDC.cc:48
EPSDC::DoGetTextExtent
virtual void DoGetTextExtent(const wxString &text, wxCoord *w, wxCoord *h, wxCoord *descent=NULL, wxCoord *externalLeading=NULL, wxFont *font=NULL) const
Definition: EPSDC.cc:453
EPSDC::BeginDrawing
virtual void BeginDrawing()
Definition: EPSDC.cc:300
EPSDC::StartPage
virtual void StartPage()
Definition: EPSDC.cc:560
EPSDC::DoDrawRotatedText
virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle)
Definition: EPSDC.cc:240
EPSDC::Clear
virtual void Clear()
Definition: EPSDC.cc:136
EPSDC::DoDrawIcon
virtual void DoDrawIcon(const wxIcon &icon, wxCoord x, wxCoord y)
Definition: EPSDC.cc:278
EPSDC::SetPalette
virtual void SetPalette(const wxPalette &palette)
Definition: EPSDC.cc:515
EPSDC::setTitle
void setTitle(const std::string &title)
Definition: EPSDC.cc:189
EPSDC::writeToStream
void writeToStream(std::ostream &stream)
Definition: EPSDC.cc:209
EPSDC::DoDrawPoint
virtual void DoDrawPoint(wxCoord x, wxCoord y)
Definition: EPSDC.cc:248
EPSDC::EPSDC
EPSDC()
Definition: EPSDC.cc:42
EPSDC::SetBackgroundMode
virtual void SetBackgroundMode(int mode)
Definition: EPSDC.cc:507
EPSDC
Definition: EPSDC.hh:48
EPSDC::CanDrawBitmap
virtual bool CanDrawBitmap() const
Definition: EPSDC.cc:220
EPSDC::DoDrawLine
virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
Definition: EPSDC.cc:70
EPSDC::DoDrawArc
virtual void DoDrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc)
Definition: EPSDC.cc:271
EPSDC::DoDrawRoundedRectangle
virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius=20)
Definition: EPSDC.cc:343
EPSDC::GetCharWidth
virtual wxCoord GetCharWidth() const
Definition: EPSDC.cc:542
EPSDC::SetLogicalFunction
virtual void SetLogicalFunction(int function)
Definition: EPSDC.cc:522
EPSDC::CanGetTextExtent
virtual bool CanGetTextExtent() const
Definition: EPSDC.cc:490
EPSDC::SetBrush
virtual void SetBrush(const wxBrush &brush)
Definition: EPSDC.cc:171
EPSDC::EndDrawing
virtual void EndDrawing()
Definition: EPSDC.cc:308
EPSDC::EndPage
virtual void EndPage()
Definition: EPSDC.cc:568
EPSDC::DoCrossHair
virtual void DoCrossHair(wxCoord x, wxCoord y)
Definition: EPSDC.cc:285
EPSDC::SetFont
virtual void SetFont(const wxFont &font)
Definition: EPSDC.cc:148
EPSDC::DoDrawLines
virtual void DoDrawLines(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset)
Definition: EPSDC.cc:318
EPSDC::fill_
bool fill_
True, if background brush is set to fill the shapes.
Definition: EPSDC.hh:191
EPSDC::SetBackground
virtual void SetBackground(const wxBrush &brush)
Definition: EPSDC.cc:499
EPSDC::DoDrawEllipticArc
virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord width, wxCoord height, double start, double end)
Definition: EPSDC.cc:330
EPSDC::DoGetSize
virtual void DoGetSize(wxCoord *width, wxCoord *height) const
Definition: EPSDC.cc:264
EPSDC::DoDrawText
virtual void DoDrawText(const wxString &text, wxCoord x, wxCoord y)
Definition: EPSDC.cc:127
EPSDC::DoDrawEllipse
virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
Definition: EPSDC.cc:361
EPSDC::DoGetPixel
virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *colour) const
Definition: EPSDC.cc:472
EPSDC::setCreator
void setCreator(const std::string &creator)
Definition: EPSDC.cc:199
EPSDC::GetDepth
virtual int GetDepth() const
Definition: EPSDC.cc:552
EPSDC::DoDrawPolygon
virtual void DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset=0, wxCoord yoffset=0, int fillStyle=wxODDEVEN_RULE)
Definition: EPSDC.cc:83
EPSDC::eps_
EPSGenerator eps_
EPSGenerator generating the postscript code.
Definition: EPSDC.hh:189
EPSDC::drawCircle
void drawCircle(int x, int y, unsigned radius)
Definition: EPSDC.cc:437
EPSDC::fontSize_
unsigned fontSize_
Current font size.
Definition: EPSDC.hh:193