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