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