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