]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/graphics.h
Document that wxDC::FloodFill() is not implemented under wxOSX.
[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;
8b180bde
RD
299
300 /**
301 Return the pointer to the native bitmap data. (CGImageRef for Core Graphics,
302 cairo_surface_t for Cairo, Bitmap* for GDI+.)
303
304 @since 2.9.4
305 */
306 void* GetNativeBitmap() const;
3c9e0b81 307};
e54c96f1 308
23324ae1
FM
309/**
310 @class wxGraphicsContext
7c913512 311
9cc4ab85
BP
312 A wxGraphicsContext instance is the object that is drawn upon. It is
313 created by a renderer using wxGraphicsRenderer::CreateContext(). This can
314 be either directly using a renderer instance, or indirectly using the
315 static convenience Create() functions of wxGraphicsContext that always
316 delegate the task to the default renderer.
7c913512 317
d974a494
RR
318 @code
319 void MyCanvas::OnPaint(wxPaintEvent &event)
320 {
321 // Create paint DC
322 wxPaintDC dc(this);
23d291c2 323
d974a494 324 // Create graphics context from it
ea077571 325 wxGraphicsContext *gc = wxGraphicsContext::Create( dc );
23d291c2 326
7e38ae60
RR
327 if (gc)
328 {
0b822969 329 // make a path that contains a circle and some lines
7e38ae60
RR
330 gc->SetPen( *wxRED_PEN );
331 wxGraphicsPath path = gc->CreatePath();
332 path.AddCircle( 50.0, 50.0, 50.0 );
333 path.MoveToPoint(0.0, 50.0);
334 path.AddLineToPoint(100.0, 50.0);
335 path.MoveToPoint(50.0, 0.0);
336 path.AddLineToPoint(50.0, 100.0 );
337 path.CloseSubpath();
338 path.AddRectangle(25.0, 25.0, 50.0, 50.0);
23d291c2 339
ea077571 340 gc->StrokePath(path);
23d291c2 341
ea077571 342 delete gc;
7e38ae60
RR
343 }
344 }
d974a494
RR
345 @endcode
346
23324ae1 347 @library{wxcore}
23d291c2 348 @category{gdi,dc}
7c913512 349
6d99a337 350 @see wxGraphicsRenderer::CreateContext(), wxGCDC, wxDC
23324ae1
FM
351*/
352class wxGraphicsContext : public wxGraphicsObject
353{
354public:
23324ae1 355 /**
0b822969
RR
356 Creates a wxGraphicsContext from a wxWindow.
357
358 @see wxGraphicsRenderer::CreateContext()
359 */
9cc4ab85 360 static wxGraphicsContext* Create(wxWindow* window);
23d291c2 361
0b822969
RR
362 /**
363 Creates a wxGraphicsContext from a wxWindowDC
364
365 @see wxGraphicsRenderer::CreateContext()
366 */
e33cc297 367 static wxGraphicsContext* Create(const wxWindowDC& windowDC);
23d291c2 368
0b822969
RR
369 /**
370 Creates a wxGraphicsContext from a wxMemoryDC
371
372 @see wxGraphicsRenderer::CreateContext()
373 */
e33cc297 374 static wxGraphicsContext* Create(const wxMemoryDC& memoryDC);
23d291c2 375
0b822969 376 /**
9cc4ab85
BP
377 Creates a wxGraphicsContext from a wxPrinterDC. Under GTK+, this will
378 only work when using the GtkPrint printing backend which is available
379 since GTK+ 2.10.
0b822969 380
9cc4ab85 381 @see wxGraphicsRenderer::CreateContext(), @ref overview_unixprinting
0b822969 382 */
e33cc297 383 static wxGraphicsContext* Create(const wxPrinterDC& printerDC);
0b822969 384
1bf9327b
VZ
385 /**
386 Creates a wxGraphicsContext from a wxEnhMetaFileDC.
387
388 This function, as wxEnhMetaFileDC class itself, is only available only
389 under MSW.
390
391 @see wxGraphicsRenderer::CreateContext()
392 */
e33cc297 393 static wxGraphicsContext* Create(const wxEnhMetaFileDC& metaFileDC);
1bf9327b 394
0a470e5e
VZ
395 /**
396 Creates a wxGraphicsContext associated with a wxImage.
397
398 The image specifies the size of the context as well as whether alpha is
399 supported (if wxImage::HasAlpha()) or not and the initial contents of
400 the context. The @a image object must have a life time greater than
401 that of the new context as the context copies its contents back to the
402 image when it is destroyed.
403
404 @since 2.9.3
405 */
406 static wxGraphicsContext* Create(wxImage& image);
407
fb8d7eb7
RD
408 /**
409 Create a lightweight context that can be used only for measuring text.
410 */
411 static wxGraphicsContext* Create();
412
0b822969 413 /**
9cc4ab85 414 Clips drawings to the specified region.
23324ae1 415 */
da1ed74c 416 virtual void Clip(const wxRegion& region) = 0;
0b822969
RR
417
418 /**
9cc4ab85 419 Clips drawings to the specified rectangle.
0b822969 420 */
da1ed74c 421 virtual void Clip(wxDouble x, wxDouble y, wxDouble w, wxDouble h) = 0;
23324ae1
FM
422
423 /**
9cc4ab85
BP
424 Concatenates the passed in transform with the current transform of this
425 context.
23324ae1 426 */
da1ed74c 427 virtual void ConcatTransform(const wxGraphicsMatrix& matrix) = 0;
23324ae1 428
3c9e0b81
VZ
429 /**
430 Creates wxGraphicsBitmap from an existing wxBitmap.
431
432 Returns an invalid wxNullGraphicsBitmap on failure.
433 */
434 virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0;
435
0a470e5e
VZ
436 /**
437 Creates wxGraphicsBitmap from an existing wxImage.
438
439 This method is more efficient than converting wxImage to wxBitmap first
440 and then calling CreateBitmap() but otherwise has the same effect.
441
442 Returns an invalid wxNullGraphicsBitmap on failure.
443
444 @since 2.9.3
445 */
446 virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image);
447
3c9e0b81
VZ
448 /**
449 Extracts a sub-bitmap from an existing bitmap.
450
451 Currently this function is implemented in the native MSW and OS X
452 versions but not when using Cairo.
453 */
454 virtual wxGraphicsBitmap CreateSubBitmap(const wxGraphicsBitmap& bitmap,
455 wxDouble x, wxDouble y,
456 wxDouble w, wxDouble h) = 0;
457
23324ae1
FM
458 /**
459 Creates a native brush from a wxBrush.
460 */
da1ed74c 461 virtual wxGraphicsBrush CreateBrush(const wxBrush& brush) const;
23324ae1
FM
462
463 /**
464 Creates a native graphics font from a wxFont and a text colour.
465 */
5267aefd
FM
466 virtual wxGraphicsFont CreateFont(const wxFont& font,
467 const wxColour& col = *wxBLACK) const;
23324ae1 468
fa378d36
VZ
469 /**
470 Creates a font object with the specified attributes.
471
472 The use of overload taking wxFont is preferred, see
473 wxGraphicsRenderer::CreateFont() for more details.
474
475 @since 2.9.3
476 */
477 virtual wxGraphicsFont CreateFont(double sizeInPixels,
478 const wxString& facename,
479 int flags = wxFONTFLAG_DEFAULT,
480 const wxColour& col = *wxBLACK) const;
481
23324ae1 482 /**
9cc4ab85
BP
483 Creates a wxGraphicsContext from a native context. This native context
484 must be a CGContextRef for Core Graphics, a Graphics pointer for
485 GDIPlus, or a cairo_t pointer for cairo.
3c4f71cc 486
9cc4ab85 487 @see wxGraphicsRenderer::CreateContextFromNativeContext()
23324ae1 488 */
da1ed74c 489 static wxGraphicsContext* CreateFromNative(void* context);
23324ae1
FM
490
491 /**
19e496b6
RR
492 Creates a wxGraphicsContext from a native window.
493
9cc4ab85 494 @see wxGraphicsRenderer::CreateContextFromNativeWindow()
23324ae1 495 */
da1ed74c 496 static wxGraphicsContext* CreateFromNativeWindow(void* window);
23324ae1
FM
497
498 /**
4ee4c7b9
VZ
499 Creates a native brush with a linear gradient.
500
501 The brush starts at (@a x1, @a y1) and ends at (@a x2, @a y2). Either
502 just the start and end gradient colours (@a c1 and @a c2) or full set
503 of gradient @a stops can be specified.
504
505 The version taking wxGraphicsGradientStops is new in wxWidgets 2.9.1.
23324ae1 506 */
4ee4c7b9
VZ
507 //@{
508 wxGraphicsBrush
509 CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
510 wxDouble x2, wxDouble y2,
511 const wxColour& c1, const wxColour& c2) const;
512
513 wxGraphicsBrush
514 CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
515 wxDouble x2, wxDouble y2,
516 const wxGraphicsGradientStops& stops) const;
517 //@}
23324ae1
FM
518
519 /**
9cc4ab85
BP
520 Creates a native affine transformation matrix from the passed in
521 values. The default parameters result in an identity matrix.
23324ae1 522 */
5267aefd
FM
523 virtual wxGraphicsMatrix CreateMatrix(wxDouble a = 1.0, wxDouble b = 0.0,
524 wxDouble c = 0.0, wxDouble d = 1.0,
a44f3b5a
FM
525 wxDouble tx = 0.0,
526 wxDouble ty = 0.0) const;
23324ae1 527
771563ba
VZ
528 /**
529 Creates a native affine transformation matrix from the passed
530 generic one.
531
532 @since 2.9.4
533 */
534 wxGraphicsMatrix CreateMatrix(const wxAffineMatrix2DBase& mat) const;
535
23324ae1
FM
536 /**
537 Creates a native graphics path which is initially empty.
538 */
328f5751 539 wxGraphicsPath CreatePath() const;
23324ae1
FM
540
541 /**
542 Creates a native pen from a wxPen.
543 */
da1ed74c 544 virtual wxGraphicsPen CreatePen(const wxPen& pen) const;
23324ae1
FM
545
546 /**
4ee4c7b9
VZ
547 Creates a native brush with a radial gradient.
548
d13b34d3 549 The brush originates at (@a xo, @a yc) and ends on a circle around
4ee4c7b9
VZ
550 (@a xc, @a yc) with the given @a radius.
551
552 The gradient may be specified either by its start and end colours @a
553 oColor and @a cColor or by a full set of gradient @a stops.
554
555 The version taking wxGraphicsGradientStops is new in wxWidgets 2.9.1.
23324ae1 556 */
4ee4c7b9
VZ
557 //@{
558 virtual wxGraphicsBrush
559 CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
560 wxDouble xc, wxDouble yc,
561 wxDouble radius,
562 const wxColour& oColor,
563 const wxColour& cColor) const;
564
565 virtual wxGraphicsBrush
566 CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
567 wxDouble xc, wxDouble yc,
568 wxDouble radius,
569 const wxGraphicsGradientStops& stops) = 0;
570 //@}
23324ae1
FM
571
572 /**
9cc4ab85
BP
573 Draws the bitmap. In case of a mono bitmap, this is treated as a mask
574 and the current brushed is used for filling.
23324ae1 575 */
3c9e0b81
VZ
576 //@{
577 virtual void DrawBitmap(const wxGraphicsBitmap& bmp,
578 wxDouble x, wxDouble y,
579 wxDouble w, wxDouble h ) = 0;
580 virtual void DrawBitmap(const wxBitmap& bmp,
581 wxDouble x, wxDouble y,
fadc2df6 582 wxDouble w, wxDouble h) = 0;
3c9e0b81 583 //@}
23324ae1
FM
584
585 /**
586 Draws an ellipse.
587 */
da1ed74c 588 virtual void DrawEllipse(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
23324ae1
FM
589
590 /**
591 Draws the icon.
592 */
fadc2df6
FM
593 virtual void DrawIcon(const wxIcon& icon, wxDouble x, wxDouble y,
594 wxDouble w, wxDouble h) = 0;
23324ae1
FM
595
596 /**
597 Draws a polygon.
598 */
fadc2df6 599 virtual void DrawLines(size_t n, const wxPoint2DDouble* points,
382f12e4 600 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
23324ae1
FM
601
602 /**
603 Draws the path by first filling and then stroking.
604 */
fadc2df6 605 virtual void DrawPath(const wxGraphicsPath& path,
382f12e4 606 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
23324ae1
FM
607
608 /**
609 Draws a rectangle.
610 */
fadc2df6 611 virtual void DrawRectangle(wxDouble x, wxDouble y, wxDouble w, wxDouble h);
23324ae1
FM
612
613 /**
614 Draws a rounded rectangle.
615 */
da1ed74c
FM
616 virtual void DrawRoundedRectangle(wxDouble x, wxDouble y, wxDouble w,
617 wxDouble h, wxDouble radius);
23324ae1 618
23324ae1 619 /**
9cc4ab85 620 Draws text at the defined position.
23324ae1 621 */
7c913512 622 void DrawText(const wxString& str, wxDouble x, wxDouble y);
9cc4ab85
BP
623 /**
624 Draws text at the defined position.
625
cbd251ac
BP
626 @param str
627 The text to draw.
628 @param x
629 The x coordinate position to draw the text at.
630 @param y
631 The y coordinate position to draw the text at.
9cc4ab85
BP
632 @param angle
633 The angle relative to the (default) horizontal direction to draw
634 the string.
635 */
636 void DrawText(const wxString& str, wxDouble x, wxDouble y, wxDouble angle);
637 /**
638 Draws text at the defined position.
639
cbd251ac
BP
640 @param str
641 The text to draw.
642 @param x
643 The x coordinate position to draw the text at.
644 @param y
645 The y coordinate position to draw the text at.
9cc4ab85
BP
646 @param backgroundBrush
647 Brush to fill the text with.
648 */
5a395566 649 void DrawText(const wxString& str, wxDouble x, wxDouble y,
9cc4ab85
BP
650 const wxGraphicsBrush& backgroundBrush);
651 /**
652 Draws text at the defined position.
653
cbd251ac
BP
654 @param str
655 The text to draw.
656 @param x
657 The x coordinate position to draw the text at.
658 @param y
659 The y coordinate position to draw the text at.
9cc4ab85
BP
660 @param angle
661 The angle relative to the (default) horizontal direction to draw
662 the string.
663 @param backgroundBrush
664 Brush to fill the text with.
665 */
5a395566 666 void DrawText(const wxString& str, wxDouble x, wxDouble y,
9cc4ab85 667 wxDouble angle, const wxGraphicsBrush& backgroundBrush);
23324ae1
FM
668
669 /**
670 Fills the path with the current brush.
671 */
fadc2df6 672 virtual void FillPath(const wxGraphicsPath& path,
382f12e4 673 wxPolygonFillMode fillStyle = wxODDEVEN_RULE) = 0;
23324ae1
FM
674
675 /**
9cc4ab85
BP
676 Returns the native context (CGContextRef for Core Graphics, Graphics
677 pointer for GDIPlus and cairo_t pointer for cairo).
23324ae1 678 */
da1ed74c 679 virtual void* GetNativeContext() = 0;
23324ae1
FM
680
681 /**
4cc4bfaf 682 Fills the @a widths array with the widths from the beginning of
9cc4ab85 683 @a text to the corresponding character of @a text.
23324ae1 684 */
fadc2df6
FM
685 virtual void GetPartialTextExtents(const wxString& text,
686 wxArrayDouble& widths) const = 0;
23324ae1
FM
687
688 /**
689 Gets the dimensions of the string using the currently selected font.
9cc4ab85
BP
690
691 @param text
692 The text string to measure.
693 @param width
694 Variable to store the total calculated width of the text.
695 @param height
696 Variable to store the total calculated height of the text.
697 @param descent
698 Variable to store the dimension from the baseline of the font to
699 the bottom of the descender.
700 @param externalLeading
701 Any extra vertical space added to the font by the font designer
702 (usually is zero).
23324ae1 703 */
da1ed74c
FM
704 virtual void GetTextExtent(const wxString& text, wxDouble* width,
705 wxDouble* height, wxDouble* descent,
706 wxDouble* externalLeading) const = 0;
23324ae1
FM
707
708 /**
709 Gets the current transformation matrix of this context.
710 */
da1ed74c 711 virtual wxGraphicsMatrix GetTransform() const = 0;
23324ae1
FM
712
713 /**
714 Resets the clipping to original shape.
715 */
da1ed74c 716 virtual void ResetClip() = 0;
23324ae1
FM
717
718 /**
9cc4ab85 719 Rotates the current transformation matrix (in radians).
23324ae1 720 */
da1ed74c 721 virtual void Rotate(wxDouble angle) = 0;
23324ae1
FM
722
723 /**
724 Scales the current transformation matrix.
725 */
da1ed74c 726 virtual void Scale(wxDouble xScale, wxDouble yScale) = 0;
23324ae1 727
23324ae1
FM
728 /**
729 Sets the brush for filling paths.
730 */
731 void SetBrush(const wxBrush& brush);
9cc4ab85
BP
732 /**
733 Sets the brush for filling paths.
734 */
ccf39540 735 virtual void SetBrush(const wxGraphicsBrush& brush);
23324ae1 736
23324ae1
FM
737 /**
738 Sets the font for drawing text.
739 */
740 void SetFont(const wxFont& font, const wxColour& colour);
9cc4ab85
BP
741 /**
742 Sets the font for drawing text.
743 */
ccf39540 744 virtual void SetFont(const wxGraphicsFont& font);
23324ae1 745
23324ae1
FM
746 /**
747 Sets the pen used for stroking.
748 */
ccf39540 749 void SetPen(const wxPen& pen);
9cc4ab85
BP
750 /**
751 Sets the pen used for stroking.
752 */
ccf39540 753 virtual void SetPen(const wxGraphicsPen& pen);
23324ae1
FM
754
755 /**
756 Sets the current transformation matrix of this context
757 */
da1ed74c 758 virtual void SetTransform(const wxGraphicsMatrix& matrix) = 0;
23324ae1
FM
759
760 /**
761 Strokes a single line.
762 */
fadc2df6 763 virtual void StrokeLine(wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2);
23324ae1 764
23324ae1 765 /**
9cc4ab85
BP
766 Stroke disconnected lines from begin to end points, fastest method
767 available for this purpose.
23324ae1 768 */
ccf39540
FM
769 virtual void StrokeLines(size_t n, const wxPoint2DDouble* beginPoints,
770 const wxPoint2DDouble* endPoints);
9cc4ab85 771 /**
25941fc5
VZ
772 Stroke lines connecting all the points.
773
774 Unlike the other overload of this function, this method draws a single
775 polyline and not a number of disconnected lines.
9cc4ab85 776 */
ccf39540 777 virtual void StrokeLines(size_t n, const wxPoint2DDouble* points);
23324ae1
FM
778
779 /**
780 Strokes along a path with the current pen.
781 */
da1ed74c 782 virtual void StrokePath(const wxGraphicsPath& path) = 0;
23324ae1
FM
783
784 /**
785 Translates the current transformation matrix.
786 */
da1ed74c 787 virtual void Translate(wxDouble dx, wxDouble dy) = 0;
7395c7d6
SC
788
789 /**
4ee4c7b9 790 Redirects all rendering is done into a fully transparent temporary context
7395c7d6
SC
791 */
792 virtual void BeginLayer(wxDouble opacity) = 0;
793
4ee4c7b9
VZ
794 /**
795 Composites back the drawings into the context with the opacity given at
7395c7d6
SC
796 the BeginLayer call
797 */
798 virtual void EndLayer() = 0;
799
4ee4c7b9 800 /**
7395c7d6
SC
801 Sets the antialiasing mode, returns true if it supported
802 */
803 virtual bool SetAntialiasMode(wxAntialiasMode antialias) = 0;
804
4ee4c7b9 805 /**
7395c7d6
SC
806 Returns the current shape antialiasing mode
807 */
808 virtual wxAntialiasMode GetAntialiasMode() const ;
4ee4c7b9 809
a173c813 810 /**
c3562311
VZ
811 Sets the interpolation quality, returns true if it is supported.
812
813 Not implemented in Cairo backend currently.
a173c813
SC
814 */
815 virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation) = 0;
c3562311 816
a173c813 817 /**
c3562311 818 Returns the current interpolation quality.
a173c813
SC
819 */
820 virtual wxInterpolationQuality GetInterpolationQuality() const;
c3562311 821
7395c7d6
SC
822 /**
823 Sets the compositing operator, returns true if it supported
824 */
825 virtual bool SetCompositionMode(wxCompositionMode op) = 0;
826
4ee4c7b9 827 /**
7395c7d6
SC
828 Returns the current compositing operator
829 */
830 virtual wxCompositionMode GetCompositionMode() const;
4ee4c7b9 831
e33cc297 832
6fc53251
RD
833 /**
834 Push the current state of the context's transformation matrix on a
835 stack.
836
837 @see wxGraphicsContext::PopState
838 */
839 virtual void PushState() = 0;
840
841 /**
842 Pops a stored state from the stack and sets the current transformation
843 matrix to that state.
844
845 @see wxGraphicsContext::PopState
846 */
847 virtual void PopState() = 0;
848
849
cc33ae72 850 virtual bool ShouldOffset() const;
e33cc297
RD
851 virtual void EnableOffset(bool enable = true);
852 void DisableOffset();
853 bool OffsetEnabled();
854
cc33ae72
RD
855 /**
856 Begin a new document (relevant only for printing / pdf etc.)
857 If there is a progress dialog, message will be shown.
858 */
859 virtual bool StartDoc( const wxString& message );
860
861 /**
862 Done with that document (relevant only for printing / pdf etc.)
863 */
864 virtual void EndDoc();
865
866 /**
867 Opens a new page (relevant only for printing / pdf etc.) with the given
868 size in points. (If both are null the default page size will be used.)
869 */
870 virtual void StartPage( wxDouble width = 0, wxDouble height = 0 );
871
872 /**
873 Ends the current page (relevant only for printing / pdf etc.)
874 */
875 virtual void EndPage();
876
877 /**
878 Make sure that the current content of this context is immediately visible.
879 */
880 virtual void Flush();
881
882 /**
883 Returns the size of the graphics context in device coordinates.
884 */
885 void GetSize(wxDouble* width, wxDouble* height) const;
886
887 /**
888 Returns the resolution of the graphics context in device points per inch.
889 */
890 virtual void GetDPI( wxDouble* dpiX, wxDouble* dpiY);
891
4ee4c7b9
VZ
892};
893
894/**
895 Represents a single gradient stop in a collection of gradient stops as
896 represented by wxGraphicsGradientStops.
897
898 @library{wxcore}
899 @category{gdi}
900
901 @since 2.9.1
902*/
903class wxGraphicsGradientStop
904{
905public:
906 /**
907 Creates a stop with the given colour and position.
908
909 @param col The colour of this stop. Note that the alpha component of
910 the colour is honoured thus allowing the background colours to
911 partially show through the gradient.
2028c33a
VZ
912 @param pos The stop position, must be in [0, 1] range with 0 being the
913 beginning and 1 the end of the gradient.
4ee4c7b9 914 */
2028c33a 915 wxGraphicsGradientStop(wxColour col = wxTransparentColour, float pos = 0.);
4ee4c7b9
VZ
916
917 /// Return the stop colour.
918 const wxColour& GetColour() const;
919
920 /**
921 Change the stop colour.
922
923 @param col The new colour.
924 */
925 void SetColour(const wxColour& col);
926
927 /// Return the stop position.
928 float GetPosition() const;
929
930 /**
931 Change the stop position.
932
2028c33a 933 @param pos The new position, must always be in [0, 1] range.
4ee4c7b9
VZ
934 */
935 void SetPosition(float pos);
23324ae1
FM
936};
937
4ee4c7b9
VZ
938/**
939 Represents a collection of wxGraphicGradientStop values for use with
940 CreateLinearGradientBrush and CreateRadialGradientBrush.
941
942 The stops are maintained in order of position. If two or more stops are
943 added with the same position then the one(s) added later come later.
944 This can be useful for producing discontinuities in the colour gradient.
945
946 Notice that this class is write-once, you can't modify the stops once they
947 had been added.
948
949 @library{wxcore}
950 @category{gdi}
951
952 @since 2.9.1
953*/
954class wxGraphicsGradientStops
955{
956public:
957 /**
958 Initializes the gradient stops with the given boundary colours.
959
960 Creates a wxGraphicsGradientStops instance with start colour given
961 by @a startCol and end colour given by @a endCol.
962 */
963 wxGraphicsGradientStops(wxColour startCol = wxTransparentColour,
964 wxColour endCol = wxTransparentColour);
23324ae1 965
4ee4c7b9
VZ
966 /**
967 Add a new stop.
968 */
969 //@{
970 void Add(const wxGraphicsGradientStop& stop);
971 void Add(wxColour col, float pos);
972 //@}
973
974 /**
975 Returns the stop at the given index.
976
977 @param n The index, must be in [0, GetCount()) range.
978 */
979 wxGraphicsGradientStop Item(unsigned n) const;
980
981 /**
982 Returns the number of stops.
983 */
984 unsigned GetCount() const;
985
986 /**
987 Set the start colour to @a col
988 */
989 void SetStartColour(wxColour col);
990
991 /**
992 Returns the start colour.
993 */
994 wxColour GetStartColour() const;
995
996 /**
997 Set the end colour to @a col
998 */
999 void SetEndColour(wxColour col);
1000
1001 /**
1002 Returns the end colour.
1003 */
1004 wxColour GetEndColour() const;
1005};
e54c96f1 1006
23324ae1
FM
1007/**
1008 @class wxGraphicsRenderer
7c913512 1009
23324ae1 1010 A wxGraphicsRenderer is the instance corresponding to the rendering engine
ea077571 1011 used. There may be multiple instances on a system, if there are different
9cc4ab85
BP
1012 rendering engines present, but there is always only one instance per
1013 engine. This instance is pointed back to by all objects created by it
1014 (wxGraphicsContext, wxGraphicsPath etc) and can be retrieved through their
1015 wxGraphicsObject::GetRenderer() method. Therefore you can create an
1016 additional instance of a path etc. by calling
1017 wxGraphicsObject::GetRenderer() and then using the appropriate CreateXXX()
1018 function of that renderer.
ea077571
RR
1019
1020 @code
1021 wxGraphicsPath *path = // from somewhere
1022 wxGraphicsBrush *brush = path->GetRenderer()->CreateBrush( *wxBLACK_BRUSH );
1023 @endcode
7c913512 1024
23324ae1 1025 @library{wxcore}
9cc4ab85 1026 @category{gdi}
23324ae1
FM
1027*/
1028class wxGraphicsRenderer : public wxObject
1029{
1030public:
3c9e0b81
VZ
1031 /**
1032 Creates wxGraphicsBitmap from an existing wxBitmap.
1033
1034 Returns an invalid wxNullGraphicsBitmap on failure.
1035 */
1036 virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ) = 0;
1037
0a470e5e
VZ
1038 /**
1039 Creates wxGraphicsBitmap from an existing wxImage.
1040
1041 This method is more efficient than converting wxImage to wxBitmap first
1042 and then calling CreateBitmap() but otherwise has the same effect.
1043
1044 Returns an invalid wxNullGraphicsBitmap on failure.
1045
1046 @since 2.9.3
1047 */
1048 virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) = 0;
1049
6e6f074b
RD
1050 /**
1051 Creates a wxImage from a wxGraphicsBitmap.
1052
1053 This method is used by the more convenient wxGraphicsBitmap::ConvertToImage.
1054 */
1055 virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp) = 0;
1056
3c9e0b81
VZ
1057 /**
1058 Creates wxGraphicsBitmap from a native bitmap handle.
1059
1060 @a bitmap meaning is platform-dependent. Currently it's a GDI+ @c
1061 Bitmap pointer under MSW, @c CGImage pointer under OS X or a @c
1062 cairo_surface_t pointer when using Cairo under any platform.
1063 */
1064 virtual wxGraphicsBitmap CreateBitmapFromNativeBitmap( void* bitmap ) = 0;
1065
23324ae1 1066 /**
ea077571 1067 Creates a wxGraphicsContext from a wxWindow.
23324ae1 1068 */
ea077571 1069 virtual wxGraphicsContext* CreateContext(wxWindow* window) = 0;
23d291c2 1070
ea077571
RR
1071 /**
1072 Creates a wxGraphicsContext from a wxWindowDC
1073 */
e33cc297 1074 virtual wxGraphicsContext* CreateContext(const wxWindowDC& windowDC) = 0 ;
23d291c2 1075
ea077571
RR
1076 /**
1077 Creates a wxGraphicsContext from a wxMemoryDC
1078 */
e33cc297 1079 virtual wxGraphicsContext* CreateContext(const wxMemoryDC& memoryDC) = 0 ;
23d291c2 1080
ea077571
RR
1081 /**
1082 Creates a wxGraphicsContext from a wxPrinterDC
1083 */
e33cc297 1084 virtual wxGraphicsContext* CreateContext(const wxPrinterDC& printerDC) = 0 ;
23324ae1 1085
1bf9327b
VZ
1086 /**
1087 Creates a wxGraphicsContext from a wxEnhMetaFileDC.
1088
1089 This function, as wxEnhMetaFileDC class itself, is only available only
1090 under MSW.
1091 */
e33cc297 1092 virtual wxGraphicsContext* CreateContext(const wxEnhMetaFileDC& metaFileDC) = 0;
1bf9327b 1093
0a470e5e
VZ
1094 /**
1095 Creates a wxGraphicsContext associated with a wxImage.
1096
1097 This function is used by wxContext::CreateFromImage() and is not
1098 normally called directly.
1099
1100 @since 2.9.3
1101 */
7422d797 1102 wxGraphicsContext* CreateContextFromImage(wxImage& image);
0a470e5e 1103
23324ae1 1104 /**
ea077571 1105 Creates a native brush from a wxBrush.
23324ae1 1106 */
da1ed74c 1107 virtual wxGraphicsBrush CreateBrush(const wxBrush& brush) = 0;
ea077571 1108
23324ae1 1109 /**
9cc4ab85
BP
1110 Creates a wxGraphicsContext from a native context. This native context
1111 must be a CGContextRef for Core Graphics, a Graphics pointer for
1112 GDIPlus, or a cairo_t pointer for cairo.
23324ae1 1113 */
da1ed74c 1114 virtual wxGraphicsContext* CreateContextFromNativeContext(void* context) = 0;
23324ae1
FM
1115
1116 /**
1117 Creates a wxGraphicsContext from a native window.
1118 */
da1ed74c 1119 virtual wxGraphicsContext* CreateContextFromNativeWindow(void* window) = 0;
23324ae1 1120
27a3b24b 1121 /**
4ee4c7b9 1122 Creates a wxGraphicsContext that can be used for measuring texts only.
27a3b24b
KO
1123 No drawing commands are allowed.
1124 */
1125 virtual wxGraphicsContext * CreateMeasuringContext() = 0;
1126
23324ae1
FM
1127 /**
1128 Creates a native graphics font from a wxFont and a text colour.
1129 */
5267aefd
FM
1130 virtual wxGraphicsFont CreateFont(const wxFont& font,
1131 const wxColour& col = *wxBLACK) = 0;
23324ae1 1132
fa378d36
VZ
1133 /**
1134 Creates a graphics font with the given characteristics.
1135
1136 If possible, the CreateFont() overload taking wxFont should be used
1137 instead. The main advantage of this overload is that it can be used
1138 without X server connection under Unix when using Cairo.
1139
1140 @param sizeInPixels
1141 Height of the font in user space units, i.e. normally pixels.
1142 Notice that this is different from the overload taking wxFont as
1143 wxFont size is specified in points.
1144 @param facename
1145 The name of the font. The same font name might not be available
1146 under all platforms so the font name can also be empty to use the
1147 default platform font.
1148 @param flags
1149 Combination of wxFontFlag enum elements. Currently only
1150 @c wxFONTFLAG_ITALIC and @c wxFONTFLAG_BOLD are supported. By
1151 default the normal font version is used.
1152 @param col
1153 The font colour, black by default.
1154
1155 @since 2.9.3
1156 */
1157 virtual wxGraphicsFont CreateFont(double sizeInPixels,
1158 const wxString& facename,
1159 int flags = wxFONTFLAG_DEFAULT,
1160 const wxColour& col = *wxBLACK) = 0;
1161
4ee4c7b9 1162
23324ae1 1163 /**
4ee4c7b9
VZ
1164 Creates a native brush with a linear gradient.
1165
1166 Stops support is new since wxWidgets 2.9.1, previously only the start
1167 and end colours could be specified.
23324ae1 1168 */
9cc4ab85
BP
1169 virtual wxGraphicsBrush CreateLinearGradientBrush(wxDouble x1,
1170 wxDouble y1,
1171 wxDouble x2,
1172 wxDouble y2,
4ee4c7b9 1173 const wxGraphicsGradientStops& stops) = 0;
23324ae1
FM
1174
1175 /**
9cc4ab85
BP
1176 Creates a native affine transformation matrix from the passed in
1177 values. The defaults result in an identity matrix.
23324ae1 1178 */
5267aefd
FM
1179 virtual wxGraphicsMatrix CreateMatrix(wxDouble a = 1.0, wxDouble b = 0.0,
1180 wxDouble c = 0.0, wxDouble d = 1.0,
a44f3b5a 1181 wxDouble tx = 0.0,
5267aefd 1182 wxDouble ty = 0.0) = 0;
23324ae1
FM
1183
1184 /**
1185 Creates a native graphics path which is initially empty.
1186 */
da1ed74c 1187 virtual wxGraphicsPath CreatePath() = 0;
23324ae1
FM
1188
1189 /**
1190 Creates a native pen from a wxPen.
1191 */
da1ed74c 1192 virtual wxGraphicsPen CreatePen(const wxPen& pen) = 0;
23324ae1
FM
1193
1194 /**
4ee4c7b9
VZ
1195 Creates a native brush with a radial gradient.
1196
1197 Stops support is new since wxWidgets 2.9.1, previously only the start
1198 and end colours could be specified.
23324ae1 1199 */
da1ed74c
FM
1200 virtual wxGraphicsBrush CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
1201 wxDouble xc, wxDouble yc,
1202 wxDouble radius,
4ee4c7b9 1203 const wxGraphicsGradientStops& stops) = 0;
23324ae1 1204
3c9e0b81
VZ
1205 /**
1206 Extracts a sub-bitmap from an existing bitmap.
1207
1208 Currently this function is implemented in the native MSW and OS X
1209 versions but not when using Cairo.
1210 */
1211 virtual wxGraphicsBitmap CreateSubBitmap(const wxGraphicsBitmap& bitmap,
1212 wxDouble x, wxDouble y,
1213 wxDouble w, wxDouble h) = 0;
1214
23324ae1
FM
1215 /**
1216 Returns the default renderer on this platform. On OS X this is the Core
9cc4ab85
BP
1217 Graphics (a.k.a. Quartz 2D) renderer, on MSW the GDIPlus renderer, and
1218 on GTK we currently default to the cairo renderer.
23324ae1 1219 */
ea077571 1220 static wxGraphicsRenderer* GetDefaultRenderer();
e33cc297
RD
1221 static wxGraphicsRenderer* GetCairoRenderer();
1222
23324ae1
FM
1223};
1224
1225
e54c96f1 1226
23324ae1
FM
1227/**
1228 @class wxGraphicsBrush
7c913512 1229
9cc4ab85
BP
1230 A wxGraphicsBrush is a native representation of a brush. The contents are
1231 specific and private to the respective renderer. Instances are ref counted
1232 and can therefore be assigned as usual. The only way to get a valid
1233 instance is via wxGraphicsContext::CreateBrush() or
1234 wxGraphicsRenderer::CreateBrush().
7c913512 1235
23324ae1 1236 @library{wxcore}
9cc4ab85 1237 @category{gdi}
23324ae1
FM
1238*/
1239class wxGraphicsBrush : public wxGraphicsObject
1240{
1241public:
7c913512 1242
23324ae1
FM
1243};
1244
1245
e54c96f1 1246
23324ae1
FM
1247/**
1248 @class wxGraphicsFont
7c913512 1249
9cc4ab85
BP
1250 A wxGraphicsFont is a native representation of a font. The contents are
1251 specific and private to the respective renderer. Instances are ref counted
1252 and can therefore be assigned as usual. The only way to get a valid
1253 instance is via wxGraphicsContext::CreateFont() or
1254 wxGraphicsRenderer::CreateFont().
7c913512 1255
23324ae1 1256 @library{wxcore}
9cc4ab85 1257 @category{gdi}
23324ae1
FM
1258*/
1259class wxGraphicsFont : public wxGraphicsObject
1260{
1261public:
7c913512 1262
23324ae1
FM
1263};
1264
1265
e54c96f1 1266
23324ae1
FM
1267/**
1268 @class wxGraphicsPen
7c913512 1269
9cc4ab85
BP
1270 A wxGraphicsPen is a native representation of a pen. The contents are
1271 specific and private to the respective renderer. Instances are ref counted
1272 and can therefore be assigned as usual. The only way to get a valid
1273 instance is via wxGraphicsContext::CreatePen() or
1274 wxGraphicsRenderer::CreatePen().
7c913512 1275
23324ae1 1276 @library{wxcore}
9cc4ab85 1277 @category{gdi}
23324ae1
FM
1278*/
1279class wxGraphicsPen : public wxGraphicsObject
1280{
1281public:
7c913512 1282
23324ae1
FM
1283};
1284
1285
e54c96f1 1286
23324ae1
FM
1287/**
1288 @class wxGraphicsMatrix
7c913512 1289
9cc4ab85
BP
1290 A wxGraphicsMatrix is a native representation of an affine matrix. The
1291 contents are specific and private to the respective renderer. Instances are
1292 ref counted and can therefore be assigned as usual. The only way to get a
1293 valid instance is via wxGraphicsContext::CreateMatrix() or
1294 wxGraphicsRenderer::CreateMatrix().
7c913512 1295
23324ae1 1296 @library{wxcore}
9cc4ab85 1297 @category{gdi}
23324ae1
FM
1298*/
1299class wxGraphicsMatrix : public wxGraphicsObject
1300{
1301public:
23324ae1 1302 /**
9cc4ab85
BP
1303 Concatenates the matrix passed with the current matrix.
1304 */
1305 virtual void Concat(const wxGraphicsMatrix* t);
1306 /**
1307 Concatenates the matrix passed with the current matrix.
23324ae1 1308 */
7c913512 1309 void Concat(const wxGraphicsMatrix& t);
23324ae1
FM
1310
1311 /**
1312 Returns the component values of the matrix via the argument pointers.
1313 */
9cc4ab85
BP
1314 virtual void Get(wxDouble* a = NULL, wxDouble* b = NULL,
1315 wxDouble* c = NULL, wxDouble* d = NULL,
1316 wxDouble* tx = NULL, wxDouble* ty = NULL) const;
23324ae1
FM
1317
1318 /**
9cc4ab85
BP
1319 Returns the native representation of the matrix. For CoreGraphics this
1320 is a CFAffineMatrix pointer, for GDIPlus a Matrix Pointer, and for
1321 Cairo a cairo_matrix_t pointer.
23324ae1 1322 */
da1ed74c 1323 virtual void* GetNativeMatrix() const;
23324ae1
FM
1324
1325 /**
1326 Inverts the matrix.
1327 */
da1ed74c 1328 virtual void Invert();
23324ae1 1329
9cc4ab85
BP
1330 /**
1331 Returns @true if the elements of the transformation matrix are equal.
1332 */
1333 virtual bool IsEqual(const wxGraphicsMatrix* t) const;
23324ae1
FM
1334 /**
1335 Returns @true if the elements of the transformation matrix are equal.
1336 */
328f5751 1337 bool IsEqual(const wxGraphicsMatrix& t) const;
23324ae1
FM
1338
1339 /**
1340 Return @true if this is the identity matrix.
1341 */
da1ed74c 1342 virtual bool IsIdentity() const;
23324ae1
FM
1343
1344 /**
fd5cfba7
VZ
1345 Rotates this matrix clockwise (in radians).
1346
1347 @param radians
1348 Rotation angle in radians, clockwise.
23324ae1 1349 */
da1ed74c 1350 virtual void Rotate(wxDouble angle);
23324ae1
FM
1351
1352 /**
1353 Scales this matrix.
1354 */
da1ed74c 1355 virtual void Scale(wxDouble xScale, wxDouble yScale);
23324ae1
FM
1356
1357 /**
9cc4ab85
BP
1358 Sets the matrix to the respective values (default values are the
1359 identity matrix).
23324ae1 1360 */
5267aefd
FM
1361 virtual void Set(wxDouble a = 1.0, wxDouble b = 0.0, wxDouble c = 0.0,
1362 wxDouble d = 1.0, wxDouble tx = 0.0, wxDouble ty = 0.0);
23324ae1
FM
1363
1364 /**
1365 Applies this matrix to a distance (ie. performs all transforms except
9cc4ab85 1366 translations).
23324ae1 1367 */
da1ed74c 1368 virtual void TransformDistance(wxDouble* dx, wxDouble* dy) const;
23324ae1
FM
1369
1370 /**
1371 Applies this matrix to a point.
1372 */
da1ed74c 1373 virtual void TransformPoint(wxDouble* x, wxDouble* y) const;
23324ae1
FM
1374
1375 /**
1376 Translates this matrix.
1377 */
da1ed74c 1378 virtual void Translate(wxDouble dx, wxDouble dy);
23324ae1 1379};
9cc4ab85 1380
e33cc297
RD
1381
1382const wxGraphicsPen wxNullGraphicsPen;
1383const wxGraphicsBrush wxNullGraphicsBrush;
1384const wxGraphicsFont wxNullGraphicsFont;
1385const wxGraphicsBitmap wxNullGraphicsBitmap;
1386const wxGraphicsMatrix wxNullGraphicsMatrix;
1387const wxGraphicsPath wxNullGraphicsPath;