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