]>
Commit | Line | Data |
---|---|---|
8acd14d1 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/graphdc.h | |
3 | // Purpose: graphics context device bridge header | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: | |
7 | // Copyright: (c) Stefan Csomor | |
8 | // RCS-ID: $Id$ | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_GRAPHICS_DC_H_ | |
13 | #define _WX_GRAPHICS_DC_H_ | |
14 | ||
15 | #if wxUSE_GRAPHICS_CONTEXT | |
16 | ||
11a0827d | 17 | #include "wx/dc.h" |
8acd14d1 SC |
18 | #include "wx/geometry.h" |
19 | #include "wx/dynarray.h" | |
2b73854d | 20 | #include "wx/graphics.h" |
8acd14d1 | 21 | |
b5dbe15d | 22 | class WXDLLIMPEXP_FWD_CORE wxWindowDC; |
8acd14d1 | 23 | |
8acd14d1 | 24 | |
888dde65 | 25 | class WXDLLEXPORT wxGCDC: public wxDC |
8acd14d1 | 26 | { |
888dde65 RR |
27 | public: |
28 | wxGCDC( const wxWindowDC& dc ); | |
29 | wxGCDC( const wxMemoryDC& dc ); | |
30 | wxGCDC(); | |
4dd36d1d SC |
31 | virtual ~wxGCDC(); |
32 | ||
888dde65 RR |
33 | wxGraphicsContext* GetGraphicsContext(); |
34 | void SetGraphicsContext( wxGraphicsContext* ctx ); | |
35 | ||
36 | private: | |
8acd14d1 SC |
37 | DECLARE_DYNAMIC_CLASS(wxGCDC) |
38 | DECLARE_NO_COPY_CLASS(wxGCDC) | |
888dde65 | 39 | }; |
8acd14d1 | 40 | |
888dde65 RR |
41 | |
42 | ||
43 | class WXDLLEXPORT wxGCDCImpl: public wxDCImpl | |
44 | { | |
8acd14d1 | 45 | public: |
888dde65 RR |
46 | wxGCDCImpl( wxDC *owner, const wxWindowDC& dc ); |
47 | wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ); | |
48 | wxGCDCImpl( wxDC *owner ); | |
49 | ||
50 | virtual ~wxGCDCImpl(); | |
8acd14d1 SC |
51 | |
52 | void Init(); | |
53 | ||
54 | ||
55 | // implement base class pure virtuals | |
56 | // ---------------------------------- | |
57 | ||
58 | virtual void Clear(); | |
59 | ||
cc18b1c7 SC |
60 | virtual bool StartDoc( const wxString& message ); |
61 | virtual void EndDoc(); | |
62 | ||
63 | virtual void StartPage(); | |
64 | virtual void EndPage(); | |
65 | ||
66 | // flushing the content of this dc immediately onto screen | |
67 | virtual void Flush(); | |
8acd14d1 SC |
68 | |
69 | virtual void SetFont(const wxFont& font); | |
70 | virtual void SetPen(const wxPen& pen); | |
71 | virtual void SetBrush(const wxBrush& brush); | |
72 | virtual void SetBackground(const wxBrush& brush); | |
73 | virtual void SetBackgroundMode(int mode); | |
74 | virtual void SetPalette(const wxPalette& palette); | |
75 | ||
76 | virtual void DestroyClippingRegion(); | |
77 | ||
78 | virtual wxCoord GetCharHeight() const; | |
79 | virtual wxCoord GetCharWidth() const; | |
80 | ||
81 | virtual bool CanDrawBitmap() const; | |
82 | virtual bool CanGetTextExtent() const; | |
83 | virtual int GetDepth() const; | |
84 | virtual wxSize GetPPI() const; | |
85 | ||
86 | virtual void SetMapMode(int mode); | |
8acd14d1 | 87 | |
8acd14d1 SC |
88 | virtual void SetLogicalFunction(int function); |
89 | ||
90 | virtual void SetTextForeground(const wxColour& colour); | |
91 | virtual void SetTextBackground(const wxColour& colour); | |
92 | ||
93 | virtual void ComputeScaleAndOrigin(); | |
94 | ||
b687dd2f PC |
95 | wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; } |
96 | virtual void SetGraphicsContext( wxGraphicsContext* ctx ); | |
ddb0ed69 | 97 | |
8acd14d1 SC |
98 | protected: |
99 | // the true implementations | |
100 | virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, | |
101 | int style = wxFLOOD_SURFACE); | |
102 | ||
103 | virtual void DoGradientFillLinear(const wxRect& rect, | |
104 | const wxColour& initialColour, | |
105 | const wxColour& destColour, | |
106 | wxDirection nDirection = wxEAST); | |
107 | ||
108 | virtual void DoGradientFillConcentric(const wxRect& rect, | |
109 | const wxColour& initialColour, | |
110 | const wxColour& destColour, | |
111 | const wxPoint& circleCenter); | |
112 | ||
113 | virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; | |
114 | ||
115 | virtual void DoDrawPoint(wxCoord x, wxCoord y); | |
116 | ||
117 | #if wxUSE_SPLINES | |
b0d7707b | 118 | virtual void DoDrawSpline(const wxPointList *points); |
8acd14d1 SC |
119 | #endif |
120 | ||
121 | virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
122 | ||
123 | virtual void DoDrawArc(wxCoord x1, wxCoord y1, | |
124 | wxCoord x2, wxCoord y2, | |
125 | wxCoord xc, wxCoord yc); | |
126 | ||
127 | virtual void DoDrawCheckMark(wxCoord x, wxCoord y, | |
128 | wxCoord width, wxCoord height); | |
129 | ||
130 | virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, | |
131 | double sa, double ea); | |
132 | ||
133 | virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
134 | virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, | |
135 | wxCoord width, wxCoord height, | |
136 | double radius); | |
137 | virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
138 | ||
139 | virtual void DoCrossHair(wxCoord x, wxCoord y); | |
140 | ||
141 | virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); | |
142 | virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, | |
143 | bool useMask = false); | |
144 | ||
145 | virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
146 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, | |
147 | double angle); | |
148 | ||
149 | virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
150 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
151 | int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); | |
152 | ||
e3b81044 VZ |
153 | virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest, |
154 | wxCoord dstWidth, wxCoord dstHeight, | |
155 | wxDC *source, | |
156 | wxCoord xsrc, wxCoord ysrc, | |
157 | wxCoord srcWidth, wxCoord srcHeight, | |
158 | int rop = wxCOPY, bool useMask = false, | |
159 | wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); | |
160 | ||
8acd14d1 SC |
161 | virtual void DoGetSize(int *,int *) const; |
162 | virtual void DoGetSizeMM(int* width, int* height) const; | |
163 | ||
164 | virtual void DoDrawLines(int n, wxPoint points[], | |
165 | wxCoord xoffset, wxCoord yoffset); | |
166 | virtual void DoDrawPolygon(int n, wxPoint points[], | |
167 | wxCoord xoffset, wxCoord yoffset, | |
168 | int fillStyle = wxODDEVEN_RULE); | |
169 | virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], | |
170 | wxCoord xoffset, wxCoord yoffset, | |
171 | int fillStyle); | |
172 | ||
173 | virtual void DoSetClippingRegionAsRegion(const wxRegion& region); | |
174 | virtual void DoSetClippingRegion(wxCoord x, wxCoord y, | |
175 | wxCoord width, wxCoord height); | |
176 | ||
177 | virtual void DoGetTextExtent(const wxString& string, | |
178 | wxCoord *x, wxCoord *y, | |
179 | wxCoord *descent = NULL, | |
180 | wxCoord *externalLeading = NULL, | |
c94f845b | 181 | const wxFont *theFont = NULL) const; |
8acd14d1 SC |
182 | |
183 | virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; | |
184 | ||
185 | protected: | |
186 | // scaling variables | |
4280b879 | 187 | bool m_logicalFunctionSupported; |
8acd14d1 | 188 | double m_mm_to_pix_x, m_mm_to_pix_y; |
2b73854d SC |
189 | wxGraphicsMatrix m_matrixOriginal; |
190 | wxGraphicsMatrix m_matrixCurrent; | |
b687dd2f PC |
191 | |
192 | double m_formerScaleX, m_formerScaleY; | |
8acd14d1 SC |
193 | |
194 | wxGraphicsContext* m_graphicContext; | |
888dde65 RR |
195 | |
196 | private: | |
197 | DECLARE_CLASS(wxGCDCImpl) | |
198 | DECLARE_NO_COPY_CLASS(wxGCDCImpl) | |
8acd14d1 SC |
199 | }; |
200 | ||
201 | #endif | |
202 | ||
203 | #endif // _WX_GRAPHICS_DC_H_ |