1wxGraphicsContext(3)       Erlang Module Definition       wxGraphicsContext(3)
2
3
4

NAME

6       wxGraphicsContext - Functions for wxGraphicsContext class
7

DESCRIPTION

9       A  wxGraphicsContext  instance  is the object that is drawn upon. It is
10       created by a renderer  using  wxGraphicsRenderer:createContext/2.  This
11       can  be  either directly using a renderer instance, or indirectly using
12       the static convenience create/1 functions of wxGraphicsContext that al‐
13       ways delegate the task to the default renderer.
14
15       Remark: For some renderers (like Direct2D or Cairo) processing of draw‐
16       ing operations may be deferred (Direct2D render target normally  builds
17       up  a  batch  of rendering commands but defers processing of these com‐
18       mands, Cairo operates on a separate surface) so to make drawing results
19       visible  you  need  to update the content of the context by calling wx‐
20       GraphicsContext::Flush() (not implemented in wx) or by  destroying  the
21       context.
22
23       See: wxGraphicsRenderer:createContext/2, wxGCDC, wxDC
24
25       This class is derived (and can use functions) from: wxGraphicsObject
26
27       wxWidgets docs: wxGraphicsContext
28

DATA TYPES

30       wxGraphicsContext() = wx:wx_object()
31

EXPORTS

