]>
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 | 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 ); | |
b25c34aa | 29 | wxGCDC( const wxPrinterDC& dc ); |
888dde65 | 30 | wxGCDC(); |
4dd36d1d SC |
31 | virtual ~wxGCDC(); |
32 | ||
888dde65 RR |
33 | wxGraphicsContext* GetGraphicsContext(); |
34 | void SetGraphicsContext( wxGraphicsContext* ctx ); | |
35 | ||
8acd14d1 SC |
36 | DECLARE_DYNAMIC_CLASS(wxGCDC) |
37 | DECLARE_NO_COPY_CLASS(wxGCDC) | |
888dde65 | 38 | }; |
8acd14d1 | 39 | |
888dde65 | 40 | |
53a2db12 | 41 | class WXDLLIMPEXP_CORE wxGCDCImpl: public wxDCImpl |
888dde65 | 42 | { |
8acd14d1 | 43 | public: |
888dde65 RR |
44 | wxGCDCImpl( wxDC *owner, const wxWindowDC& dc ); |
45 | wxGCDCImpl( wxDC *owner, const wxMemoryDC& dc ); | |
b25c34aa | 46 | wxGCDCImpl( wxDC *owner, const wxPrinterDC& dc ); |
888dde65 RR |
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 | // the true implementations |
98 | virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, | |
99 | int style = wxFLOOD_SURFACE); | |
100 | ||
101 | virtual void DoGradientFillLinear(const wxRect& rect, | |
102 | const wxColour& initialColour, | |
103 | const wxColour& destColour, | |
104 | wxDirection nDirection = wxEAST); | |
105 | ||
106 | virtual void DoGradientFillConcentric(const wxRect& rect, | |
107 | const wxColour& initialColour, | |
108 | const wxColour& destColour, | |
109 | const wxPoint& circleCenter); | |
110 | ||
111 | virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const; | |
112 | ||
113 | virtual void DoDrawPoint(wxCoord x, wxCoord y); | |
114 | ||
115 | #if wxUSE_SPLINES | |
b0d7707b | 116 | virtual void DoDrawSpline(const wxPointList *points); |
8acd14d1 SC |
117 | #endif |
118 | ||
119 | virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2); | |
120 | ||
121 | virtual void DoDrawArc(wxCoord x1, wxCoord y1, | |
122 | wxCoord x2, wxCoord y2, | |
123 | wxCoord xc, wxCoord yc); | |
124 | ||
125 | virtual void DoDrawCheckMark(wxCoord x, wxCoord y, | |
126 | wxCoord width, wxCoord height); | |
127 | ||
128 | virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h, | |
129 | double sa, double ea); | |
130 | ||
131 | virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
132 | virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y, | |
133 | wxCoord width, wxCoord height, | |
134 | double radius); | |
135 | virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height); | |
136 | ||
137 | virtual void DoCrossHair(wxCoord x, wxCoord y); | |
138 | ||
139 | virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y); | |
140 | virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, | |
141 | bool useMask = false); | |
142 | ||
143 | virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y); | |
144 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, | |
145 | double angle); | |
146 | ||
147 | virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
148 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
149 | int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1); | |
150 | ||
e3b81044 VZ |
151 | virtual bool DoStretchBlit(wxCoord xdest, wxCoord ydest, |
152 | wxCoord dstWidth, wxCoord dstHeight, | |
153 | wxDC *source, | |
154 | wxCoord xsrc, wxCoord ysrc, | |
155 | wxCoord srcWidth, wxCoord srcHeight, | |
156 | int rop = wxCOPY, bool useMask = false, | |
157 | wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord); | |
158 | ||
8acd14d1 SC |
159 | virtual void DoGetSize(int *,int *) const; |
160 | virtual void DoGetSizeMM(int* width, int* height) const; | |
161 | ||
162 | virtual void DoDrawLines(int n, wxPoint points[], | |
163 | wxCoord xoffset, wxCoord yoffset); | |
164 | virtual void DoDrawPolygon(int n, wxPoint points[], | |
165 | wxCoord xoffset, wxCoord yoffset, | |
166 | int fillStyle = wxODDEVEN_RULE); | |
167 | virtual void DoDrawPolyPolygon(int n, int count[], wxPoint points[], | |
168 | wxCoord xoffset, wxCoord yoffset, | |
169 | int fillStyle); | |
170 | ||
fdaad94e | 171 | virtual void DoSetDeviceClippingRegion(const wxRegion& region); |
8acd14d1 SC |
172 | virtual void DoSetClippingRegion(wxCoord x, wxCoord y, |
173 | wxCoord width, wxCoord height); | |
174 | ||
175 | virtual void DoGetTextExtent(const wxString& string, | |
176 | wxCoord *x, wxCoord *y, | |
177 | wxCoord *descent = NULL, | |
178 | wxCoord *externalLeading = NULL, | |
c94f845b | 179 | const wxFont *theFont = NULL) const; |
8acd14d1 SC |
180 | |
181 | virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const; | |
182 | ||
183 | protected: | |
184 | // scaling variables | |
4280b879 | 185 | bool m_logicalFunctionSupported; |
8acd14d1 | 186 | double m_mm_to_pix_x, m_mm_to_pix_y; |
2b73854d SC |
187 | wxGraphicsMatrix m_matrixOriginal; |
188 | wxGraphicsMatrix m_matrixCurrent; | |
b687dd2f PC |
189 | |
190 | double m_formerScaleX, m_formerScaleY; | |
8acd14d1 SC |
191 | |
192 | wxGraphicsContext* m_graphicContext; | |
888dde65 | 193 | |
888dde65 RR |
194 | DECLARE_CLASS(wxGCDCImpl) |
195 | DECLARE_NO_COPY_CLASS(wxGCDCImpl) | |
8acd14d1 SC |
196 | }; |
197 | ||
512cfcc3 | 198 | #endif // wxUSE_GRAPHICS_CONTEXT |
8acd14d1 | 199 | #endif // _WX_GRAPHICS_DC_H_ |