Reviewed and cleaned up the rest of the graphics.h interface header.
[wxWidgets.git] / interface / wx / graphics.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: graphics.h
3 // Purpose: interface of various wxGraphics* classes
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9 /**
10 @class wxGraphicsPath
11
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().
17
18 @library{wxcore}
19 @category{gdi}
20 */
21 class wxGraphicsPath : public wxGraphicsObject
22 {
23 public:
24 /**
25 Adds an arc of a circle centering at (@a x,@a y) with radius (@a r)
26 from @a startAngle to @a endAngle.
27 */
28 virtual void AddArc(wxDouble x, wxDouble y, wxDouble r,
29 wxDouble startAngle, wxDouble endAngle,
30 bool clockwise);
31 /**
32 Adds an arc of a circle centering at @a c with radius (@a r)
33 from @a startAngle to @a endAngle.
34 */
35 void AddArc(const wxPoint2DDouble& c, wxDouble r,
36 wxDouble startAngle, wxDouble endAngle, bool clockwise);
37
38 /**
39 Appends a an arc to two tangents connecting (current) to (@a x1,@a y1)
40 and (@a x1,@a y1) to (@a x2,@a y2), also a straight line from (current)
41 to (@a x1,@a y1).
42 */
43 virtual void AddArcToPoint(wxDouble x1, wxDouble y1, wxDouble x2,
44 wxDouble y2, wxDouble r);
45
46 /**
47 Appends a circle around (@a x,@a y) with radius @a r as a new closed
48 subpath.
49 */
50 virtual void AddCircle(wxDouble x, wxDouble y, wxDouble r);
51
52 /**
53 Adds a cubic bezier curve from the current point, using two control
54 points and an end point.
55 */
56 virtual void AddCurveToPoint(wxDouble cx1, wxDouble cy1,
57 wxDouble cx2, wxDouble cy2,
58 wxDouble x, wxDouble y);
59 /**
60 Adds a cubic bezier curve from the current point, using two control
61 points and an end point.
62 */
63 void AddCurveToPoint(const wxPoint2DDouble& c1,
64 const wxPoint2DDouble& c2,
65 const wxPoint2DDouble& e);
66
67 /**
68 Appends an ellipse fitting into the passed in rectangle.
69 */
70 virtual void AddEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
71
72 /**
73 Adds a straight line from the current point to (@a x,@a y).
74 */
75 virtual void AddLineToPoint(wxDouble x, wxDouble y);
76 /**
77 Adds a straight line from the current point to @a p.
78 */
79 void AddLineToPoint(const wxPoint2DDouble& p);
80
81 /**
82 Adds another path.
83 */
84 virtual void AddPath(const wxGraphicsPath& path);
85
86 /**
87 Adds a quadratic bezier curve from the current point, using a control
88 point and an end point.
89 */
90 virtual void AddQuadCurveToPoint(wxDouble cx, wxDouble cy,
91 wxDouble x, wxDouble y);
92
93 /**
94 Appends a rectangle as a new closed subpath.
95 */
96 virtual void AddRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
97
98 /**
99 Appends a rounded rectangle as a new closed subpath.
100 */
101 virtual void AddRoundedRectangle(wxDouble x, wxDouble y, wxDouble w,
102 wxDouble h, wxDouble radius);
103
104 /**
105 Closes the current sub-path.
106 */
107 virtual void CloseSubpath();
108
109 /**
110 @return @true if the point is within the path.
111 */
112 bool Contains(const wxPoint2DDouble& c,
113 int fillStyle = wxODDEVEN_RULE) const;
114 /**
115 @return @true if the point is within the path.
116 */
117 virtual bool Contains(wxDouble x, wxDouble y,
118 int fillStyle = wxODDEVEN_RULE) const;
119
120 /**
121 Gets the bounding box enclosing all points (possibly including control
122 points).
123 */
124 wxRect2DDouble GetBox() const;
125 /**
126 Gets the bounding box enclosing all points (possibly including control
127 points).
128 */
129 virtual void GetBox(wxDouble* x, wxDouble* y,
130 wxDouble* w, wxDouble* h) const;
131
132 /**
133 Gets the last point of the current path, (0,0) if not yet set.
134 */
135 virtual void GetCurrentPoint(wxDouble* x, wxDouble* y) const;
136 /**
137 Gets the last point of the current path, (0,0) if not yet set.
138 */
139 wxPoint2DDouble GetCurrentPoint() const;
140
141 /**
142 Returns the native path (CGPathRef for Core Graphics, Path pointer for
143 GDIPlus and a cairo_path_t pointer for cairo).
144 */
145 virtual void* GetNativePath() const;
146
147 /**
148 Begins a new subpath at (@a x,@a y).
149 */
150 virtual void MoveToPoint(wxDouble x, wxDouble y);
151 /**
152 Begins a new subpath at @a p.
153 */
154 void MoveToPoint(const wxPoint2DDouble& p);
155
156 /**
157 Transforms each point of this path by the matrix.
158 */
159 virtual void Transform(const wxGraphicsMatrix& matrix);
160
161 /**
162 Gives back the native path returned by GetNativePath() because there
163 might be some deallocations necessary (e.g. on cairo the native path
164 returned by GetNativePath() is newly allocated each time).
165 */
166 virtual void UnGetNativePath(void* p) const;
167 };
168
169
170
171 /**
172 @class wxGraphicsObject
173
174 This class is the superclass of native graphics objects like pens etc. It
175 allows reference counting. Not instantiated by user code.
176
177 @library{wxcore}
178 @category{gdi}
179
180 @see wxGraphicsBrush, wxGraphicsPen, wxGraphicsMatrix, wxGraphicsPath
181 */
182 class wxGraphicsObject : public wxObject
183 {
184 public:
185 /**
186 Returns the renderer that was used to create this instance, or @NULL
187 if it has not been initialized yet.
188 */
189 wxGraphicsRenderer* GetRenderer() const;
190
191 /**
192 @return @false if this object is valid, otherwise returns @true.
193 */
194 bool IsNull() const;
195 };
196
197
198
199 /**
200 @class wxGraphicsContext
201
202 A wxGraphicsContext instance is the object that is drawn upon. It is
203 created by a renderer using wxGraphicsRenderer::CreateContext(). This can
204 be either directly using a renderer instance, or indirectly using the
205 static convenience Create() functions of wxGraphicsContext that always
206 delegate the task to the default renderer.
207
208 @code
209 void MyCanvas::OnPaint(wxPaintEvent &event)
210 {
211 // Create paint DC
212 wxPaintDC dc(this);
213
214 // Create graphics context from it
215 wxGraphicsContext *gc = wxGraphicsContext::Create( dc );
216
217 if (gc)
218 {
219 // make a path that contains a circle and some lines
220 gc->SetPen( *wxRED_PEN );
221 wxGraphicsPath path = gc->CreatePath();
222 path.AddCircle( 50.0, 50.0, 50.0 );
223 path.MoveToPoint(0.0, 50.0);
224 path.AddLineToPoint(100.0, 50.0);
225 path.MoveToPoint(50.0, 0.0);
226 path.AddLineToPoint(50.0, 100.0 );
227 path.CloseSubpath();
228 path.AddRectangle(25.0, 25.0, 50.0, 50.0);
229
230 gc->StrokePath(path);
231
232 delete gc;
233 }
234 }
235 @endcode
236
237 @library{wxcore}
238 @category{gdi,dc}
239
240 @see wxGraphicsRenderer::CreateContext(), wxGCDC, wxDC
241 */
242 class wxGraphicsContext : public wxGraphicsObject
243 {
244 public:
245 /**
246 Creates a wxGraphicsContext from a wxWindow.
247
248 @see wxGraphicsRenderer::CreateContext()
249 */
250 static wxGraphicsContext* Create(wxWindow* window);
251
252 /**
253 Creates a wxGraphicsContext from a wxWindowDC
254
255 @see wxGraphicsRenderer::CreateContext()
256 */
257 static wxGraphicsContext* Create(const wxWindowDC& dc);
258
259 /**
260 Creates a wxGraphicsContext from a wxMemoryDC
261
262 @see wxGraphicsRenderer::CreateContext()
263 */
264 static wxGraphicsContext* Create(const wxMemoryDC& dc);
265
266 /**
267 Creates a wxGraphicsContext from a wxPrinterDC. Under GTK+, this will
268 only work when using the GtkPrint printing backend which is available
269 since GTK+ 2.10.
270
271 @see wxGraphicsRenderer::CreateContext(), @ref overview_unixprinting
272 */
273 static wxGraphicsContext* Create(const wxPrinterDC& dc);
274
275 /**
276 Clips drawings to the specified region.
277 */
278 virtual void Clip(const wxRegion& region) = 0;
279
280 /**
281 Clips drawings to the specified rectangle.
282 */
283 virtual void Clip(wxDouble x, wxDouble y, wxDouble w, wxDouble h) = 0;
284
285 /**
286 Concatenates the passed in transform with the current transform of this
287 context.
288 */
289 virtual void ConcatTransform(const wxGraphicsMatrix& matrix) = 0;
290
291 /**
292 Creates a native brush from a wxBrush.
293 */
294 virtual wxGraphicsBrush CreateBrush(const wxBrush& brush) const;
295
296 /**
297 Creates a native graphics font from a wxFont and a text colour.
298 */
299 virtual wxGraphicsFont CreateFont(const wxFont& font,
300 const wxColour& col = *wxBLACK) const;
301
302 /**
303 Creates a wxGraphicsContext from a native context. This native context
304 must be a CGContextRef for Core Graphics, a Graphics pointer for
305 GDIPlus, or a cairo_t pointer for cairo.
306
307 @see wxGraphicsRenderer::CreateContextFromNativeContext()
308 */
309 static wxGraphicsContext* CreateFromNative(void* context);
310
311 /**
312 Creates a wxGraphicsContext from a native window.
313
314 @see wxGraphicsRenderer::CreateContextFromNativeWindow()
315 */
316 static wxGraphicsContext* CreateFromNativeWindow(void* window);
317
318 /**
319 Creates a native brush, having a linear gradient, starting at
320 (@a x1, @a y1) with color @a c1 to (@a x2, @a y2) with color @a c2.
321 */
322 virtual wxGraphicsBrush CreateLinearGradientBrush(wxDouble x1,
323 wxDouble y1,
324 wxDouble x2,
325 wxDouble y2,
326 const wxColour& c1,
327 const wxColour& c2) const;
328
329 /**
330 Creates a native affine transformation matrix from the passed in
331 values. The default parameters result in an identity matrix.
332 */
333 virtual wxGraphicsMatrix CreateMatrix(wxDouble a = 1.0, wxDouble b = 0.0,
334 wxDouble c = 0.0, wxDouble d = 1.0,
335 wxDouble tx = 0.0,
336 wxDouble ty = 0.0) const;
337
338 /**
339 Creates a native graphics path which is initially empty.
340 */
341 wxGraphicsPath CreatePath() const;
342
343 /**
344 Creates a native pen from a wxPen.
345 */
346 virtual wxGraphicsPen CreatePen(const wxPen& pen) const;
347
348 /**
349 Creates a native brush, having a radial gradient originating at
350 (@a xo, @a yc) with color @a oColour and ends on a circle around
351 (@a xc, @a yc) with the given @a radius and color @a cColour.
352 */
353 virtual wxGraphicsBrush CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
354 wxDouble xc, wxDouble yc,
355 wxDouble radius,
356 const wxColour& oColor,
357 const wxColour& cColor) const;
358
359 /**
360 Draws the bitmap. In case of a mono bitmap, this is treated as a mask
361 and the current brushed is used for filling.
362 */
363 virtual void DrawBitmap(const wxBitmap& bmp, wxDouble x, wxDouble y,
364 wxDouble w, wxDouble h) = 0;
365
366 /**
367 Draws an ellipse.
368 */
369 virtual void DrawEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
370
371 /**
372 Draws the icon.
373 */
374 virtual void DrawIcon(const wxIcon& icon, wxDouble x, wxDouble y,
375 wxDouble w, wxDouble h) = 0;
376
377 /**
378 Draws a polygon.
379 */
380 virtual void DrawLines(size_t n, const wxPoint2DDouble* points,
381 int fillStyle = wxODDEVEN_RULE);
382
383 /**
384 Draws the path by first filling and then stroking.
385 */
386 virtual void DrawPath(const wxGraphicsPath& path,
387 int fillStyle = wxODDEVEN_RULE);
388
389 /**
390 Draws a rectangle.
391 */
392 virtual void DrawRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
393
394 /**
395 Draws a rounded rectangle.
396 */
397 virtual void DrawRoundedRectangle(wxDouble x, wxDouble y, wxDouble w,
398 wxDouble h, wxDouble radius);
399
400 /**
401 Draws text at the defined position.
402 */
403 void DrawText(const wxString& str, wxDouble x, wxDouble y);
404 /**
405 Draws text at the defined position.
406
407 @param angle
408 The angle relative to the (default) horizontal direction to draw
409 the string.
410 */
411 void DrawText(const wxString& str, wxDouble x, wxDouble y, wxDouble angle);
412 /**
413 Draws text at the defined position.
414
415 @param backgroundBrush
416 Brush to fill the text with.
417 */
418 void DrawText(const wxString& str, wxDouble x, wxDouble y,
419 const wxGraphicsBrush& backgroundBrush);
420 /**
421 Draws text at the defined position.
422
423 @param angle
424 The angle relative to the (default) horizontal direction to draw
425 the string.
426 @param backgroundBrush
427 Brush to fill the text with.
428 */
429 void DrawText(const wxString& str, wxDouble x, wxDouble y,
430 wxDouble angle, const wxGraphicsBrush& backgroundBrush);
431
432 /**
433 Fills the path with the current brush.
434 */
435 virtual void FillPath(const wxGraphicsPath& path,
436 int fillStyle = wxODDEVEN_RULE) = 0;
437
438 /**
439 Returns the native context (CGContextRef for Core Graphics, Graphics
440 pointer for GDIPlus and cairo_t pointer for cairo).
441 */
442 virtual void* GetNativeContext() = 0;
443
444 /**
445 Fills the @a widths array with the widths from the beginning of
446 @a text to the corresponding character of @a text.
447 */
448 virtual void GetPartialTextExtents(const wxString& text,
449 wxArrayDouble& widths) const = 0;
450
451 /**
452 Gets the dimensions of the string using the currently selected font.
453
454 @param text
455 The text string to measure.
456 @param width
457 Variable to store the total calculated width of the text.
458 @param height
459 Variable to store the total calculated height of the text.
460 @param descent
461 Variable to store the dimension from the baseline of the font to
462 the bottom of the descender.
463 @param externalLeading
464 Any extra vertical space added to the font by the font designer
465 (usually is zero).
466 */
467 virtual void GetTextExtent(const wxString& text, wxDouble* width,
468 wxDouble* height, wxDouble* descent,
469 wxDouble* externalLeading) const = 0;
470
471 /**
472 Gets the current transformation matrix of this context.
473 */
474 virtual wxGraphicsMatrix GetTransform() const = 0;
475
476 /**
477 Resets the clipping to original shape.
478 */
479 virtual void ResetClip() = 0;
480
481 /**
482 Rotates the current transformation matrix (in radians).
483 */
484 virtual void Rotate(wxDouble angle) = 0;
485
486 /**
487 Scales the current transformation matrix.
488 */
489 virtual void Scale(wxDouble xScale, wxDouble yScale) = 0;
490
491 /**
492 Sets the brush for filling paths.
493 */
494 void SetBrush(const wxBrush& brush);
495 /**
496 Sets the brush for filling paths.
497 */
498 void SetBrush(const wxGraphicsBrush& brush);
499
500 /**
501 Sets the font for drawing text.
502 */
503 void SetFont(const wxFont& font, const wxColour& colour);
504 /**
505 Sets the font for drawing text.
506 */
507 void SetFont(const wxGraphicsFont& font);
508
509 /**
510 Sets the pen used for stroking.
511 */
512 void SetPen(const wxGraphicsPen& pen);
513 /**
514 Sets the pen used for stroking.
515 */
516 void SetPen(const wxPen& pen);
517
518 /**
519 Sets the current transformation matrix of this context
520 */
521 virtual void SetTransform(const wxGraphicsMatrix& matrix) = 0;
522
523 /**
524 Strokes a single line.
525 */
526 virtual void StrokeLine(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2);
527
528 /**
529 Stroke disconnected lines from begin to end points, fastest method
530 available for this purpose.
531 */
532 void StrokeLines(size_t n, const wxPoint2DDouble* beginPoints,
533 const wxPoint2DDouble* endPoints);
534 /**
535 Stroke disconnected lines from begin to end points, fastest method
536 available for this purpose.
537 */
538 void StrokeLines(size_t n, const wxPoint2DDouble* points);
539
540 /**
541 Strokes along a path with the current pen.
542 */
543 virtual void StrokePath(const wxGraphicsPath& path) = 0;
544
545 /**
546 Translates the current transformation matrix.
547 */
548 virtual void Translate(wxDouble dx, wxDouble dy) = 0;
549 };
550
551
552
553 /**
554 @class wxGraphicsRenderer
555
556 A wxGraphicsRenderer is the instance corresponding to the rendering engine
557 used. There may be multiple instances on a system, if there are different
558 rendering engines present, but there is always only one instance per
559 engine. This instance is pointed back to by all objects created by it
560 (wxGraphicsContext, wxGraphicsPath etc) and can be retrieved through their
561 wxGraphicsObject::GetRenderer() method. Therefore you can create an
562 additional instance of a path etc. by calling
563 wxGraphicsObject::GetRenderer() and then using the appropriate CreateXXX()
564 function of that renderer.
565
566 @code
567 wxGraphicsPath *path = // from somewhere
568 wxGraphicsBrush *brush = path->GetRenderer()->CreateBrush( *wxBLACK_BRUSH );
569 @endcode
570
571 @library{wxcore}
572 @category{gdi}
573 */
574 class wxGraphicsRenderer : public wxObject
575 {
576 public:
577 /**
578 Creates a wxGraphicsContext from a wxWindow.
579 */
580 virtual wxGraphicsContext* CreateContext(wxWindow* window) = 0;
581
582 /**
583 Creates a wxGraphicsContext from a wxWindowDC
584 */
585 virtual wxGraphicsContext* CreateContext(const wxWindowDC& dc) = 0 ;
586
587 /**
588 Creates a wxGraphicsContext from a wxMemoryDC
589 */
590 virtual wxGraphicsContext* CreateContext(const wxMemoryDC& dc) = 0 ;
591
592 /**
593 Creates a wxGraphicsContext from a wxPrinterDC
594 */
595 virtual wxGraphicsContext* CreateContext(const wxPrinterDC& dc) = 0 ;
596
597 /**
598 Creates a native brush from a wxBrush.
599 */
600 virtual wxGraphicsBrush CreateBrush(const wxBrush& brush) = 0;
601
602 /**
603 Creates a wxGraphicsContext from a native context. This native context
604 must be a CGContextRef for Core Graphics, a Graphics pointer for
605 GDIPlus, or a cairo_t pointer for cairo.
606 */
607 virtual wxGraphicsContext* CreateContextFromNativeContext(void* context) = 0;
608
609 /**
610 Creates a wxGraphicsContext from a native window.
611 */
612 virtual wxGraphicsContext* CreateContextFromNativeWindow(void* window) = 0;
613
614 /**
615 Creates a native graphics font from a wxFont and a text colour.
616 */
617 virtual wxGraphicsFont CreateFont(const wxFont& font,
618 const wxColour& col = *wxBLACK) = 0;
619
620 /**
621 Creates a native brush, having a linear gradient, starting at
622 (@a x1, @a y1) with color @a c1 to (@a x2, @a y2) with color @a c2.
623 */
624 virtual wxGraphicsBrush CreateLinearGradientBrush(wxDouble x1,
625 wxDouble y1,
626 wxDouble x2,
627 wxDouble y2,
628 const wxColour& c1,
629 const wxColour& c2) = 0;
630
631 /**
632 Creates a native affine transformation matrix from the passed in
633 values. The defaults result in an identity matrix.
634 */
635 virtual wxGraphicsMatrix CreateMatrix(wxDouble a = 1.0, wxDouble b = 0.0,
636 wxDouble c = 0.0, wxDouble d = 1.0,
637 wxDouble tx = 0.0,
638 wxDouble ty = 0.0) = 0;
639
640 /**
641 Creates a native graphics path which is initially empty.
642 */
643 virtual wxGraphicsPath CreatePath() = 0;
644
645 /**
646 Creates a native pen from a wxPen.
647 */
648 virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0;
649
650 /**
651 Creates a native brush, having a radial gradient originating at
652 (@a xo, @a yc) with color @a oColour and ends on a circle around
653 (@a xc, @a yc) with the given @a radius and color @a cColour.
654 */
655 virtual wxGraphicsBrush CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
656 wxDouble xc, wxDouble yc,
657 wxDouble radius,
658 const wxColour& oColour,
659 const wxColour& cColour) = 0;
660
661 /**
662 Returns the default renderer on this platform. On OS X this is the Core
663 Graphics (a.k.a. Quartz 2D) renderer, on MSW the GDIPlus renderer, and
664 on GTK we currently default to the cairo renderer.
665 */
666 static wxGraphicsRenderer* GetDefaultRenderer();
667 };
668
669
670
671 /**
672 @class wxGraphicsBrush
673
674 A wxGraphicsBrush is a native representation of a brush. The contents are
675 specific and private to the respective renderer. Instances are ref counted
676 and can therefore be assigned as usual. The only way to get a valid
677 instance is via wxGraphicsContext::CreateBrush() or
678 wxGraphicsRenderer::CreateBrush().
679
680 @library{wxcore}
681 @category{gdi}
682 */
683 class wxGraphicsBrush : public wxGraphicsObject
684 {
685 public:
686
687 };
688
689
690
691 /**
692 @class wxGraphicsFont
693
694 A wxGraphicsFont is a native representation of a font. The contents are
695 specific and private to the respective renderer. Instances are ref counted
696 and can therefore be assigned as usual. The only way to get a valid
697 instance is via wxGraphicsContext::CreateFont() or
698 wxGraphicsRenderer::CreateFont().
699
700 @library{wxcore}
701 @category{gdi}
702 */
703 class wxGraphicsFont : public wxGraphicsObject
704 {
705 public:
706
707 };
708
709
710
711 /**
712 @class wxGraphicsPen
713
714 A wxGraphicsPen is a native representation of a pen. The contents are
715 specific and private to the respective renderer. Instances are ref counted
716 and can therefore be assigned as usual. The only way to get a valid
717 instance is via wxGraphicsContext::CreatePen() or
718 wxGraphicsRenderer::CreatePen().
719
720 @library{wxcore}
721 @category{gdi}
722 */
723 class wxGraphicsPen : public wxGraphicsObject
724 {
725 public:
726
727 };
728
729
730
731 /**
732 @class wxGraphicsMatrix
733
734 A wxGraphicsMatrix is a native representation of an affine matrix. The
735 contents are specific and private to the respective renderer. Instances are
736 ref counted and can therefore be assigned as usual. The only way to get a
737 valid instance is via wxGraphicsContext::CreateMatrix() or
738 wxGraphicsRenderer::CreateMatrix().
739
740 @library{wxcore}
741 @category{gdi}
742 */
743 class wxGraphicsMatrix : public wxGraphicsObject
744 {
745 public:
746 /**
747 Concatenates the matrix passed with the current matrix.
748 */
749 virtual void Concat(const wxGraphicsMatrix* t);
750 /**
751 Concatenates the matrix passed with the current matrix.
752 */
753 void Concat(const wxGraphicsMatrix& t);
754
755 /**
756 Returns the component values of the matrix via the argument pointers.
757 */
758 virtual void Get(wxDouble* a = NULL, wxDouble* b = NULL,
759 wxDouble* c = NULL, wxDouble* d = NULL,
760 wxDouble* tx = NULL, wxDouble* ty = NULL) const;
761
762 /**
763 Returns the native representation of the matrix. For CoreGraphics this
764 is a CFAffineMatrix pointer, for GDIPlus a Matrix Pointer, and for
765 Cairo a cairo_matrix_t pointer.
766 */
767 virtual void* GetNativeMatrix() const;
768
769 /**
770 Inverts the matrix.
771 */
772 virtual void Invert();
773
774 /**
775 Returns @true if the elements of the transformation matrix are equal.
776 */
777 virtual bool IsEqual(const wxGraphicsMatrix* t) const;
778 /**
779 Returns @true if the elements of the transformation matrix are equal.
780 */
781 bool IsEqual(const wxGraphicsMatrix& t) const;
782
783 /**
784 Return @true if this is the identity matrix.
785 */
786 virtual bool IsIdentity() const;
787
788 /**
789 Rotates this matrix (in radians).
790 */
791 virtual void Rotate(wxDouble angle);
792
793 /**
794 Scales this matrix.
795 */
796 virtual void Scale(wxDouble xScale, wxDouble yScale);
797
798 /**
799 Sets the matrix to the respective values (default values are the
800 identity matrix).
801 */
802 virtual void Set(wxDouble a = 1.0, wxDouble b = 0.0, wxDouble c = 0.0,
803 wxDouble d = 1.0, wxDouble tx = 0.0, wxDouble ty = 0.0);
804
805 /**
806 Applies this matrix to a distance (ie. performs all transforms except
807 translations).
808 */
809 virtual void TransformDistance(wxDouble* dx, wxDouble* dy) const;
810
811 /**
812 Applies this matrix to a point.
813 */
814 virtual void TransformPoint(wxDouble* x, wxDouble* y) const;
815
816 /**
817 Translates this matrix.
818 */
819 virtual void Translate(wxDouble dx, wxDouble dy);
820 };
821