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