]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/graphicscontext.tex
Patches-1851591 ] dataview sample is crashing (under MSW)
[wxWidgets.git] / docs / latex / wx / graphicscontext.tex
CommitLineData
f43af7fe
SC
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Name: graphicsfont.tex
3%% Purpose: wxGraphicsFont class documentation
4%% Author: Stefan Csomor
5%% Modified by:
6%% Created: 08.06.2004
7%% RCS-ID: $Id$
8%% Copyright: (c) Stefan Csomor
9%% License: wxWindows license
10%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11
12\section{\class{wxGraphicsContext}}\label{wxgraphicscontext}
13
14A wxGraphicsContext instance is the object that is drawn upon. It is created by a renderer using the CreateContext calls.., this can be either directly using a renderer
15instance, or indirectly using the static convenience CreateXXX functions of wxGraphicsContext that always delegate the task to the default renderer.
16
17\wxheading{Derived from}
18
7376079d
VZ
19\helpref{wxGraphicsObject}{wxgraphicsobject}\\
20\helpref{wxObject}{wxobject}
f43af7fe
SC
21
22\wxheading{Include files}
23
24<wx/graphics.h>
25
a7af285d
VZ
26\wxheading{Library}
27
28\helpref{wxCore}{librarieslist}
29
f43af7fe
SC
30\latexignore{\rtfignore{\wxheading{Members}}}
31
32\membersection{wxGraphicsContext::Create}\label{wxgraphicscontextcreate}
33
34\func{wxGraphicsContext*}{Create}{\param{const wxWindowDC\& }{dc}}
35
36Creates a wxGraphicsContext from a wxWindowDC (eg a wxPaintDC).
37
38\func{wxGraphicsContext*}{Create}{\param{wxWindow* }{window}}
39
40Creates a wxGraphicsContext from a wxWindow.
41
42\wxheading{See also}
43
44\helpref{wxGraphicsRenderer:: CreateContext}{wxgraphicsrenderercreatecontext}
45
46\membersection{wxGraphicsContext::CreateFromNative}\label{wxgraphicscontextcreatefromnative}
47
48Creates a wxGraphicsContext from a native context. This native context must be eg a CGContextRef for Core Graphics, a Graphics pointer for GDIPlus or a
49cairo\_t pointer for cairo.
50
51\func{wxGraphicsContext*}{CreateFromNative}{\param{void * }{context}}
52
53Creates a wxGraphicsContext from a native window.
54
55\wxheading{See also}
56
57\helpref{wxGraphicsRenderer:: CreateContextFromNativeContext}{wxgraphicsrenderercreatecontextfromnativecontext}
58
59\membersection{wxGraphicsContext::CreateFromNativeWindow}\label{wxgraphicscontextcreatefromnativewindow}
60
61\func{wxGraphicsContext*}{CreateFromNativeWindow}{\param{void * }{window}}
62
63\wxheading{See also}
64
65\helpref{wxGraphicsRenderer:: CreateContextFromNativeWindow}{wxgraphicsrenderercreatecontextfromnativewindow}
66
67\membersection{wxGraphicsContext::CreatePen}\label{wxgraphicscontextcreatepen}
68
69\constfunc{wxGraphicsPen}{CreatePen}{\param{const wxPen\& }{pen}}
70
71Creates a native pen from a wxPen.
72
73\membersection{wxGraphicsContext::CreateBrush}\label{wxgraphicscontextcreatebrush}
74
75\constfunc{wxGraphicsBrush}{CreateBrush}{\param{const wxBrush\& }{brush}}
76
77Creates a native brush from a wxBrush.
78
79\membersection{wxGraphicsContext::CreateRadialGradientBrush}\label{wxgraphicscontextcreateradialgradientbrush}
80
81\constfunc{wxGraphicsBrush}{CreateRadialGradientBrush}{\param{wxDouble }{xo}, \param{wxDouble }{yo}, \param{wxDouble }{xc}, \param{wxDouble }{yc},
82\param{wxDouble }{radius}, \param{const wxColour\& }{oColor}, \param{const wxColour\& }{cColor}}
83
84Creates a native brush, having a radial gradient originating at (xo,yc) with color oColour and ends on a circle around (xc,yc) with radius r and color cColour
85
86\membersection{wxGraphicsContext::CreateLinearGradientBrush}\label{wxgraphicscontextcreatelineargradientbrush}
87
88\constfunc{wxGraphicsBrush}{CreateLinearGradientBrush}{\param{wxDouble }{x1}, \param{wxDouble }{y1}, \param{wxDouble }{x2}, \param{wxDouble }{y2},
89\param{const }{wxColour\&c1}, \param{const }{wxColour\&c2}}
90
91Creates a native brush, having a linear gradient, starting at (x1,y1) with color c1 to (x2,y2) with color c2
92
93\membersection{wxGraphicsContext::CreateFont}\label{wxgraphicscontextcreatefont}
94
95\constfunc{wxGraphicsFont}{CreateFont}{\param{const wxFont\& }{font}, \param{const wxColour\& }{col = *wxBLACK}}
96
97Creates a native graphics font from a wxFont and a text colour.
98
99\membersection{wxGraphicsContext::CreateMatrix}\label{wxgraphicscontextcreatematrix}
100
101\constfunc{wxGraphicsMatrix}{CreateMatrix}{\param{wxDouble }{a = 1.0}, \param{wxDouble }{b = 0.0}, \param{wxDouble }{c = 0.0}, \param{wxDouble }{d = 1.0},
102\param{wxDouble }{tx = 0.0}, \param{wxDouble }{ty = 0.0}}
103
104Creates a native affine transformation matrix from the passed in values. The defaults result in an identity matrix.
105
106\membersection{wxGraphicsContext::CreatePath}\label{wxgraphicscontextcreatepath}
107
108\constfunc{wxGraphicsPath}{CreatePath}{\void}
109
110Creates a native graphics path which is initially empty.
111
112\membersection{wxGraphicsContext::Clip}\label{wxgraphicscontextclip}
113
114\func{void}{Clip}{\param{const wxRegion\& }{region}}
115
116Clips drawings to the region, combined to current clipping region
117
118\func{void}{Clip}{\param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}}
119
120Clips drawings to the rectangle.
121
122\membersection{wxGraphicsContext::ResetClip}\label{wxgraphicscontextresetclip}
123
124\func{void}{ResetClip}{\void}
125
126Resets the clipping to original shape.
127
128\membersection{wxGraphicsContext::DrawBitmap}\label{wxgraphicscontextdrawbitmap}
129
130\func{void}{DrawBitmap}{\param{const wxBitmap\& }{bmp}, \param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}}
131
132Draws the bitmap. In case of a mono bitmap, this is treated as a mask and the current brushed is used for filling.
133
134\membersection{wxGraphicsContext::DrawEllipse}\label{wxgraphicscontextdrawellipse}
135
136\func{void}{DrawEllipse}{\param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}}
137
138Draws an ellipse.
139
140\membersection{wxGraphicsContext::DrawIcon}\label{wxgraphicscontextdrawicon}
141
142\func{void}{DrawIcon}{\param{const wxIcon\& }{icon}, \param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}}
143
144Draws the icon.
145
146
147\membersection{wxGraphicsContext::DrawLines}\label{wxgraphicscontextdrawlines}
148
149\func{void}{DrawLines}{\param{size\_t }{n}, \param{const wxPoint2DDouble* }{points}, \param{int }{fillStyle = wxODDEVEN\_RULE}}
150
151Draws a polygon.
152
153
154\membersection{wxGraphicsContext::DrawPath}\label{wxgraphicscontextdrawpath}
155
156\func{void}{DrawPath}{\param{const wxGraphicsPath\& }{path}, \param{int }{fillStyle = wxODDEVEN\_RULE}}
157
158Draws the path by first filling and then stroking.
159
160
161\membersection{wxGraphicsContext::DrawRectangle}\label{wxgraphicscontextdrawrectangle}
162
163\func{void}{DrawRectangle}{\param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}}
164
165Draws a rectangle.
166
167
168\membersection{wxGraphicsContext::DrawRoundedRectangle}\label{wxgraphicscontextdrawroundedrectangle}
169
170\func{void}{DrawRoundedRectangle}{\param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{w}, \param{wxDouble }{h}, \param{wxDouble }{radius}}
171
172Draws a rounded rectangle.
173
174\membersection{wxGraphicsContext::DrawText}\label{wxgraphicscontextdrawtext}
175
176\func{void}{DrawText}{\param{const wxString\& }{str}, \param{wxDouble }{x}, \param{wxDouble }{y}, \param{wxDouble }{angle}}
177
178\func{void}{DrawText}{\param{const wxString\& }{str}, \param{wxDouble }{x}, \param{wxDouble }{y}}
179
180Draws a text at the defined position, at the given angle.
181
182\membersection{wxGraphicsContext::FillPath}\label{wxgraphicscontextfillpath}
183
184\func{void}{FillPath}{\param{const wxGraphicsPath\& }{path}, \param{int }{fillStyle = wxODDEVEN\_RULE}}
185
186Fills the path with the current brush.
187
188\membersection{wxGraphicsContext::StrokePath}\label{wxgraphicscontextstrokepath}
189
190\func{void}{StrokePath}{\param{const wxGraphicsPath\& }{path}}
191
192Strokes along a path with the current pen.
193
194
195\membersection{wxGraphicsContext::GetNativeContext}\label{wxgraphicscontextgetnativecontext}
196
197\func{void *}{GetNativeContext}{\void}
198
199Returns the native context (CGContextRef for Core Graphics, Graphics pointer for GDIPlus and cairo\_t pointer for cairo).
200
201\membersection{wxGraphicsContext::GetPartialTextExtents}\label{wxgraphicscontextgetpartialtextextents}
202
203\constfunc{void}{GetPartialTextExtents}{\param{const wxString\& }{text}, \param{wxArrayDouble\& }{widths}}
204
205Fills the {\it widths} array with the widths from the beginning of
206{\it text} to the corresponding character of {\it text}.
207
208\membersection{wxGraphicsContext::GetTextExtent}\label{wxgraphicscontextgettextextent}
209
210\constfunc{void}{GetTextExtent}{\param{const wxString\& }{text}, \param{wxDouble* }{width}, \param{wxDouble* }{height}, \param{wxDouble* }{descent},
211\param{wxDouble* }{externalLeading}}
212
213Gets the dimensions of the string using the currently selected font.
214\rtfsp{\it string} is the text string to measure, {\it w} and {\it h} are
215the total width and height respectively, {\it descent} is the
216dimension from the baseline of the font to the bottom of the
217descender, and {\it externalLeading} is any extra vertical space added
218to the font by the font designer (usually is zero).
219
220\membersection{wxGraphicsContext::Rotate}\label{wxgraphicscontextrotate}
221
222\func{void}{Rotate}{\param{wxDouble }{angle}}
223
224Rotates the current transformation matrix (radians),
225
226\membersection{wxGraphicsContext::Scale}\label{wxgraphicscontextscale}
227
228\func{void}{Scale}{\param{wxDouble }{xScale}, \param{wxDouble }{yScale}}
229
230Scales the current transformation matrix.
231
232\membersection{wxGraphicsContext::Translate}\label{wxgraphicscontexttranslate}
233
234\func{void}{Translate}{\param{wxDouble }{dx}, \param{wxDouble }{dy}}
235
236Translates the current transformation matrix.
237
238\membersection{wxGraphicsContext::GetTransform}\label{wxgraphicscontextgettransform}
239
240\constfunc{wxGraphicsMatrix}{GetTransform}{\void}
241
242Gets the current transformation matrix of this context.
243
244\membersection{wxGraphicsContext::SetTransform}\label{wxgraphicscontextsettransform}
245
246\func{void}{SetTransform}{\param{const wxGraphicsMatrix\& }{matrix}}
247
248Sets the current transformation matrix of this context
249
250\membersection{wxGraphicsContext::ConcatTransform}\label{wxgraphicscontextconcattransform}
251
252\func{void}{ConcatTransform}{\param{const wxGraphicsMatrix\& }{matrix}}
253
254Concatenates the passed in transform with the current transform of this context
255
256\membersection{wxGraphicsContext::SetBrush}\label{wxgraphicscontextsetbrush}
257
258\func{void}{SetBrush}{\param{const wxBrush\& }{brush}}
259
260\func{void}{SetBrush}{\param{const wxGraphicsBrush\& }{brush}}
261
262Sets the brush for filling paths.
263
264\membersection{wxGraphicsContext::SetFont}\label{wxgraphicscontextsetfont}
265
266\func{void}{SetFont}{\param{const wxFont\& }{font}, \param{const wxColour\& }{colour}}
267
268
269\func{void}{SetFont}{\param{const wxGraphicsFont\& }{font}}
270
271Sets the font for drawing text.
272
273
274\membersection{wxGraphicsContext::SetPen}\label{wxgraphicscontextsetpen}
275
276\func{void}{SetPen}{\param{const wxGraphicsPen\& }{pen}}
277
278\func{void}{SetPen}{\param{const wxPen\& }{pen}}
279
280Sets the pen used for stroking.
281
282\membersection{wxGraphicsContext::StrokeLine}\label{wxgraphicscontextstrokeline}
283
284\func{void}{StrokeLine}{\param{wxDouble }{x1}, \param{wxDouble }{y1}, \param{wxDouble }{x2}, \param{wxDouble }{y2}}
285
286Strokes a single line.
287
288\membersection{wxGraphicsContext::StrokeLines}\label{wxgraphicscontextstrokelines}
289
290\func{void}{StrokeLines}{\param{size\_t }{n}, \param{const wxPoint2DDouble* }{beginPoints}, \param{const wxPoint2DDouble* }{endPoints}}
291
292\func{void}{StrokeLines}{\param{size\_t }{n}, \param{const wxPoint2DDouble* }{points}}
293
294Stroke disconnected lines from begin to end points, fastest method available for this purpose.
295