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