]>
Commit | Line | Data |
---|---|---|
8acd14d1 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/dcgraph.h |
8acd14d1 SC |
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 | 18 | #include "wx/geometry.h" |
2b73854d | 19 | #include "wx/graphics.h" |
8acd14d1 | 20 | |
b5dbe15d | 21 | class WXDLLIMPEXP_FWD_CORE wxWindowDC; |
8acd14d1 | 22 | |
8acd14d1 | 23 | |
53a2db12 | 24 | class WXDLLIMPEXP_CORE wxGCDC: public wxDC |
8acd14d1 | 25 | { |
888dde65 RR |
26 | public: |
27 | wxGCDC( const wxWindowDC& dc ); | |
28 | wxGCDC( const wxMemoryDC& dc ); | |
220d37c8 | 29 | #if wxUSE_PRINTING_ARCHITECTURE |
b25c34aa | 30 | wxGCDC( const wxPrinterDC& dc ); |
2d770c4f VZ |
31 | #endif |
32 | #if defined(__WXMSW__) && wxUSE_ENH_METAFILE | |
33 | wxGCDC( const wxEnhMetaFileDC& dc ); | |
220d37c8 | 34 | #endif |
932d0768 RD |
35 | wxGCDC(wxGraphicsContext* context); |
36 | ||
888dde65 | 37 | wxGCDC(); |
4dd36d1d | 38 | virtual ~wxGCDC(); |
03647350 | 39 | |
6c0e710f | 40 | wxGraphicsContext* GetGraphicsContext() const; |
888dde65 | 41 | void SetGraphicsContext( wxGraphicsContext* ctx ); |
03647350 | 42 | |
942d5e2d VZ |
43 | #ifdef __WXMSW__ |
44 | // override wxDC virtual functions to provide access to HDC associated with | |
45 | // this Graphics object (implemented in src/msw/graphics.cpp) | |
46 | virtual WXHDC AcquireHDC(); | |
47 | virtual void ReleaseHDC(WXHDC hdc); | |
48 | #endif // __WXMSW__ | |
49 | ||
50 | private: | |
8acd14d1 | 51 | DECLARE_DYNAMIC_CLASS(wxGCDC) |
c0c133e1 | 52 | wxDECLARE_NO_COPY_CLASS(wxGCDC); |
888dde65 | 53 | }; |
8acd14d1 | 54 | |
888dde65 | 55 | |
53a2db12 | 56 | class WXDLLIMPEXP_CORE wxGCDCImpl: public wxDCImpl |
888dde65 | 57 | { |
8acd14d1 | 58 | public: |
888dde65 RR |
59 | wxGCDCImpl( wxDC *owner, const wxWindowDC& dc ); |
60 | wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ); | |
220d37c8 | 61 | #if wxUSE_PRINTING_ARCHITECTURE |
b25c34aa | 62 | wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc ); |
2d770c4f VZ |
63 | #endif |
64 | #if defined(__WXMSW__) && wxUSE_ENH_METAFILE | |
65 | wxGCDCImpl( wxDC *owner, const wxEnhMetaFileDC& dc ); | |
220d37c8 | 66 | #endif |
888dde65 | 67 | wxGCDCImpl( wxDC *owner ); |
03647350 | 68 | |
888dde65 | 69 | virtual ~wxGCDCImpl(); |
8acd14d1 | 70 | |
8acd14d1 SC |
71 | // implement base class pure virtuals |
72 | // ---------------------------------- | |
73 | ||
74 | virtual void Clear(); | |
75 | ||
cc18b1c7 SC |
76 | virtual bool StartDoc( const wxString& message ); |
77 | virtual void EndDoc(); | |
78 | ||
79 | virtual void StartPage(); | |
80 | virtual void EndPage(); | |
03647350 | 81 | |
cc18b1c7 SC |
82 | // flushing the content of this dc immediately onto screen |
83 | virtual void Flush(); | |
8acd14d1 SC |
84 | |
85 | virtual void SetFont(const wxFont& font); | |
86 | virtual void SetPen(const wxPen& pen); | |
87 | virtual void SetBrush(const wxBrush& brush); | |
88 | virtual void SetBackground(const wxBrush& brush); | |
89 | virtual void SetBackgroundMode(int mode); | |
90 | virtual void SetPalette(const wxPalette& palette); | |
91 | ||
92 | virtual void DestroyClippingRegion(); | |
93 | ||
94 | virtual wxCoord GetCharHeight() const; | |
95 | virtual wxCoord GetCharWidth() const; | |
96 | ||
97 | virtual bool CanDrawBitmap() const; | |
98 | virtual bool CanGetTextExtent() const; | |
99 | virtual int GetDepth() const; | |
100 | virtual wxSize GetPPI() const; | |
101 | ||
89efaf2b | 102 | virtual void SetLogicalFunction(wxRasterOperationMode function); |
8acd14d1 SC |
103 | |
104 | virtual void SetTextForeground(const wxColour& colour); | |
105 | virtual void SetTextBackground(const wxColour& colour); | |
106 | ||
107 | virtual void ComputeScaleAndOrigin(); | |
108 | ||
6c0e710f | 109 | wxGraphicsContext* GetGraphicsContext() const { return m_graphicContext; } |
b687dd2f | 110 | virtual void SetGraphicsContext( wxGraphicsContext* ctx ); |
03647350 | 111 | |
8acd14d1 SC |
112 | // the true implementations |
113 | virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, | |
89efaf2b | 114 | wxFloodFillStyle style = wxFLOOD_SURFACE); |
8acd14d1 SC |
115 | |
116 | virtual void DoGradientFillLinear(const wxRect& rect, | |
117 | const wxColour& initialColour, | |
118 | const wxColour& destColour, | |
119 | wxDirection nDirection = wxEAST); | |
120 | ||
121 | virtual void DoGradientFillConcentric(const wxRect& rect, | |
122 | const wxColour& initialColour, | |
123 | const wxColour& destColour, | |
124 | const wxPoint& circleCenter); | |
125 | ||
126 | virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; | |
127 | ||
128 | virtual void DoDrawPoint(wxCoord x, wxCoord y); | |
129 | ||
130 | #if wxUSE_SPLINES | |
b0d7707b | 131 | virtual void DoDrawSpline(const wxPointList *points); |
8acd14d1 SC |
132 | #endif |
133 | ||
134 | virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
135 | ||
136 | virtual void DoDrawArc(wxCoord x1, wxCoord y1, | |
137 | wxCoord x2, wxCoord y2, | |
138 | wxCoord xc, wxCoord yc); | |
139 | ||
140 | virtual void DoDrawCheckMark(wxCoord x, wxCoord y, | |
141 | wxCoord width, wxCoord height); | |
142 | ||
143 | virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, | |
144 | double sa, double ea); | |
145 | ||
146 | virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
147 | virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, | |
148 | wxCoord width, wxCoord height, | |
149 | double radius); | |
150 | virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
151 | ||
152 | virtual void DoCrossHair(wxCoord x, wxCoord y); | |
153 | ||
154 | virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); | |
155 | virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, | |
156 | bool useMask = false); | |
157 | ||
158 | virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
159 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, | |
160 | double angle); | |
161 | ||
162 | virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
89efaf2b | 163 | wxDC *source, wxCoord xsrc, wxCoord ysrc, |
03647350 | 164 | wxRasterOperationMode rop = wxCOPY, bool useMask = false, |
89efaf2b | 165 | wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); |
8acd14d1 | 166 | |
e3b81044 VZ |
167 | virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest, |
168 | wxCoord dstWidth, wxCoord dstHeight, | |
169 | wxDC *source, | |
170 | wxCoord xsrc, wxCoord ysrc, | |
171 | wxCoord srcWidth, wxCoord srcHeight, | |
89efaf2b | 172 | wxRasterOperationMode = wxCOPY, bool useMask = false, |
e3b81044 VZ |
173 | wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); |
174 | ||
8acd14d1 SC |
175 | virtual void DoGetSize(int *,int *) const; |
176 | virtual void DoGetSizeMM(int* width, int* height) const; | |
177 | ||
178 | virtual void DoDrawLines(int n, wxPoint points[], | |
179 | wxCoord xoffset, wxCoord yoffset); | |
180 | virtual void DoDrawPolygon(int n, wxPoint points[], | |
89efaf2b FM |
181 | wxCoord xoffset, wxCoord yoffset, |
182 | wxPolygonFillMode fillStyle = wxODDEVEN_RULE); | |
8acd14d1 | 183 | virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], |
89efaf2b FM |
184 | wxCoord xoffset, wxCoord yoffset, |
185 | wxPolygonFillMode fillStyle); | |
8acd14d1 | 186 | |
fdaad94e | 187 | virtual void DoSetDeviceClippingRegion(const wxRegion& region); |
8acd14d1 SC |
188 | virtual void DoSetClippingRegion(wxCoord x, wxCoord y, |
189 | wxCoord width, wxCoord height); | |
190 | ||
191 | virtual void DoGetTextExtent(const wxString& string, | |
192 | wxCoord *x, wxCoord *y, | |
193 | wxCoord *descent = NULL, | |
194 | wxCoord *externalLeading = NULL, | |
c94f845b | 195 | const wxFont *theFont = NULL) const; |
8acd14d1 SC |
196 | |
197 | virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; | |
198 | ||
53d4bdbc VZ |
199 | #ifdef __WXMSW__ |
200 | virtual wxRect MSWApplyGDIPlusTransform(const wxRect& r) const; | |
201 | #endif // __WXMSW__ | |
202 | ||
8acd14d1 SC |
203 | protected: |
204 | // scaling variables | |
4280b879 | 205 | bool m_logicalFunctionSupported; |
2b73854d SC |
206 | wxGraphicsMatrix m_matrixOriginal; |
207 | wxGraphicsMatrix m_matrixCurrent; | |
b687dd2f PC |
208 | |
209 | double m_formerScaleX, m_formerScaleY; | |
8acd14d1 SC |
210 | |
211 | wxGraphicsContext* m_graphicContext; | |
03647350 | 212 | |
e7042ce7 PC |
213 | private: |
214 | void Init(wxGraphicsContext*); | |
215 | ||
888dde65 | 216 | DECLARE_CLASS(wxGCDCImpl) |
c0c133e1 | 217 | wxDECLARE_NO_COPY_CLASS(wxGCDCImpl); |
8acd14d1 SC |
218 | }; |
219 | ||
512cfcc3 | 220 | #endif // wxUSE_GRAPHICS_CONTEXT |
8acd14d1 | 221 | #endif // _WX_GRAPHICS_DC_H_ |