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