33       destroy(This :: wxGraphicsContext()) -> ok
34
35              Creates a wxGraphicsContext from a wxWindow.
36
37              See: wxGraphicsRenderer:createContext/2
38
39       create() -> wxGraphicsContext()
40
41              Create a lightweight context that can be used only for measuring
42              text.
43
44       create(WindowDC) -> wxGraphicsContext()
45
46              Types:
47
48                 WindowDC =
49                     wxWindowDC:wxWindowDC() |
50                     wxWindow:wxWindow() |
51                     wxMemoryDC:wxMemoryDC() |
52                     wxImage:wxImage()
53
54              Creates a wxGraphicsContext from a wxWindowDC.
55
56              See: wxGraphicsRenderer:createContext/2
57
58       createPen(This, Pen) -> wxGraphicsPen:wxGraphicsPen()
59
60              Types:
61
62                 This = wxGraphicsContext()
63                 Pen = wxPen:wxPen()
64
65              Creates a native pen from a wxPen.
66
67              Prefer to use the overload taking wxGraphicsPenInfo (not  imple‐
68              mented  in  wx)  unless you already have a wxPen as constructing
69              one only to pass it to this method is wasteful.
70
71       createBrush(This, Brush) -> wxGraphicsBrush:wxGraphicsBrush()
72
73              Types:
74
75                 This = wxGraphicsContext()
76                 Brush = wxBrush:wxBrush()
77
78              Creates a native brush from a wxBrush.
79
80       createRadialGradientBrush(This, StartX, StartY, EndX, EndY,
81                                 Radius, Stops) ->
82                                    wxGraphicsBrush:wxGraphicsBrush()
83
84              Types:
85
86                 This = wxGraphicsContext()
87                 StartX = StartY = EndX = EndY = Radius = number()
88                 Stops = wxGraphicsGradientStops:wxGraphicsGradientStops()
89
90              This is an overloaded member function, provided for convenience.
91              It  differs  from the above function only in what argument(s) it
92              accepts.
93
94       createRadialGradientBrush(This, StartX, StartY, EndX, EndY,
95                                 Radius, OColor, CColor) ->
96                                    wxGraphicsBrush:wxGraphicsBrush()
97
98              Types:
99
100                 This = wxGraphicsContext()
101                 StartX = StartY = EndX = EndY = Radius = number()
102                 OColor = CColor = wx:wx_colour()
103
104               Creates a native brush with a radial gradient. The brush origi‐
105              nates  at (@a startX, @a startY) and ends on a circle around (@a
106              endX, @a endY) with the given @a radius.  The  gradient  may  be
107              specified  either  by its start and end colours @a oColor and @a
108              cColor or by a full set of gradient @a stops. The version taking
109              wxGraphicsGradientStops is new in wxWidgets 2.9.1.
110
111              The ability to apply a transformation matrix to the gradient was
112              added in 3.1.3
113
114       createLinearGradientBrush(This, X1, Y1, X2, Y2, Stops) ->
115                                    wxGraphicsBrush:wxGraphicsBrush()
116
117              Types:
118
119                 This = wxGraphicsContext()
120                 X1 = Y1 = X2 = Y2 = number()
121                 Stops = wxGraphicsGradientStops:wxGraphicsGradientStops()
122
123              This is an overloaded member function, provided for convenience.
124              It  differs  from the above function only in what argument(s) it
125              accepts.
126
127       createLinearGradientBrush(This, X1, Y1, X2, Y2, C1, C2) ->
128                                    wxGraphicsBrush:wxGraphicsBrush()
129
130              Types:
131
132                 This = wxGraphicsContext()
133                 X1 = Y1 = X2 = Y2 = number()
134                 C1 = C2 = wx:wx_colour()
135
136               Creates a native brush with a linear gradient. The brush starts
137              at  (@a  x1,  @a y1) and ends at (@a x2, @a y2). Either just the
138              start and end gradient colours (@a c1 and @a c2) or full set  of
139              gradient  @a stops can be specified. The version taking wxGraph‐
140              icsGradientStops is new in wxWidgets 2.9.1.
141
142              The matrix parameter was added in wxWidgets 3.1.3
143
144       createFont(This, Font) -> wxGraphicsFont:wxGraphicsFont()
145
146              Types:
147
148                 This = wxGraphicsContext()
149                 Font = wxFont:wxFont()
150
151       createFont(This, SizeInPixels, Facename) ->
152                     wxGraphicsFont:wxGraphicsFont()
153
154       createFont(This, Font, Facename :: [Option]) ->
155                     wxGraphicsFont:wxGraphicsFont()
156
157              Types:
158
159                 This = wxGraphicsContext()
160                 Font = wxFont:wxFont()
161                 Option = {col, wx:wx_colour()}
162
163              Creates a native graphics font from a wxFont and a text colour.
164
165              Remark: For Direct2D graphics fonts can be created from TrueType
166              fonts only.
167
168       createFont(This, SizeInPixels, Facename, Options :: [Option]) ->
169                     wxGraphicsFont:wxGraphicsFont()
170
171              Types:
172
173                 This = wxGraphicsContext()
174                 SizeInPixels = number()
175                 Facename = unicode:chardata()
176                 Option = {flags, integer()} | {col, wx:wx_colour()}
177
178              Creates a font object with the specified attributes.
179
180              The  use  of overload taking wxFont is preferred, see wxGraphic‐
181              sRenderer:createFont/4 for more details.
182
183              Remark: For Direct2D graphics fonts can be created from TrueType
184              fonts only.
185
186              Since: 2.9.3
187
188       createMatrix(This) -> wxGraphicsMatrix:wxGraphicsMatrix()
189
190              Types:
191
192                 This = wxGraphicsContext()
193
194       createMatrix(This, Options :: [Option]) ->
195                       wxGraphicsMatrix:wxGraphicsMatrix()
196
197              Types:
198
199                 This = wxGraphicsContext()
200                 Option =
201                     {a, number()} |
202                     {b, number()} |
203                     {c, number()} |
204                     {d, number()} |
205                     {tx, number()} |
206                     {ty, number()}
207
208              Creates a native affine transformation matrix from the passed in
209              values.
210
211              The default parameters result in an identity matrix.
212
213       createPath(This) -> wxGraphicsPath:wxGraphicsPath()
214
215              Types:
216
217                 This = wxGraphicsContext()
218
219              Creates a native graphics path which is initially empty.
220
221       clip(This, Region) -> ok
222
223              Types:
224
225                 This = wxGraphicsContext()
226                 Region = wxRegion:wxRegion()
227
228              Sets the clipping region to the intersection of the given region
229              and the previously set clipping region.
230
231              The clipping region is an area to which drawing is restricted.
232
233              Remark:
234
235       clip(This, X, Y, W, H) -> ok
236
237              Types:
238
239                 This = wxGraphicsContext()
240                 X = Y = W = H = number()
241
242              This is an overloaded member function, provided for convenience.
243              It differs from the above function only in what  argument(s)  it
244              accepts.
245
246       resetClip(This) -> ok
247
248              Types:
249
250                 This = wxGraphicsContext()
251
252              Resets the clipping to original shape.
253
254       drawBitmap(This, Bmp, X, Y, W, H) -> ok
255
256              Types:
257
258                 This = wxGraphicsContext()
259                 Bmp = wxBitmap:wxBitmap()
260                 X = Y = W = H = number()
261
262              Draws the bitmap.
263
264              In case of a mono bitmap, this is treated as a mask and the cur‐
265              rent brushed is used for filling.
266
267       drawEllipse(This, X, Y, W, H) -> ok
268
269              Types:
270
271                 This = wxGraphicsContext()
272                 X = Y = W = H = number()
273
274              Draws an ellipse.
275
276       drawIcon(This, Icon, X, Y, W, H) -> ok
277
278              Types:
279
280                 This = wxGraphicsContext()
281                 Icon = wxIcon:wxIcon()
282                 X = Y = W = H = number()
283
284              Draws the icon.
285
286       drawLines(This, Points) -> ok
287
288              Types:
289
290                 This = wxGraphicsContext()
291                 Points = [{X :: float(), Y :: float()}]
292
293       drawLines(This, Points, Options :: [Option]) -> ok
294
295              Types:
296
297                 This = wxGraphicsContext()
298                 Points = [{X :: float(), Y :: float()}]
299                 Option = {fillStyle, wx:wx_enum()}
300
301              Draws a polygon.
302
303       drawPath(This, Path) -> ok
304
305              Types:
306
307                 This = wxGraphicsContext()
308                 Path = wxGraphicsPath:wxGraphicsPath()
309
310       drawPath(This, Path, Options :: [Option]) -> ok
311
312              Types:
313
314                 This = wxGraphicsContext()
315                 Path = wxGraphicsPath:wxGraphicsPath()
316                 Option = {fillStyle, wx:wx_enum()}
317
318              Draws the path by first filling and then stroking.
319
320       drawRectangle(This, X, Y, W, H) -> ok
321
322              Types:
323
324                 This = wxGraphicsContext()
325                 X = Y = W = H = number()
326
327              Draws a rectangle.
328
329       drawRoundedRectangle(This, X, Y, W, H, Radius) -> ok
330
331              Types:
332
333                 This = wxGraphicsContext()
334                 X = Y = W = H = Radius = number()
335
336              Draws a rounded rectangle.
337
338       drawText(This, Str, X, Y) -> ok
339
340              Types:
341
342                 This = wxGraphicsContext()
343                 Str = unicode:chardata()
344                 X = Y = number()
345
346              Draws text at the defined position.
347
348       drawText(This, Str, X, Y, Angle) -> ok
349
350       drawText(This, Str, X, Y, BackgroundBrush) -> ok
351
352              Types:
353
354                 This = wxGraphicsContext()
355                 Str = unicode:chardata()
356                 X = Y = number()
357                 BackgroundBrush = wxGraphicsBrush:wxGraphicsBrush()
358
359              Draws text at the defined position.
360
361       drawText(This, Str, X, Y, Angle, BackgroundBrush) -> ok
362
363              Types:
364
365                 This = wxGraphicsContext()
366                 Str = unicode:chardata()
367                 X = Y = Angle = number()
368                 BackgroundBrush = wxGraphicsBrush:wxGraphicsBrush()
369
370              Draws text at the defined position.
371
372       fillPath(This, Path) -> ok
373
374              Types:
375
376                 This = wxGraphicsContext()
377                 Path = wxGraphicsPath:wxGraphicsPath()
378
379       fillPath(This, Path, Options :: [Option]) -> ok
380
381              Types:
382
383                 This = wxGraphicsContext()
384                 Path = wxGraphicsPath:wxGraphicsPath()
385                 Option = {fillStyle, wx:wx_enum()}
386
387              Fills the path with the current brush.
388
389       strokePath(This, Path) -> ok
390
391              Types:
392
393                 This = wxGraphicsContext()
394                 Path = wxGraphicsPath:wxGraphicsPath()
395
396              Strokes along a path with the current pen.
397
398       getPartialTextExtents(This, Text) -> [number()]
399
400              Types:
401
402                 This = wxGraphicsContext()
403                 Text = unicode:chardata()
404
405              Fills the widths array with the widths  from  the  beginning  of
406              text to the corresponding character of text.
407
408       getTextExtent(This, Text) -> Result
409
410              Types:
411
412                 Result =
413                     {Width :: number(),
414                      Height :: number(),
415                      Descent :: number(),
416                      ExternalLeading :: number()}
417                 This = wxGraphicsContext()
418                 Text = unicode:chardata()
419
420              Gets  the  dimensions of the string using the currently selected
421              font.
422
423       rotate(This, Angle) -> ok
424
425              Types:
426
427                 This = wxGraphicsContext()
428                 Angle = number()
429
430              Rotates the current transformation matrix (in radians).
431
432       scale(This, XScale, YScale) -> ok
433
434              Types:
435
436                 This = wxGraphicsContext()
437                 XScale = YScale = number()
438
439              Scales the current transformation matrix.
440
441       translate(This, Dx, Dy) -> ok
442
443              Types:
444
445                 This = wxGraphicsContext()
446                 Dx = Dy = number()
447
448              Translates the current transformation matrix.
449
450       getTransform(This) -> wxGraphicsMatrix:wxGraphicsMatrix()
451
452              Types:
453
454                 This = wxGraphicsContext()
455
456              Gets the current transformation matrix of this context.
457
458       setTransform(This, Matrix) -> ok
459
460              Types:
461
462                 This = wxGraphicsContext()
463                 Matrix = wxGraphicsMatrix:wxGraphicsMatrix()
464
465              Sets the current transformation matrix of this context.
466
467       concatTransform(This, Matrix) -> ok
468
469              Types:
470
471                 This = wxGraphicsContext()
472                 Matrix = wxGraphicsMatrix:wxGraphicsMatrix()
473
474              Concatenates the passed in transform with the current  transform
475              of this context.
476
477       setBrush(This, Brush) -> ok
478
479              Types:
480
481                 This = wxGraphicsContext()
482                 Brush = wxGraphicsBrush:wxGraphicsBrush() | wxBrush:wxBrush()
483
484              Sets the brush for filling paths.
485
486       setFont(This, Font) -> ok
487
488              Types:
489
490                 This = wxGraphicsContext()
491                 Font = wxGraphicsFont:wxGraphicsFont()
492
493              Sets the font for drawing text.
494
495       setFont(This, Font, Colour) -> ok
496
497              Types:
498
499                 This = wxGraphicsContext()
500                 Font = wxFont:wxFont()
501                 Colour = wx:wx_colour()
502
503              Sets the font for drawing text.
504
505              Remark: For Direct2D only TrueType fonts can be used.
506
507       setPen(This, Pen) -> ok
508
509              Types:
510
511                 This = wxGraphicsContext()
512                 Pen = wxPen:wxPen() | wxGraphicsPen:wxGraphicsPen()
513
514              Sets the pen used for stroking.
515
516       strokeLine(This, X1, Y1, X2, Y2) -> ok
517
518              Types:
519
520                 This = wxGraphicsContext()
521                 X1 = Y1 = X2 = Y2 = number()
522
523              Strokes a single line.
524
525       strokeLines(This, Points) -> ok
526
527              Types:
528
529                 This = wxGraphicsContext()
530                 Points = [{X :: float(), Y :: float()}]
531
532              Stroke lines connecting all the points.
533
534              Unlike  the other overload of this function, this method draws a
535              single polyline and not a number of disconnected lines.
536
537
538
539wxWidgets team.                    wx 2.2.2               wxGraphicsContext(3)
Impressum