]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/graphics.h
Remove more non-standard keywords from wxWebView MSW header.
[wxWidgets.git] / interface / wx / graphics.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: graphics.h
9cc4ab85 3// Purpose: interface of various wxGraphics* classes
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxGraphicsPath
7c913512 11
23d291c2
BP
12 A wxGraphicsPath is a native representation of a geometric path. The
13 contents are specific an private to the respective renderer. Instances are
14 reference counted and can therefore be assigned as usual. The only way to
15 get a valid instance is by using wxGraphicsContext::CreatePath() or
16 wxGraphicsRenderer::CreatePath().
7c913512 17
23324ae1 18 @library{wxcore}
23d291c2 19 @category{gdi}
23324ae1
FM
20*/
21class wxGraphicsPath : public wxGraphicsObject
22{
23public:
23324ae1 24 /**
2e4d0e91
VZ
25 Adds an arc of a circle.
26
27 The circle is defined by the coordinates of its centre (@a x, @a y) or
28 @a c and its radius @a r. The arc goes from the starting angle @a
29 startAngle to @a endAngle either clockwise or counter-clockwise
30 depending on the value of @a clockwise argument.
31
32 The angles are measured in radians but, contrary to the usual
33 mathematical convention, are always @e clockwise from the horizontal
34 axis.
23d291c2 35 */
2e4d0e91 36 //@{
23d291c2
BP
37 virtual void AddArc(wxDouble x, wxDouble y, wxDouble r,
38 wxDouble startAngle, wxDouble endAngle,
39 bool clockwise);
7c913512 40 void AddArc(const wxPoint2DDouble& c, wxDouble r,
23d291c2 41 wxDouble startAngle, wxDouble endAngle, bool clockwise);
2e4d0e91 42 //@}
23324ae1
FM
43
44 /**
23d291c2
BP
45 Appends a an arc to two tangents connecting (current) to (@a x1,@a y1)
46 and (@a x1,@a y1) to (@a x2,@a y2), also a straight line from (current)
47 to (@a x1,@a y1).
23324ae1 48 */
da1ed74c
FM
49 virtual void AddArcToPoint(wxDouble x1, wxDouble y1, wxDouble x2,
50 wxDouble y2, wxDouble r);
23324ae1
FM
51
52 /**
23d291c2
BP
53 Appends a circle around (@a x,@a y) with radius @a r as a new closed
54 subpath.
23324ae1 55 */
da1ed74c 56 virtual void AddCircle(wxDouble x, wxDouble y, wxDouble r);
23324ae1 57
23324ae1 58 /**
23d291c2
BP
59 Adds a cubic bezier curve from the current point, using two control
60 points and an end point.
61 */
a44f3b5a
FM
62 virtual void AddCurveToPoint(wxDouble cx1, wxDouble cy1,
63 wxDouble cx2, wxDouble cy2,
64 wxDouble x, wxDouble y);
23d291c2
BP
65 /**
66 Adds a cubic bezier curve from the current point, using two control
67 points and an end point.
23324ae1 68 */
7c913512
FM
69 void AddCurveToPoint(const wxPoint2DDouble& c1,
70 const wxPoint2DDouble& c2,
71 const wxPoint2DDouble& e);
23324ae1
FM
72
73 /**
74 Appends an ellipse fitting into the passed in rectangle.
75 */
da1ed74c 76 virtual void AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
23324ae1 77
23324ae1 78 /**
23d291c2
BP
79 Adds a straight line from the current point to (@a x,@a y).
80 */
81 virtual void AddLineToPoint(wxDouble x, wxDouble y);
82 /**
83 Adds a straight line from the current point to @a p.
23324ae1 84 */
7c913512 85 void AddLineToPoint(const wxPoint2DDouble& p);
23324ae1
FM
86
87 /**
88 Adds another path.
89 */
da1ed74c 90 virtual void AddPath(const wxGraphicsPath& path);
23324ae1
FM
91
92 /**
23d291c2
BP
93 Adds a quadratic bezier curve from the current point, using a control
94 point and an end point.
23324ae1 95 */
23d291c2
BP
96 virtual void AddQuadCurveToPoint(wxDouble cx, wxDouble cy,
97 wxDouble x, wxDouble y);
23324ae1
FM
98
99 /**
100 Appends a rectangle as a new closed subpath.
101 */
da1ed74c 102 virtual void AddRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
23324ae1
FM
103
104 /**
105 Appends a rounded rectangle as a new closed subpath.
106 */
da1ed74c
FM
107 virtual void AddRoundedRectangle(wxDouble x, wxDouble y, wxDouble w,
108 wxDouble h, wxDouble radius);
23324ae1
FM
109
110 /**
111 Closes the current sub-path.
112 */
da1ed74c 113 virtual void CloseSubpath();
23324ae1 114
23324ae1 115 /**
23d291c2 116 @return @true if the point is within the path.
23324ae1
FM
117 */
118 bool Contains(const wxPoint2DDouble& c,
6e350141 119 wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const;
23d291c2
BP
120 /**
121 @return @true if the point is within the path.
122 */
123 virtual bool Contains(wxDouble x, wxDouble y,
6e350141 124 wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const;
23324ae1 125
23324ae1 126 /**
23d291c2
BP
127 Gets the bounding box enclosing all points (possibly including control
128 points).
23324ae1 129 */
328f5751 130 wxRect2DDouble GetBox() const;
23d291c2
BP
131 /**
132 Gets the bounding box enclosing all points (possibly including control
133 points).
134 */
135 virtual void GetBox(wxDouble* x, wxDouble* y,
136 wxDouble* w, wxDouble* h) const;
23324ae1 137
23324ae1
FM
138 /**
139 Gets the last point of the current path, (0,0) if not yet set.
140 */
23d291c2
BP
141 virtual void GetCurrentPoint(wxDouble* x, wxDouble* y) const;
142 /**
143 Gets the last point of the current path, (0,0) if not yet set.
144 */
145 wxPoint2DDouble GetCurrentPoint() const;
23324ae1
FM
146
147 /**
23d291c2
BP
148 Returns the native path (CGPathRef for Core Graphics, Path pointer for
149 GDIPlus and a cairo_path_t pointer for cairo).
23324ae1 150 */
da1ed74c 151 virtual void* GetNativePath() const;
23324ae1 152
23324ae1 153 /**
23d291c2
BP
154 Begins a new subpath at (@a x,@a y).
155 */
156 virtual void MoveToPoint(wxDouble x, wxDouble y);
157 /**
158 Begins a new subpath at @a p.
23324ae1 159 */
7c913512 160 void MoveToPoint(const wxPoint2DDouble& p);
23324ae1
FM
161
162 /**
163 Transforms each point of this path by the matrix.
164 */
da1ed74c 165 virtual void Transform(const wxGraphicsMatrix& matrix);
23324ae1
FM
166
167 /**
23d291c2
BP
168 Gives back the native path returned by GetNativePath() because there
169 might be some deallocations necessary (e.g. on cairo the native path
170 returned by GetNativePath() is newly allocated each time).
23324ae1 171 */
da1ed74c 172 virtual void UnGetNativePath(void* p) const;
23324ae1
FM
173};
174
175
e54c96f1 176
23324ae1
FM
177/**
178 @class wxGraphicsObject
7c913512 179
23324ae1
FM
180 This class is the superclass of native graphics objects like pens etc. It
181 allows reference counting. Not instantiated by user code.
7c913512 182
23324ae1 183 @library{wxcore}
23d291c2 184 @category{gdi}
7c913512 185
e54c96f1 186 @see wxGraphicsBrush, wxGraphicsPen, wxGraphicsMatrix, wxGraphicsPath
23324ae1
FM
187*/
188class wxGraphicsObject : public wxObject
189{
190public:
191 /**
23d291c2
BP
192 Returns the renderer that was used to create this instance, or @NULL
193 if it has not been initialized yet.
23324ae1 194 */
328f5751 195 wxGraphicsRenderer* GetRenderer() const;
23324ae1
FM
196
197 /**
23d291c2 198 @return @false if this object is valid, otherwise returns @true.
23324ae1 199 */
328f5751 200 bool IsNull() const;
23324ae1
FM
201};
202
7395c7d6 203/**
ffc78010 204 Anti-aliasing modes used by wxGraphicsContext::SetAntialiasMode().
7395c7d6
SC
205*/
206enum wxAntialiasMode
207{
208 /** No anti-aliasing */
4ee4c7b9
VZ
209 wxANTIALIAS_NONE,
210
7395c7d6
SC
211 /** The default anti-aliasing */
212 wxANTIALIAS_DEFAULT,
213};
214
a173c813
SC
215/**
216 Interpolation quality used by wxGraphicsContext::SetInterpolationQuality().
217 */
218enum wxInterpolationQuality
219{
3399af21
SC
220 /** default interpolation, based on type of context, in general medium quality */
221 wxINTERPOLATION_DEFAULT,
a173c813
SC
222 /** no interpolation */
223 wxINTERPOLATION_NONE,
224 /** fast interpolation, suited for interactivity */
225 wxINTERPOLATION_FAST,
226 /** better quality */
227 wxINTERPOLATION_GOOD,
228 /** best quality, not suited for interactivity */
229 wxINTERPOLATION_BEST
230};
231
7395c7d6 232/**
4ee4c7b9 233 Compositing is done using Porter-Duff compositions
7395c7d6 234 (see http://keithp.com/~keithp/porterduff/p253-porter.pdf) with
ffc78010 235 wxGraphicsContext::SetCompositionMode().
7395c7d6
SC
236
237 The description give a short equation on how the values of a resulting
238 pixel are calculated.
ec3110ae
SC
239 @e R = Result, @e S = Source, @e D = Destination, colors premultiplied with alpha
240 @e Ra, @e Sa, @e Da their alpha components
7395c7d6
SC
241*/
242enum wxCompositionMode
243{
fec4e458
VZ
244 /**
245 Indicates invalid or unsupported composition mode.
246
247 This value can't be passed to wxGraphicsContext::SetCompositionMode().
248
249 @since 2.9.2
250 */
251 wxCOMPOSITION_INVALID = -1,
ec3110ae
SC
252 wxCOMPOSITION_CLEAR, /**< @e R = 0 */
253 wxCOMPOSITION_SOURCE, /**< @e R = S */
254 wxCOMPOSITION_OVER, /**< @e R = @e S + @e D*(1 - @e Sa) */
255 wxCOMPOSITION_IN, /**< @e R = @e S*@e Da */
256 wxCOMPOSITION_OUT, /**< @e R = @e S*(1 - @e Da) */
257 wxCOMPOSITION_ATOP, /**< @e R = @e S*@e Da + @e D*(1 - @e Sa) */
258
259 wxCOMPOSITION_DEST, /**< @e R = @e D, essentially a noop */
260 wxCOMPOSITION_DEST_OVER, /**< @e R = @e S*(1 - @e Da) + @e D */
261 wxCOMPOSITION_DEST_IN, /**< @e R = @e D*@e Sa */
262 wxCOMPOSITION_DEST_OUT, /**< @e R = @e D*(1 - @e Sa) */
263 wxCOMPOSITION_DEST_ATOP, /**< @e R = @e S*(1 - @e Da) + @e D*@e Sa */
264 wxCOMPOSITION_XOR, /**< @e R = @e S*(1 - @e Da) + @e D*(1 - @e Sa) */
bbd783e0 265 wxCOMPOSITION_ADD /**< @e R = @e S + @e D */
7395c7d6 266};
23324ae1 267
3c9e0b81
VZ
268/**
269 Represents a bitmap.
270
271 The objects of this class are not created directly but only via
0a470e5e
VZ
272 wxGraphicsContext or wxGraphicsRenderer CreateBitmap(),
273 CreateBitmapFromImage() or CreateSubBitmap() methods. They can subsequently
274 be used with wxGraphicsContext::DrawBitmap(). The only other operation is
275 testing for the bitmap validity which can be performed using IsNull()
276 method inherited from the base class.
3c9e0b81
VZ
277 */
278class wxGraphicsBitmap : public wxGraphicsObject
279{
280public:
281 /**
282 Default constructor creates an invalid bitmap.
283 */
284 wxGraphicsBitmap() {}
08b2d55f
VZ
285
286 /**
287 Return the contents of this bitmap as wxImage.
288
289 Using this method is more efficient than converting wxGraphicsBitmap to
290 wxBitmap first and then to wxImage and can be useful if, for example,
291 you want to save wxGraphicsBitmap as a disk file in a format not
292 directly supported by wxBitmap.
293
294 Invalid image is returned if the bitmap is invalid.
295
296 @since 2.9.3
297 */
298 wxImage ConvertToImage() const;
3c9e0b81 299};
e54c96f1 300
23324ae1
FM
301/**
302 @class wxGraphicsContext
7c913512 303
9cc4ab85
BP
304 A wxGraphicsContext instance is the object that is drawn upon. It is
305 created by a renderer using wxGraphicsRenderer::CreateContext(). This can
306 be either directly using a renderer instance, or indirectly using the
307 static convenience Create() functions of wxGraphicsContext that always
308 delegate the task to the default renderer.
7c913512 309
d974a494
RR
310 @code
311 void MyCanvas::OnPaint(wxPaintEvent &event)
312 {
313 // Create paint DC
314 wxPaintDC dc(this);
23d291c2 315
d974a494 316 // Create graphics context from it
ea077571 317 wxGraphicsContext *gc = wxGraphicsContext::Create( dc );
23d291c2 318
7e38ae60
RR
319 if (gc)
320 {
0b822969 321 // make a path that contains a circle and some lines
7e38ae60
RR
322 gc->SetPen( *wxRED_PEN );
323 wxGraphicsPath path = gc->CreatePath();
324 path.AddCircle( 50.0, 50.0, 50.0 );
325 path.MoveToPoint(0.0, 50.0);
326 path.AddLineToPoint(100.0, 50.0);
327 path.MoveToPoint(50.0, 0.0);
328 path.AddLineToPoint(50.0, 100.0 );
329 path.CloseSubpath();
330 path.AddRectangle(25.0, 25.0, 50.0, 50.0);
23d291c2 331
ea077571 332 gc->StrokePath(path);
23d291c2 333
ea077571 334 delete gc;
7e38ae60
RR
335 }
336 }
d974a494
RR
337 @endcode
338
23324ae1 339 @library{wxcore}
23d291c2 340 @category{gdi,dc}
7c913512 341
6d99a337 342 @see wxGraphicsRenderer::CreateContext(), wxGCDC, wxDC
23324ae1
FM
343*/
344class wxGraphicsContext : public wxGraphicsObject
345{
346public:
23324ae1 347 /**
0b822969
RR
348 Creates a wxGraphicsContext from a wxWindow.
349
350 @see wxGraphicsRenderer::CreateContext()
351 */
9cc4ab85 352 static wxGraphicsContext* Create(wxWindow* window);
23d291c2 353
0b822969
RR
354 /**
355 Creates a wxGraphicsContext from a wxWindowDC
356
357 @see wxGraphicsRenderer::CreateContext()
358 */
e33cc297 359 static wxGraphicsContext* Create(const wxWindowDC& windowDC);
23d291c2 360
0b822969
RR
361 /**
362 Creates a wxGraphicsContext from a wxMemoryDC
363
364 @see wxGraphicsRenderer::CreateContext()
365 */
e33cc297 366 static wxGraphicsContext* Create(const wxMemoryDC& memoryDC);
23d291c2 367
0b822969 368 /**
9cc4ab85
BP
369 Creates a wxGraphicsContext from a wxPrinterDC. Under GTK+, this will
370 only work when using the GtkPrint printing backend which is available
371 since GTK+ 2.10.
0b822969 372
9cc4ab85 373 @see wxGraphicsRenderer::CreateContext(), @ref overview_unixprinting
0b822969 374 */
e33cc297 375 static wxGraphicsContext* Create(const wxPrinterDC& printerDC);
0b822969 376
1bf9327b
VZ
377 /**
378 Creates a wxGraphicsContext from a wxEnhMetaFileDC.
379
380 This function, as wxEnhMetaFileDC class itself, is only available only
381 under MSW.
382
383 @see wxGraphicsRenderer::CreateContext()
384 */
e33cc297 385 static wxGraphicsContext* Create(const wxEnhMetaFileDC& metaFileDC);
1bf9327b 386
0a470e5e
VZ
387 /**
388 Creates a wxGraphicsContext associated with a wxImage.
389
390 The image specifies the size of the context as well as whether alpha is
391 supported (if wxImage::HasAlpha()) or not and the initial contents of
392 the context. The @a image object must have a life time greater than
393 that of the new context as the context copies its contents back to the
394 image when it is destroyed.
395
396 @since 2.9.3
397 */
398 static wxGraphicsContext* Create(wxImage& image);
399
0b822969 400 /**
9cc4ab85 401 Clips drawings to the specified region.
23324ae1 402 */
da1ed74c 403 virtual void Clip(const wxRegion& region) = 0;
0b822969
RR
404
405 /**
9cc4ab85 406 Clips drawings to the specified rectangle.
0b822969 407 */
da1ed74c 408 virtual void Clip(wxDouble x, wxDouble y, wxDouble w, wxDouble h) = 0;
23324ae1
FM
409
410 /**
9cc4ab85
BP
411 Concatenates the passed in transform with the current transform of this
412 context.
23324ae1 413 */
da1ed74c 414 virtual void ConcatTransform(const wxGraphicsMatrix& matrix) = 0;
23324ae1 415
3c9e0b81
VZ
416 /**
417 Creates wxGraphicsBitmap from an existing wxBitmap.
418
419 Returns an invalid wxNullGraphicsBitmap on failure.
420 */
421 virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0;
422
0a470e5e
VZ
423 /**
424 Creates wxGraphicsBitmap from an existing wxImage.
425
426 This method is more efficient than converting wxImage to wxBitmap first
427 and then calling CreateBitmap() but otherwise has the same effect.
428
429 Returns an invalid wxNullGraphicsBitmap on failure.
430
431 @since 2.9.3
432 */
433 virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image);
434
3c9e0b81
VZ
435 /**
436 Extracts a sub-bitmap from an existing bitmap.
437
438 Currently this function is implemented in the native MSW and OS X
439 versions but not when using Cairo.
440 */
441 virtual wxGraphicsBitmap CreateSubBitmap(const wxGraphicsBitmap& bitmap,
442 wxDouble x, wxDouble y,
443 wxDouble w, wxDouble h) = 0;
444
23324ae1
FM
445 /**
446 Creates a native brush from a wxBrush.
447 */
da1ed74c 448 virtual wxGraphicsBrush CreateBrush(const wxBrush& brush) const;
23324ae1
FM
449
450 /**
451 Creates a native graphics font from a wxFont and a text colour.
452 */
5267aefd
FM
453 virtual wxGraphicsFont CreateFont(const wxFont& font,
454 const wxColour& col = *wxBLACK) const;
23324ae1 455
fa378d36
VZ
456 /**
457 Creates a font object with the specified attributes.
458
459 The use of overload taking wxFont is preferred, see
460 wxGraphicsRenderer::CreateFont() for more details.
461
462 @since 2.9.3
463 */
464 virtual wxGraphicsFont CreateFont(double sizeInPixels,
465 const wxString& facename,
466 int flags = wxFONTFLAG_DEFAULT,
467 const wxColour& col = *wxBLACK) const;
468
23324ae1 469 /**
9cc4ab85
BP
470 Creates a wxGraphicsContext from a native context. This native context
471 must be a CGContextRef for Core Graphics, a Graphics pointer for
472 GDIPlus, or a cairo_t pointer for cairo.
3c4f71cc 473
9cc4ab85 474 @see wxGraphicsRenderer::CreateContextFromNativeContext()
23324ae1 475 */
da1ed74c 476 static wxGraphicsContext* CreateFromNative(void* context);
23324ae1
FM
477
478 /**
19e496b6
RR
479 Creates a wxGraphicsContext from a native window.
480
9cc4ab85 481 @see wxGraphicsRenderer::CreateContextFromNativeWindow()
23324ae1 482 */
da1ed74c 483 static wxGraphicsContext* CreateFromNativeWindow(void* window);
23324ae1
FM
484
485 /**
4ee4c7b9
VZ
486 Creates a native brush with a linear gradient.
487
488 The brush starts at (@a x1, @a y1) and ends at (@a x2, @a y2). Either
489 just the start and end gradient colours (@a c1 and @a c2) or full set
490 of gradient @a stops can be specified.
491
492 The version taking wxGraphicsGradientStops is new in wxWidgets 2.9.1.
23324ae1 493 */
4ee4c7b9
VZ
494 //@{
495 wxGraphicsBrush
496 CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
497 wxDouble x2, wxDouble y2,
498 const wxColour& c1, const wxColour& c2) const;
499
500 wxGraphicsBrush
501 CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
502 wxDouble x2, wxDouble y2,
503 const wxGraphicsGradientStops& stops) const;
504 //@}
23324ae1
FM
505
506 /**
9cc4ab85
BP
507 Creates a native affine transformation matrix from the passed in
508 values. The default parameters result in an identity matrix.
23324ae1 509 */
5267aefd
FM
510 virtual wxGraphicsMatrix CreateMatrix(wxDouble a = 1.0, wxDouble b = 0.0,
511 wxDouble c = 0.0, wxDouble d = 1.0,
a44f3b5a
FM
512 wxDouble tx = 0.0,
513 wxDouble ty = 0.0) const;
23324ae1
FM
514
515 /**
516 Creates a native graphics path which is initially empty.
517 */
328f5751 518 wxGraphicsPath CreatePath() const;
23324ae1
FM
519
520 /**
521 Creates a native pen from a wxPen.
522 */
da1ed74c 523 virtual wxGraphicsPen CreatePen(const wxPen& pen) const;
23324ae1
FM
524
525 /**
4ee4c7b9
VZ
526 Creates a native brush with a radial gradient.
527
d13b34d3 528 The brush originates at (@a xo, @a yc) and ends on a circle around
4ee4c7b9
VZ
529 (@a xc, @a yc) with the given @a radius.
530
531 The gradient may be specified either by its start and end colours @a
532 oColor and @a cColor or by a full set of gradient @a stops.
533
534 The version taking wxGraphicsGradientStops is new in wxWidgets 2.9.1.
23324ae1 535 */
4ee4c7b9
VZ
536 //@{
537 virtual wxGraphicsBrush
538 CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
539 wxDouble xc, wxDouble yc,
540 wxDouble radius,
541 const wxColour& oColor,
542 const wxColour& cColor) const;
543
544 virtual wxGraphicsBrush
545 CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
546 wxDouble xc, wxDouble yc,
547 wxDouble radius,
548 const wxGraphicsGradientStops& stops) = 0;
549 //@}
23324ae1
FM
550
551 /**
9cc4ab85
BP
552 Draws the bitmap. In case of a mono bitmap, this is treated as a mask
553 and the current brushed is used for filling.
23324ae1 554 */
3c9e0b81
VZ
555 //@{
556 virtual void DrawBitmap(const wxGraphicsBitmap& bmp,
557 wxDouble x, wxDouble y,
558 wxDouble w, wxDouble h ) = 0;
559 virtual void DrawBitmap(const wxBitmap& bmp,
560 wxDouble x, wxDouble y,
fadc2df6 561 wxDouble w, wxDouble h) = 0;
3c9e0b81 562 //@}
23324ae1
FM
563
564 /**
565 Draws an ellipse.
566 */
da1ed74c 567 virtual void DrawEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
23324ae1
FM
568
569 /**
570 Draws the icon.
571 */
fadc2df6
FM
572 virtual void DrawIcon(const wxIcon& icon, wxDouble x, wxDouble y,
573 wxDouble w, wxDouble h) = 0;
23324ae1
FM
574
575 /**
576 Draws a polygon.
577 */
fadc2df6 578 virtual void DrawLines(size_t n, const wxPoint2DDouble* points,
382f12e4 579 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
23324ae1
FM
580
581 /**
582 Draws the path by first filling and then stroking.
583 */
fadc2df6 584 virtual void DrawPath(const wxGraphicsPath& path,
382f12e4 585 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
23324ae1
FM
586
587 /**
588 Draws a rectangle.
589 */
fadc2df6 590 virtual void DrawRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
23324ae1
FM
591
592 /**
593 Draws a rounded rectangle.
594 */
da1ed74c
FM
595 virtual void DrawRoundedRectangle(wxDouble x, wxDouble y, wxDouble w,
596 wxDouble h, wxDouble radius);
23324ae1 597
23324ae1 598 /**
9cc4ab85 599 Draws text at the defined position.
23324ae1 600 */
7c913512 601 void DrawText(const wxString& str, wxDouble x, wxDouble y);
9cc4ab85
BP
602 /**
603 Draws text at the defined position.
604
cbd251ac
BP
605 @param str
606 The text to draw.
607 @param x
608 The x coordinate position to draw the text at.
609 @param y
610 The y coordinate position to draw the text at.
9cc4ab85
BP
611 @param angle
612 The angle relative to the (default) horizontal direction to draw
613 the string.
614 */
615 void DrawText(const wxString& str, wxDouble x, wxDouble y, wxDouble angle);
616 /**
617 Draws text at the defined position.
618
cbd251ac
BP
619 @param str
620 The text to draw.
621 @param x
622 The x coordinate position to draw the text at.
623 @param y
624 The y coordinate position to draw the text at.
9cc4ab85
BP
625 @param backgroundBrush
626 Brush to fill the text with.
627 */
5a395566 628 void DrawText(const wxString& str, wxDouble x, wxDouble y,
9cc4ab85
BP
629 const wxGraphicsBrush& backgroundBrush);
630 /**
631 Draws text at the defined position.
632
cbd251ac
BP
633 @param str
634 The text to draw.
635 @param x
636 The x coordinate position to draw the text at.
637 @param y
638 The y coordinate position to draw the text at.
9cc4ab85
BP
639 @param angle
640 The angle relative to the (default) horizontal direction to draw
641 the string.
642 @param backgroundBrush
643 Brush to fill the text with.
644 */
5a395566 645 void DrawText(const wxString& str, wxDouble x, wxDouble y,
9cc4ab85 646 wxDouble angle, const wxGraphicsBrush& backgroundBrush);
23324ae1
FM
647
648 /**
649 Fills the path with the current brush.
650 */
fadc2df6 651 virtual void FillPath(const wxGraphicsPath& path,
382f12e4 652 wxPolygonFillMode fillStyle = wxODDEVEN_RULE) = 0;
23324ae1
FM
653
654 /**
9cc4ab85
BP
655 Returns the native context (CGContextRef for Core Graphics, Graphics
656 pointer for GDIPlus and cairo_t pointer for cairo).
23324ae1 657 */
da1ed74c 658 virtual void* GetNativeContext() = 0;
23324ae1
FM
659
660 /**
4cc4bfaf 661 Fills the @a widths array with the widths from the beginning of
9cc4ab85 662 @a text to the corresponding character of @a text.
23324ae1 663 */
fadc2df6
FM
664 virtual void GetPartialTextExtents(const wxString& text,
665 wxArrayDouble& widths) const = 0;
23324ae1
FM
666
667 /**
668 Gets the dimensions of the string using the currently selected font.
9cc4ab85
BP
669
670 @param text
671 The text string to measure.
672 @param width
673 Variable to store the total calculated width of the text.
674 @param height
675 Variable to store the total calculated height of the text.
676 @param descent
677 Variable to store the dimension from the baseline of the font to
678 the bottom of the descender.
679 @param externalLeading
680 Any extra vertical space added to the font by the font designer
681 (usually is zero).
23324ae1 682 */
da1ed74c
FM
683 virtual void GetTextExtent(const wxString& text, wxDouble* width,
684 wxDouble* height, wxDouble* descent,
685 wxDouble* externalLeading) const = 0;
23324ae1
FM
686
687 /**
688 Gets the current transformation matrix of this context.
689 */
da1ed74c 690 virtual wxGraphicsMatrix GetTransform() const = 0;
23324ae1
FM
691
692 /**
693 Resets the clipping to original shape.
694 */
da1ed74c 695 virtual void ResetClip() = 0;
23324ae1
FM
696
697 /**
9cc4ab85 698 Rotates the current transformation matrix (in radians).
23324ae1 699 */
da1ed74c 700 virtual void Rotate(wxDouble angle) = 0;
23324ae1
FM
701
702 /**
703 Scales the current transformation matrix.
704 */
da1ed74c 705 virtual void Scale(wxDouble xScale, wxDouble yScale) = 0;
23324ae1 706
23324ae1
FM
707 /**
708 Sets the brush for filling paths.
709 */
710 void SetBrush(const wxBrush& brush);
9cc4ab85
BP
711 /**
712 Sets the brush for filling paths.
713 */
ccf39540 714 virtual void SetBrush(const wxGraphicsBrush& brush);
23324ae1 715
23324ae1
FM
716 /**
717 Sets the font for drawing text.
718 */
719 void SetFont(const wxFont& font, const wxColour& colour);
9cc4ab85
BP
720 /**
721 Sets the font for drawing text.
722 */
ccf39540 723 virtual void SetFont(const wxGraphicsFont& font);
23324ae1 724
23324ae1
FM
725 /**
726 Sets the pen used for stroking.
727 */
ccf39540 728 void SetPen(const wxPen& pen);
9cc4ab85
BP
729 /**
730 Sets the pen used for stroking.
731 */
ccf39540 732 virtual void SetPen(const wxGraphicsPen& pen);
23324ae1
FM
733
734 /**
735 Sets the current transformation matrix of this context
736 */
da1ed74c 737 virtual void SetTransform(const wxGraphicsMatrix& matrix) = 0;
23324ae1
FM
738
739 /**
740 Strokes a single line.
741 */
fadc2df6 742 virtual void StrokeLine(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2);
23324ae1 743
23324ae1 744 /**
9cc4ab85
BP
745 Stroke disconnected lines from begin to end points, fastest method
746 available for this purpose.
23324ae1 747 */
ccf39540
FM
748 virtual void StrokeLines(size_t n, const wxPoint2DDouble* beginPoints,
749 const wxPoint2DDouble* endPoints);
9cc4ab85 750 /**
25941fc5
VZ
751 Stroke lines connecting all the points.
752
753 Unlike the other overload of this function, this method draws a single
754 polyline and not a number of disconnected lines.
9cc4ab85 755 */
ccf39540 756 virtual void StrokeLines(size_t n, const wxPoint2DDouble* points);
23324ae1
FM
757
758 /**
759 Strokes along a path with the current pen.
760 */
da1ed74c 761 virtual void StrokePath(const wxGraphicsPath& path) = 0;
23324ae1
FM
762
763 /**
764 Translates the current transformation matrix.
765 */
da1ed74c 766 virtual void Translate(wxDouble dx, wxDouble dy) = 0;
7395c7d6
SC
767
768 /**
4ee4c7b9 769 Redirects all rendering is done into a fully transparent temporary context
7395c7d6
SC
770 */
771 virtual void BeginLayer(wxDouble opacity) = 0;
772
4ee4c7b9
VZ
773 /**
774 Composites back the drawings into the context with the opacity given at
7395c7d6
SC
775 the BeginLayer call
776 */
777 virtual void EndLayer() = 0;
778
4ee4c7b9 779 /**
7395c7d6
SC
780 Sets the antialiasing mode, returns true if it supported
781 */
782 virtual bool SetAntialiasMode(wxAntialiasMode antialias) = 0;
783
4ee4c7b9 784 /**
7395c7d6
SC
785 Returns the current shape antialiasing mode
786 */
787 virtual wxAntialiasMode GetAntialiasMode() const ;
4ee4c7b9 788
a173c813
SC
789 /**
790 Sets the interpolation quality, returns true if it supported
791 */
792 virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation) = 0;
793
794 /**
795 Returns the current interpolation quality
796 */
797 virtual wxInterpolationQuality GetInterpolationQuality() const;
798
7395c7d6
SC
799 /**
800 Sets the compositing operator, returns true if it supported
801 */
802 virtual bool SetCompositionMode(wxCompositionMode op) = 0;
803
4ee4c7b9 804 /**
7395c7d6
SC
805 Returns the current compositing operator
806 */
807 virtual wxCompositionMode GetCompositionMode() const;
4ee4c7b9 808
e33cc297
RD
809
810 virtual void EnableOffset(bool enable = true);
811 void DisableOffset();
812 bool OffsetEnabled();
813
4ee4c7b9
VZ
814};
815
816/**
817 Represents a single gradient stop in a collection of gradient stops as
818 represented by wxGraphicsGradientStops.
819
820 @library{wxcore}
821 @category{gdi}
822
823 @since 2.9.1
824*/
825class wxGraphicsGradientStop
826{
827public:
828 /**
829 Creates a stop with the given colour and position.
830
831 @param col The colour of this stop. Note that the alpha component of
832 the colour is honoured thus allowing the background colours to
833 partially show through the gradient.
2028c33a
VZ
834 @param pos The stop position, must be in [0, 1] range with 0 being the
835 beginning and 1 the end of the gradient.
4ee4c7b9 836 */
2028c33a 837 wxGraphicsGradientStop(wxColour col = wxTransparentColour, float pos = 0.);
4ee4c7b9
VZ
838
839 /// Return the stop colour.
840 const wxColour& GetColour() const;
841
842 /**
843 Change the stop colour.
844
845 @param col The new colour.
846 */
847 void SetColour(const wxColour& col);
848
849 /// Return the stop position.
850 float GetPosition() const;
851
852 /**
853 Change the stop position.
854
2028c33a 855 @param pos The new position, must always be in [0, 1] range.
4ee4c7b9
VZ
856 */
857 void SetPosition(float pos);
23324ae1
FM
858};
859
4ee4c7b9
VZ
860/**
861 Represents a collection of wxGraphicGradientStop values for use with
862 CreateLinearGradientBrush and CreateRadialGradientBrush.
863
864 The stops are maintained in order of position. If two or more stops are
865 added with the same position then the one(s) added later come later.
866 This can be useful for producing discontinuities in the colour gradient.
867
868 Notice that this class is write-once, you can't modify the stops once they
869 had been added.
870
871 @library{wxcore}
872 @category{gdi}
873
874 @since 2.9.1
875*/
876class wxGraphicsGradientStops
877{
878public:
879 /**
880 Initializes the gradient stops with the given boundary colours.
881
882 Creates a wxGraphicsGradientStops instance with start colour given
883 by @a startCol and end colour given by @a endCol.
884 */
885 wxGraphicsGradientStops(wxColour startCol = wxTransparentColour,
886 wxColour endCol = wxTransparentColour);
23324ae1 887
4ee4c7b9
VZ
888 /**
889 Add a new stop.
890 */
891 //@{
892 void Add(const wxGraphicsGradientStop& stop);
893 void Add(wxColour col, float pos);
894 //@}
895
896 /**
897 Returns the stop at the given index.
898
899 @param n The index, must be in [0, GetCount()) range.
900 */
901 wxGraphicsGradientStop Item(unsigned n) const;
902
903 /**
904 Returns the number of stops.
905 */
906 unsigned GetCount() const;
907
908 /**
909 Set the start colour to @a col
910 */
911 void SetStartColour(wxColour col);
912
913 /**
914 Returns the start colour.
915 */
916 wxColour GetStartColour() const;
917
918 /**
919 Set the end colour to @a col
920 */
921 void SetEndColour(wxColour col);
922
923 /**
924 Returns the end colour.
925 */
926 wxColour GetEndColour() const;
927};
e54c96f1 928
23324ae1
FM
929/**
930 @class wxGraphicsRenderer
7c913512 931
23324ae1 932 A wxGraphicsRenderer is the instance corresponding to the rendering engine
ea077571 933 used. There may be multiple instances on a system, if there are different
9cc4ab85
BP
934 rendering engines present, but there is always only one instance per
935 engine. This instance is pointed back to by all objects created by it
936 (wxGraphicsContext, wxGraphicsPath etc) and can be retrieved through their
937 wxGraphicsObject::GetRenderer() method. Therefore you can create an
938 additional instance of a path etc. by calling
939 wxGraphicsObject::GetRenderer() and then using the appropriate CreateXXX()
940 function of that renderer.
ea077571
RR
941
942 @code
943 wxGraphicsPath *path = // from somewhere
944 wxGraphicsBrush *brush = path->GetRenderer()->CreateBrush( *wxBLACK_BRUSH );
945 @endcode
7c913512 946
23324ae1 947 @library{wxcore}
9cc4ab85 948 @category{gdi}
23324ae1
FM
949*/
950class wxGraphicsRenderer : public wxObject
951{
952public:
3c9e0b81
VZ
953 /**
954 Creates wxGraphicsBitmap from an existing wxBitmap.
955
956 Returns an invalid wxNullGraphicsBitmap on failure.
957 */
958 virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0;
959
0a470e5e
VZ
960 /**
961 Creates wxGraphicsBitmap from an existing wxImage.
962
963 This method is more efficient than converting wxImage to wxBitmap first
964 and then calling CreateBitmap() but otherwise has the same effect.
965
966 Returns an invalid wxNullGraphicsBitmap on failure.
967
968 @since 2.9.3
969 */
970 virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) = 0;
971
6e6f074b
RD
972 /**
973 Creates a wxImage from a wxGraphicsBitmap.
974
975 This method is used by the more convenient wxGraphicsBitmap::ConvertToImage.
976 */
977 virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp) = 0;
978
3c9e0b81
VZ
979 /**
980 Creates wxGraphicsBitmap from a native bitmap handle.
981
982 @a bitmap meaning is platform-dependent. Currently it's a GDI+ @c
983 Bitmap pointer under MSW, @c CGImage pointer under OS X or a @c
984 cairo_surface_t pointer when using Cairo under any platform.
985 */
986 virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ) = 0;
987
23324ae1 988 /**
ea077571 989 Creates a wxGraphicsContext from a wxWindow.
23324ae1 990 */
ea077571 991 virtual wxGraphicsContext* CreateContext(wxWindow* window) = 0;
23d291c2 992
ea077571
RR
993 /**
994 Creates a wxGraphicsContext from a wxWindowDC
995 */
e33cc297 996 virtual wxGraphicsContext* CreateContext(const wxWindowDC& windowDC) = 0 ;
23d291c2 997
ea077571
RR
998 /**
999 Creates a wxGraphicsContext from a wxMemoryDC
1000 */
e33cc297 1001 virtual wxGraphicsContext* CreateContext(const wxMemoryDC& memoryDC) = 0 ;
23d291c2 1002
ea077571
RR
1003 /**
1004 Creates a wxGraphicsContext from a wxPrinterDC
1005 */
e33cc297 1006 virtual wxGraphicsContext* CreateContext(const wxPrinterDC& printerDC) = 0 ;
23324ae1 1007
1bf9327b
VZ
1008 /**
1009 Creates a wxGraphicsContext from a wxEnhMetaFileDC.
1010
1011 This function, as wxEnhMetaFileDC class itself, is only available only
1012 under MSW.
1013 */
e33cc297 1014 virtual wxGraphicsContext* CreateContext(const wxEnhMetaFileDC& metaFileDC) = 0;
1bf9327b 1015
0a470e5e
VZ
1016 /**
1017 Creates a wxGraphicsContext associated with a wxImage.
1018
1019 This function is used by wxContext::CreateFromImage() and is not
1020 normally called directly.
1021
1022 @since 2.9.3
1023 */
7422d797 1024 wxGraphicsContext* CreateContextFromImage(wxImage& image);
0a470e5e 1025
23324ae1 1026 /**
ea077571 1027 Creates a native brush from a wxBrush.
23324ae1 1028 */
da1ed74c 1029 virtual wxGraphicsBrush CreateBrush(const wxBrush& brush) = 0;
ea077571 1030
23324ae1 1031 /**
9cc4ab85
BP
1032 Creates a wxGraphicsContext from a native context. This native context
1033 must be a CGContextRef for Core Graphics, a Graphics pointer for
1034 GDIPlus, or a cairo_t pointer for cairo.
23324ae1 1035 */
da1ed74c 1036 virtual wxGraphicsContext* CreateContextFromNativeContext(void* context) = 0;
23324ae1
FM
1037
1038 /**
1039 Creates a wxGraphicsContext from a native window.
1040 */
da1ed74c 1041 virtual wxGraphicsContext* CreateContextFromNativeWindow(void* window) = 0;
23324ae1 1042
27a3b24b 1043 /**
4ee4c7b9 1044 Creates a wxGraphicsContext that can be used for measuring texts only.
27a3b24b
KO
1045 No drawing commands are allowed.
1046 */
1047 virtual wxGraphicsContext * CreateMeasuringContext() = 0;
1048
23324ae1
FM
1049 /**
1050 Creates a native graphics font from a wxFont and a text colour.
1051 */
5267aefd
FM
1052 virtual wxGraphicsFont CreateFont(const wxFont& font,
1053 const wxColour& col = *wxBLACK) = 0;
23324ae1 1054
fa378d36
VZ
1055 /**
1056 Creates a graphics font with the given characteristics.
1057
1058 If possible, the CreateFont() overload taking wxFont should be used
1059 instead. The main advantage of this overload is that it can be used
1060 without X server connection under Unix when using Cairo.
1061
1062 @param sizeInPixels
1063 Height of the font in user space units, i.e. normally pixels.
1064 Notice that this is different from the overload taking wxFont as
1065 wxFont size is specified in points.
1066 @param facename
1067 The name of the font. The same font name might not be available
1068 under all platforms so the font name can also be empty to use the
1069 default platform font.
1070 @param flags
1071 Combination of wxFontFlag enum elements. Currently only
1072 @c wxFONTFLAG_ITALIC and @c wxFONTFLAG_BOLD are supported. By
1073 default the normal font version is used.
1074 @param col
1075 The font colour, black by default.
1076
1077 @since 2.9.3
1078 */
1079 virtual wxGraphicsFont CreateFont(double sizeInPixels,
1080 const wxString& facename,
1081 int flags = wxFONTFLAG_DEFAULT,
1082 const wxColour& col = *wxBLACK) = 0;
1083
4ee4c7b9 1084
23324ae1 1085 /**
4ee4c7b9
VZ
1086 Creates a native brush with a linear gradient.
1087
1088 Stops support is new since wxWidgets 2.9.1, previously only the start
1089 and end colours could be specified.
23324ae1 1090 */
9cc4ab85
BP
1091 virtual wxGraphicsBrush CreateLinearGradientBrush(wxDouble x1,
1092 wxDouble y1,
1093 wxDouble x2,
1094 wxDouble y2,
4ee4c7b9 1095 const wxGraphicsGradientStops& stops) = 0;
23324ae1
FM
1096
1097 /**
9cc4ab85
BP
1098 Creates a native affine transformation matrix from the passed in
1099 values. The defaults result in an identity matrix.
23324ae1 1100 */
5267aefd
FM
1101 virtual wxGraphicsMatrix CreateMatrix(wxDouble a = 1.0, wxDouble b = 0.0,
1102 wxDouble c = 0.0, wxDouble d = 1.0,
a44f3b5a 1103 wxDouble tx = 0.0,
5267aefd 1104 wxDouble ty = 0.0) = 0;
23324ae1
FM
1105
1106 /**
1107 Creates a native graphics path which is initially empty.
1108 */
da1ed74c 1109 virtual wxGraphicsPath CreatePath() = 0;
23324ae1
FM
1110
1111 /**
1112 Creates a native pen from a wxPen.
1113 */
da1ed74c 1114 virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0;
23324ae1
FM
1115
1116 /**
4ee4c7b9
VZ
1117 Creates a native brush with a radial gradient.
1118
1119 Stops support is new since wxWidgets 2.9.1, previously only the start
1120 and end colours could be specified.
23324ae1 1121 */
da1ed74c
FM
1122 virtual wxGraphicsBrush CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
1123 wxDouble xc, wxDouble yc,
1124 wxDouble radius,
4ee4c7b9 1125 const wxGraphicsGradientStops& stops) = 0;
23324ae1 1126
3c9e0b81
VZ
1127 /**
1128 Extracts a sub-bitmap from an existing bitmap.
1129
1130 Currently this function is implemented in the native MSW and OS X
1131 versions but not when using Cairo.
1132 */
1133 virtual wxGraphicsBitmap CreateSubBitmap(const wxGraphicsBitmap& bitmap,
1134 wxDouble x, wxDouble y,
1135 wxDouble w, wxDouble h) = 0;
1136
23324ae1
FM
1137 /**
1138 Returns the default renderer on this platform. On OS X this is the Core
9cc4ab85
BP
1139 Graphics (a.k.a. Quartz 2D) renderer, on MSW the GDIPlus renderer, and
1140 on GTK we currently default to the cairo renderer.
23324ae1 1141 */
ea077571 1142 static wxGraphicsRenderer* GetDefaultRenderer();
e33cc297
RD
1143 static wxGraphicsRenderer* GetCairoRenderer();
1144
23324ae1
FM
1145};
1146
1147
e54c96f1 1148
23324ae1
FM
1149/**
1150 @class wxGraphicsBrush
7c913512 1151
9cc4ab85
BP
1152 A wxGraphicsBrush is a native representation of a brush. The contents are
1153 specific and private to the respective renderer. Instances are ref counted
1154 and can therefore be assigned as usual. The only way to get a valid
1155 instance is via wxGraphicsContext::CreateBrush() or
1156 wxGraphicsRenderer::CreateBrush().
7c913512 1157
23324ae1 1158 @library{wxcore}
9cc4ab85 1159 @category{gdi}
23324ae1
FM
1160*/
1161class wxGraphicsBrush : public wxGraphicsObject
1162{
1163public:
7c913512 1164
23324ae1
FM
1165};
1166
1167
e54c96f1 1168
23324ae1
FM
1169/**
1170 @class wxGraphicsFont
7c913512 1171
9cc4ab85
BP
1172 A wxGraphicsFont is a native representation of a font. The contents are
1173 specific and private to the respective renderer. Instances are ref counted
1174 and can therefore be assigned as usual. The only way to get a valid
1175 instance is via wxGraphicsContext::CreateFont() or
1176 wxGraphicsRenderer::CreateFont().
7c913512 1177
23324ae1 1178 @library{wxcore}
9cc4ab85 1179 @category{gdi}
23324ae1
FM
1180*/
1181class wxGraphicsFont : public wxGraphicsObject
1182{
1183public:
7c913512 1184
23324ae1
FM
1185};
1186
1187
e54c96f1 1188
23324ae1
FM
1189/**
1190 @class wxGraphicsPen
7c913512 1191
9cc4ab85
BP
1192 A wxGraphicsPen is a native representation of a pen. The contents are
1193 specific and private to the respective renderer. Instances are ref counted
1194 and can therefore be assigned as usual. The only way to get a valid
1195 instance is via wxGraphicsContext::CreatePen() or
1196 wxGraphicsRenderer::CreatePen().
7c913512 1197
23324ae1 1198 @library{wxcore}
9cc4ab85 1199 @category{gdi}
23324ae1
FM
1200*/
1201class wxGraphicsPen : public wxGraphicsObject
1202{
1203public:
7c913512 1204
23324ae1
FM
1205};
1206
1207
e54c96f1 1208
23324ae1
FM
1209/**
1210 @class wxGraphicsMatrix
7c913512 1211
9cc4ab85
BP
1212 A wxGraphicsMatrix is a native representation of an affine matrix. The
1213 contents are specific and private to the respective renderer. Instances are
1214 ref counted and can therefore be assigned as usual. The only way to get a
1215 valid instance is via wxGraphicsContext::CreateMatrix() or
1216 wxGraphicsRenderer::CreateMatrix().
7c913512 1217
23324ae1 1218 @library{wxcore}
9cc4ab85 1219 @category{gdi}
23324ae1
FM
1220*/
1221class wxGraphicsMatrix : public wxGraphicsObject
1222{
1223public:
23324ae1 1224 /**
9cc4ab85
BP
1225 Concatenates the matrix passed with the current matrix.
1226 */
1227 virtual void Concat(const wxGraphicsMatrix* t);
1228 /**
1229 Concatenates the matrix passed with the current matrix.
23324ae1 1230 */
7c913512 1231 void Concat(const wxGraphicsMatrix& t);
23324ae1
FM
1232
1233 /**
1234 Returns the component values of the matrix via the argument pointers.
1235 */
9cc4ab85
BP
1236 virtual void Get(wxDouble* a = NULL, wxDouble* b = NULL,
1237 wxDouble* c = NULL, wxDouble* d = NULL,
1238 wxDouble* tx = NULL, wxDouble* ty = NULL) const;
23324ae1
FM
1239
1240 /**
9cc4ab85
BP
1241 Returns the native representation of the matrix. For CoreGraphics this
1242 is a CFAffineMatrix pointer, for GDIPlus a Matrix Pointer, and for
1243 Cairo a cairo_matrix_t pointer.
23324ae1 1244 */
da1ed74c 1245 virtual void* GetNativeMatrix() const;
23324ae1
FM
1246
1247 /**
1248 Inverts the matrix.
1249 */
da1ed74c 1250 virtual void Invert();
23324ae1 1251
9cc4ab85
BP
1252 /**
1253 Returns @true if the elements of the transformation matrix are equal.
1254 */
1255 virtual bool IsEqual(const wxGraphicsMatrix* t) const;
23324ae1
FM
1256 /**
1257 Returns @true if the elements of the transformation matrix are equal.
1258 */
328f5751 1259 bool IsEqual(const wxGraphicsMatrix& t) const;
23324ae1
FM
1260
1261 /**
1262 Return @true if this is the identity matrix.
1263 */
da1ed74c 1264 virtual bool IsIdentity() const;
23324ae1
FM
1265
1266 /**
9cc4ab85 1267 Rotates this matrix (in radians).
23324ae1 1268 */
da1ed74c 1269 virtual void Rotate(wxDouble angle);
23324ae1
FM
1270
1271 /**
1272 Scales this matrix.
1273 */
da1ed74c 1274 virtual void Scale(wxDouble xScale, wxDouble yScale);
23324ae1
FM
1275
1276 /**
9cc4ab85
BP
1277 Sets the matrix to the respective values (default values are the
1278 identity matrix).
23324ae1 1279 */
5267aefd
FM
1280 virtual void Set(wxDouble a = 1.0, wxDouble b = 0.0, wxDouble c = 0.0,
1281 wxDouble d = 1.0, wxDouble tx = 0.0, wxDouble ty = 0.0);
23324ae1
FM
1282
1283 /**
1284 Applies this matrix to a distance (ie. performs all transforms except
9cc4ab85 1285 translations).
23324ae1 1286 */
da1ed74c 1287 virtual void TransformDistance(wxDouble* dx, wxDouble* dy) const;
23324ae1
FM
1288
1289 /**
1290 Applies this matrix to a point.
1291 */
da1ed74c 1292 virtual void TransformPoint(wxDouble* x, wxDouble* y) const;
23324ae1
FM
1293
1294 /**
1295 Translates this matrix.
1296 */
da1ed74c 1297 virtual void Translate(wxDouble dx, wxDouble dy);
23324ae1 1298};
9cc4ab85 1299
e33cc297
RD
1300
1301const wxGraphicsPen wxNullGraphicsPen;
1302const wxGraphicsBrush wxNullGraphicsBrush;
1303const wxGraphicsFont wxNullGraphicsFont;
1304const wxGraphicsBitmap wxNullGraphicsBitmap;
1305const wxGraphicsMatrix wxNullGraphicsMatrix;
1306const wxGraphicsPath wxNullGraphicsPath;