1
/////////////////////////////////////////////////////////////////////////////
3
// Purpose: Wrapper definitions for wx.GraphicsPath, wx.GraphicsContext
8
// RCS-ID: $Id: _graphics.i 69711 2011-11-08 18:04:04Z RD $
9
// Copyright: (c) 2006 by Total Control Software
10
// Licence: wxWindows license
11
/////////////////////////////////////////////////////////////////////////////
16
//---------------------------------------------------------------------------
20
#include <wx/graphics.h>
25
wxANTIALIAS_NONE, // should be 0
29
enum wxInterpolationQuality
31
// default interpolation
32
wxINTERPOLATION_DEFAULT,
35
// fast interpolation, suited for interactivity
39
// best quality, not suited for interactivity
44
enum wxCompositionMode
46
// R = Result, S = Source, D = Destination, premultiplied with alpha
47
// Ra, Sa, Da their alpha components
49
// classic Porter-Duff compositions
50
// http://keithp.com/~keithp/porterduff/p253-porter.pdf
52
wxCOMPOSITION_INVALID,
54
wxCOMPOSITION_CLEAR, /* R = 0 */
55
wxCOMPOSITION_SOURCE, /* R = S */
56
wxCOMPOSITION_OVER, /* R = S + D*(1 - Sa) */
57
wxCOMPOSITION_IN, /* R = S*Da */
58
wxCOMPOSITION_OUT, /* R = S*(1 - Da) */
59
wxCOMPOSITION_ATOP, /* R = S*Da + D*(1 - Sa) */
61
wxCOMPOSITION_DEST, /* R = D, essentially a noop */
62
wxCOMPOSITION_DEST_OVER, /* R = S*(1 - Da) + D */
63
wxCOMPOSITION_DEST_IN, /* R = D*Sa */
64
wxCOMPOSITION_DEST_OUT, /* R = D*(1 - Sa) */
65
wxCOMPOSITION_DEST_ATOP, /* R = S*(1 - Da) + D*Sa */
66
wxCOMPOSITION_XOR, /* R = S*(1 - Da) + D*(1 - Sa) */
68
// mathematical compositions
69
wxCOMPOSITION_ADD, /* R = S + D */
72
// Turn off the aquisition of the Global Interpreter Lock for the classes and
73
// functions in this file
77
//---------------------------------------------------------------------------
78
//---------------------------------------------------------------------------
81
#if !wxUSE_GRAPHICS_CONTEXT
82
// C++ stub classes for platforms or build configurations that don't have
83
// wxGraphicsContext yet.
87
wxANTIALIAS_NONE, // should be 0
91
enum wxInterpolationQuality
93
// default interpolation
94
wxINTERPOLATION_DEFAULT,
97
// fast interpolation, suited for interactivity
100
wxINTERPOLATION_GOOD,
101
// best quality, not suited for interactivity
105
enum wxCompositionMode
107
// R = Result, S = Source, D = Destination, premultiplied with alpha
108
// Ra, Sa, Da their alpha components
110
// classic Porter-Duff compositions
111
// http://keithp.com/~keithp/porterduff/p253-porter.pdf
113
wxCOMPOSITION_INVALID,
115
wxCOMPOSITION_CLEAR, /* R = 0 */
116
wxCOMPOSITION_SOURCE, /* R = S */
117
wxCOMPOSITION_OVER, /* R = S + D*(1 - Sa) */
118
wxCOMPOSITION_IN, /* R = S*Da */
119
wxCOMPOSITION_OUT, /* R = S*(1 - Da) */
120
wxCOMPOSITION_ATOP, /* R = S*Da + D*(1 - Sa) */
122
wxCOMPOSITION_DEST, /* R = D, essentially a noop */
123
wxCOMPOSITION_DEST_OVER, /* R = S*(1 - Da) + D */
124
wxCOMPOSITION_DEST_IN, /* R = D*Sa */
125
wxCOMPOSITION_DEST_OUT, /* R = D*(1 - Sa) */
126
wxCOMPOSITION_DEST_ATOP, /* R = S*(1 - Da) + D*Sa */
127
wxCOMPOSITION_XOR, /* R = S*(1 - Da) + D*(1 - Sa) */
129
// mathematical compositions
130
wxCOMPOSITION_ADD, /* R = S + D */
133
class wxGraphicsRenderer;
134
class wxGraphicsMatrix;
137
class wxGraphicsObject : public wxObject
140
wxGraphicsObject() {}
141
wxGraphicsObject( wxGraphicsRenderer* ) {
142
PyErr_SetString(PyExc_NotImplementedError,
143
"wx.GraphicsObject is not available on this platform.");
145
wxGraphicsObject( const wxGraphicsObject& ) {}
146
virtual ~wxGraphicsObject() {}
147
bool IsNull() const { return false; }
148
wxGraphicsRenderer* GetRenderer() const { return NULL; }
153
class wxGraphicsPen : public wxGraphicsObject
157
virtual ~wxGraphicsPen() {}
159
wxGraphicsPen wxNullGraphicsPen;
163
class wxGraphicsBrush : public wxGraphicsObject
167
virtual ~wxGraphicsBrush() {}
169
wxGraphicsBrush wxNullGraphicsBrush;
173
class wxGraphicsFont : public wxGraphicsObject
177
virtual ~wxGraphicsFont() {}
179
wxGraphicsFont wxNullGraphicsFont;
182
class wxGraphicsBitmap : public wxGraphicsObject
185
wxGraphicsBitmap() {}
186
virtual ~wxGraphicsBitmap() {}
188
wxGraphicsBitmap wxNullGraphicsBitmap;
192
class wxGraphicsPath : public wxGraphicsObject
196
wxGraphicsPath(wxGraphicsRenderer* ) {
197
PyErr_SetString(PyExc_NotImplementedError,
198
"wx.GraphicsPath is not available on this platform.");
200
virtual ~wxGraphicsPath() {}
202
void MoveToPoint( wxDouble, wxDouble ) {}
203
void MoveToPoint( const wxPoint2DDouble& ) {}
204
void AddLineToPoint( wxDouble, wxDouble ) {}
205
void AddLineToPoint( const wxPoint2DDouble& ) {}
206
void AddCurveToPoint( wxDouble, wxDouble, wxDouble, wxDouble, wxDouble, wxDouble ) {}
207
void AddCurveToPoint( const wxPoint2DDouble&, const wxPoint2DDouble&, const wxPoint2DDouble&) {}
208
void AddPath( const wxGraphicsPath& ) {}
209
void CloseSubpath() {}
210
void GetCurrentPoint( wxDouble&, wxDouble&) const {}
211
wxPoint2DDouble GetCurrentPoint() const { return wxPoint2D(0,0); }
212
void AddArc( wxDouble, wxDouble, wxDouble, wxDouble, wxDouble, bool ) {}
213
void AddArc( const wxPoint2DDouble& , wxDouble, wxDouble , wxDouble , bool ) {}
215
void AddQuadCurveToPoint( wxDouble, wxDouble, wxDouble, wxDouble ) {}
216
void AddRectangle( wxDouble, wxDouble, wxDouble, wxDouble ) {}
217
void AddCircle( wxDouble, wxDouble, wxDouble ) {}
218
void AddArcToPoint( wxDouble, wxDouble , wxDouble, wxDouble, wxDouble ) {}
220
void AddEllipse( wxDouble , wxDouble , wxDouble , wxDouble ) {}
221
void AddRoundedRectangle( wxDouble , wxDouble , wxDouble , wxDouble , wxDouble ) {}
222
void * GetNativePath() const { return NULL; }
223
void UnGetNativePath(void *) const {}
224
void Transform( const wxGraphicsMatrix& ) {}
225
void GetBox(wxDouble *, wxDouble *, wxDouble *, wxDouble *) const {}
226
wxRect2D GetBox() const { return wxRect2D(0,0,0,0); }
228
bool Contains( wxDouble , wxDouble , wxPolygonFillMode ) const { return false; }
229
bool Contains( const wxPoint2DDouble& , wxPolygonFillMode ) const { return false; }
231
wxGraphicsPath wxNullGraphicsPath;
234
class wxGraphicsMatrix : public wxGraphicsObject
237
wxGraphicsMatrix() { }
238
wxGraphicsMatrix(wxGraphicsRenderer* ) {
239
PyErr_SetString(PyExc_NotImplementedError,
240
"wx.GraphicsMatrix is not available on this platform.");
242
virtual ~wxGraphicsMatrix() {}
243
virtual void Concat( const wxGraphicsMatrix & ) {}
244
virtual void Copy( const wxGraphicsMatrix & ) {}
245
virtual void Set(wxDouble , wxDouble , wxDouble , wxDouble ,
246
wxDouble , wxDouble ) {}
247
virtual void Get(wxDouble*, wxDouble*, wxDouble*,
248
wxDouble*, wxDouble*, wxDouble*) {}
249
virtual void Invert() {}
250
virtual bool IsEqual( const wxGraphicsMatrix& t) const { return false; }
251
virtual bool IsIdentity() const { return false; }
252
virtual void Translate( wxDouble , wxDouble ) {}
253
virtual void Scale( wxDouble , wxDouble ) {}
254
virtual void Rotate( wxDouble ) {}
255
virtual void TransformPoint( wxDouble *, wxDouble * ) const {}
256
virtual void TransformDistance( wxDouble *, wxDouble * ) const {}
257
virtual void * GetNativeMatrix() const { return NULL; }
259
wxGraphicsMatrix wxNullGraphicsMatrix;
262
class wxGraphicsGradientStop
265
wxGraphicsGradientStop(wxColour col = wxTransparentColour,
267
~wxGraphicsGradientStop() {}
269
const wxColour& GetColour() const { return wxNullColour; }
270
void SetColour(const wxColour& col) {}
272
float GetPosition() const { return 0.0; }
273
void SetPosition(float pos) {}
276
class wxGraphicsGradientStops
279
wxGraphicsGradientStops(wxColour, wxColour) {}
280
~wxGraphicsGradientStops() {}
282
void Add(const wxGraphicsGradientStop& stop) {}
283
void Add(wxColour col, float pos) {}
284
unsigned GetCount() { return 0; }
285
wxGraphicsGradientStop Item(unsigned n) const { return wxGraphicsGradientStop(); }
286
void SetStartColour(wxColour col) {}
287
wxColour GetStartColour() const { return wxNullColour; }
288
void SetEndColour(wxColour col) {}
289
wxColour GetEndColour() const { return wxNullColour; }
294
class wxGraphicsContext : public wxGraphicsObject
298
wxGraphicsContext(wxGraphicsRenderer* ) {
299
PyErr_SetString(PyExc_NotImplementedError,
300
"wx.GraphicsContext is not available on this platform.");
303
virtual ~wxGraphicsContext() {}
305
static wxGraphicsContext* Create() {
306
PyErr_SetString(PyExc_NotImplementedError,
307
"wx.GraphicsContext is not available on this platform.");
311
static wxGraphicsContext* Create( const wxEnhMetaFileDC& ) {
312
PyErr_SetString(PyExc_NotImplementedError,
313
"wx.GraphicsContext is not available on this platform.");
317
static wxGraphicsContext* Create( const wxWindowDC& ) {
318
PyErr_SetString(PyExc_NotImplementedError,
319
"wx.GraphicsContext is not available on this platform.");
323
static wxGraphicsContext * Create( const wxMemoryDC& dc) {
324
PyErr_SetString(PyExc_NotImplementedError,
325
"wx.GraphicsContext is not available on this platform.");
329
static wxGraphicsContext * Create( const wxPrinterDC& dc) {
330
PyErr_SetString(PyExc_NotImplementedError,
331
"wx.GraphicsContext is not available on this platform.");
335
static wxGraphicsContext* CreateFromNative( void * ) {
336
PyErr_SetString(PyExc_NotImplementedError,
337
"wx.GraphicsContext is not available on this platform.");
341
static wxGraphicsContext* CreateFromNativeWindow( void * ) {
342
PyErr_SetString(PyExc_NotImplementedError,
343
"wx.GraphicsContext is not available on this platform.");
347
static wxGraphicsContext* Create( wxWindow* ) {
348
PyErr_SetString(PyExc_NotImplementedError,
349
"wx.GraphicsContext is not available on this platform.");
353
static wxGraphicsContext* Create(wxImage& ) {
354
PyErr_SetString(PyExc_NotImplementedError,
355
"wx.GraphicsContext is not available on this platform.");
359
virtual bool StartDoc( const wxString& message ) { return false; }
360
virtual void EndDoc() {}
361
virtual void StartPage( wxDouble, wxDouble) {}
362
virtual void EndPage() {}
363
virtual void Flush() {}
364
virtual void BeginLayer(wxDouble) {}
365
virtual void EndLayer() {}
367
wxGraphicsPath CreatePath() { return wxNullGraphicsPath; }
369
virtual wxGraphicsPen CreatePen(const wxPen& ) { return wxNullGraphicsPen; }
371
virtual wxGraphicsBrush CreateBrush(const wxBrush& ) { return wxNullGraphicsBrush; }
373
wxGraphicsBrush CreateLinearGradientBrush(
374
wxDouble , wxDouble , wxDouble , wxDouble ,
375
const wxColour&, const wxColour&) const { return wxNullGraphicsBrush; }
377
CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
378
wxDouble x2, wxDouble y2,
379
const wxGraphicsGradientStops& stops) const
380
{ return wxNullGraphicsBrush; }
383
CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
384
wxDouble xc, wxDouble yc, wxDouble radius,
385
const wxColour &oColor, const wxColour &cColor) const
386
{ return wxNullGraphicsBrush; }
389
CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
390
wxDouble xc, wxDouble yc, wxDouble radius,
391
const wxGraphicsGradientStops& stops) const
392
{ return wxNullGraphicsBrush; }
394
virtual wxGraphicsFont CreateFont( const wxFont &, const wxColour & ) { return wxNullGraphicsFont; }
395
virtual wxGraphicsFont CreateFont(double sizeInPixels,
396
const wxString& facename,
397
int flags = wxFONTFLAG_DEFAULT,
398
const wxColour& col = *wxBLACK) const { return wxNullGraphicsFont; }
400
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap & ) const { return wxNullGraphicsBitmap; }
401
wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) const { return wxNullGraphicsBitmap; }
402
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &, wxDouble, wxDouble, wxDouble, wxDouble ) const { return wxNullGraphicsBitmap; }
404
virtual wxGraphicsMatrix CreateMatrix( wxDouble, wxDouble, wxDouble, wxDouble,
405
wxDouble, wxDouble) { return wxNullGraphicsMatrix; }
407
virtual void PushState() {}
408
virtual void PopState() {}
409
virtual void Clip( const wxRegion & ) {}
410
virtual void Clip( wxDouble , wxDouble , wxDouble , wxDouble ) {}
411
virtual void ResetClip() {}
412
virtual void * GetNativeContext() { return NULL; }
413
virtual int GetAntialiasMode() const { return 0; }
414
virtual bool SetAntialiasMode(wxAntialiasMode antialias) { return false; }
416
virtual wxInterpolationQuality GetInterpolationQuality() const { return wxINTERPOLATION_DEFAULT; }
417
virtual bool SetInterpolationQuality(wxInterpolationQuality) { return false; };
419
virtual int GetCompositionMode() const { return 0; }
420
virtual bool SetCompositionMode(wxCompositionMode op) { return false; }
421
virtual void GetSize( wxDouble*, wxDouble* );
422
virtual void GetDPI( wxDouble*, wxDouble* );
424
virtual void Translate( wxDouble , wxDouble ) {}
425
virtual void Scale( wxDouble , wxDouble ) {}
426
virtual void Rotate( wxDouble ) {}
427
virtual void ConcatTransform( const wxGraphicsMatrix& ) {}
428
virtual void SetTransform( const wxGraphicsMatrix& ) {}
429
virtual wxGraphicsMatrix GetTransform() const { return wxNullGraphicsMatrix; }
431
virtual void SetPen( const wxGraphicsPen& ) {}
432
void SetPen( const wxPen& ) {}
434
virtual void SetBrush( const wxGraphicsBrush& ) {}
435
void SetBrush( const wxBrush& ) {}
437
virtual void SetFont( const wxGraphicsFont& ) {}
438
void SetFont( const wxFont&, const wxColour& ) {}
440
virtual void StrokePath( const wxGraphicsPath & ) {}
441
virtual void FillPath( const wxGraphicsPath &, wxPolygonFillMode ) {}
442
virtual void DrawPath( const wxGraphicsPath &, wxPolygonFillMode ) {}
444
virtual void DrawText( const wxString &, wxDouble , wxDouble ) {}
445
virtual void DrawText( const wxString &, wxDouble , wxDouble , wxDouble ) {}
446
virtual void DrawText( const wxString &, wxDouble , wxDouble , wxGraphicsBrush ) {}
447
virtual void DrawText( const wxString &, wxDouble , wxDouble , wxDouble , wxGraphicsBrush ) {}
448
virtual void GetTextExtent( const wxString &, wxDouble *, wxDouble *,
449
wxDouble *, wxDouble * ) const {}
450
virtual void GetPartialTextExtents(const wxString& , wxArrayDouble& ) const {}
452
virtual void DrawBitmap( const wxGraphicsBitmap &, wxDouble, wxDouble, wxDouble, wxDouble ) {}
453
virtual void DrawBitmap( const wxBitmap &, wxDouble , wxDouble , wxDouble , wxDouble ) {}
454
virtual void DrawIcon( const wxIcon &, wxDouble , wxDouble , wxDouble , wxDouble ) {}
456
virtual void StrokeLine( wxDouble , wxDouble , wxDouble , wxDouble ) {}
457
virtual void StrokeLines( size_t , const wxPoint2DDouble *) {}
458
virtual void StrokeLines( size_t , const wxPoint2DDouble *, const wxPoint2DDouble *) {}
459
virtual void DrawLines( size_t , const wxPoint2DDouble *, wxPolygonFillMode ) {}
460
virtual void DrawRectangle( wxDouble , wxDouble , wxDouble , wxDouble ) {}
461
virtual void DrawEllipse( wxDouble , wxDouble , wxDouble , wxDouble ) {}
462
virtual void DrawRoundedRectangle( wxDouble , wxDouble , wxDouble , wxDouble , wxDouble ) {}
463
virtual bool ShouldOffset() const { return false; }
465
virtual void EnableOffset(bool enable = true) {}
466
void DisableOffset() { }
467
bool OffsetEnabled() { return false; }
472
class wxGraphicsRenderer : public wxObject
475
wxGraphicsRenderer() {
476
PyErr_SetString(PyExc_NotImplementedError,
477
"wx.GraphicsRenderer is not available on this platform.");
480
virtual ~wxGraphicsRenderer() {}
482
static wxGraphicsRenderer* GetDefaultRenderer() {
483
PyErr_SetString(PyExc_NotImplementedError,
484
"wx.GraphicsRenderer is not available on this platform.");
487
static wxGraphicsRenderer* GetCairoRenderer() {
488
PyErr_SetString(PyExc_NotImplementedError,
489
"wx.GraphicsRenderer is not available on this platform.");
493
virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& ) { return NULL; }
494
virtual wxGraphicsContext * CreateContext( const wxWindowDC& ) { return NULL; }
495
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& ) { return NULL; }
496
virtual wxGraphicsContext * CreateContext( const wxPrinterDC& ) { return NULL; }
497
virtual wxGraphicsContext * CreateContextFromNativeContext( void * ) { return NULL; }
498
virtual wxGraphicsContext * CreateContextFromNativeWindow( void * ) { return NULL; }
499
virtual wxGraphicsContext * CreateContext( wxWindow* ) { return NULL; }
500
virtual wxGraphicsContext * CreateContextFromImage(wxImage&) { return NULL; }
501
virtual wxGraphicsContext * CreateMeasuringContext() { return NULL; }
503
virtual wxGraphicsPath CreatePath() { return wxNullGraphicsPath; }
505
virtual wxGraphicsMatrix CreateMatrix( wxDouble , wxDouble , wxDouble , wxDouble ,
506
wxDouble , wxDouble ) { return wxNullGraphicsMatrix; }
508
virtual wxGraphicsPen CreatePen(const wxPen& ) { return wxNullGraphicsPen; }
509
virtual wxGraphicsBrush CreateBrush(const wxBrush& ) { return wxNullGraphicsBrush; }
512
CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
513
wxDouble x2, wxDouble y2,
514
const wxGraphicsGradientStops& stops) const
515
{ return wxNullGraphicsBrush; }
518
CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
519
wxDouble xc, wxDouble yc, wxDouble radius,
520
const wxGraphicsGradientStops& stops) const
521
{ return wxNullGraphicsBrush; }
523
virtual wxGraphicsFont CreateFont( const wxFont & , const wxColour & ) { return wxNullGraphicsFont; }
524
virtual wxGraphicsFont CreateFont(double,
527
const wxColour&) { return wxNullGraphicsFont; }
529
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap & ) const { return wxNullGraphicsBitmap; }
530
virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage&) { return wxNullGraphicsBitmap; }
531
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &, wxDouble, wxDouble, wxDouble, wxDouble ) const { return wxNullGraphicsBitmap; }
536
class wxGCDC: public wxDC
539
wxGCDC(const wxWindowDC&)
542
wxPyBlock_t blocked = wxPyBeginBlockThreads();
543
PyErr_SetString(PyExc_NotImplementedError,
544
"wxGCDC is not available on this platform.");
545
wxPyEndBlockThreads(blocked);
548
wxGCDC(const wxMemoryDC&)
551
wxPyBlock_t blocked = wxPyBeginBlockThreads();
552
PyErr_SetString(PyExc_NotImplementedError,
553
"wxGCDC is not available on this platform.");
554
wxPyEndBlockThreads(blocked);
557
wxGCDC(const wxPrinterDC& dc)
560
wxPyBlock_t blocked = wxPyBeginBlockThreads();
561
PyErr_SetString(PyExc_NotImplementedError,
562
"wxGCDC is not available on this platform.");
563
wxPyEndBlockThreads(blocked);
566
wxGCDC(wxGraphicsContext*&)
569
wxPyBlock_t blocked = wxPyBeginBlockThreads();
570
PyErr_SetString(PyExc_NotImplementedError,
571
"wxGCDC is not available on this platform.");
572
wxPyEndBlockThreads(blocked);
575
wxGCDC(const wxGraphicsContext& ctx)
578
wxPyBlock_t blocked = wxPyBeginBlockThreads();
579
PyErr_SetString(PyExc_NotImplementedError,
580
"wxGCDC is not available on this platform.");
581
wxPyEndBlockThreads(blocked);
587
wxPyBlock_t blocked = wxPyBeginBlockThreads();
588
PyErr_SetString(PyExc_NotImplementedError,
589
"wxGCDC is not available on this platform.");
590
wxPyEndBlockThreads(blocked);
595
wxGraphicsContext* GetGraphicsContext() const { return NULL; }
596
void SetGraphicsContext( wxGraphicsContext* ) {}
603
//---------------------------------------------------------------------------
604
//---------------------------------------------------------------------------
605
//---------------------------------------------------------------------------
608
%typemap(in) (size_t points, wxPoint2D* points_array ) {
609
$2 = wxPoint2D_LIST_helper($input, &$1);
610
if ($2 == NULL) SWIG_fail;
612
%typemap(freearg) (size_t points, wxPoint2D* points_array ) {
613
if ($2) delete [] $2;
618
MustHaveApp(wxGraphicsPath);
619
MustHaveApp(wxGraphicsContext);
622
//---------------------------------------------------------------------------
625
DocStr(wxGraphicsObject,
626
"This class is the superclass of native graphics objects like pens
627
etc. It provides the internal reference counting. It is not to be
628
instantiated by user code.", "");
629
class wxGraphicsObject : public wxObject
632
wxGraphicsObject( wxGraphicsRenderer* renderer = NULL );
633
virtual ~wxGraphicsObject();
636
bool , IsNull() const ,
637
"Is this object valid (false) or still empty (true)?", "");
640
wxGraphicsRenderer* , GetRenderer() const,
641
"Returns the renderer that was used to create this instance, or
642
``None`` if it has not been initialized yet.", "");
647
DocStr(wxGraphicsPen,
648
"A wx.GraphicsPen is a native representation of a pen. It is used for
649
stroking a path on a `wx.GraphicsContext`. The contents are specific and
650
private to the respective renderer. The only way to get a valid instance
651
is via a CreatePen call on the graphics context or the renderer
653
class wxGraphicsPen : public wxGraphicsObject
657
virtual ~wxGraphicsPen();
660
DocStr(wxGraphicsBrush,
661
"A wx.GraphicsBrush is a native representation of a brush. It is used
662
for filling a path on a `wx.GraphicsContext`. The contents are
663
specific and private to the respective renderer. The only way to get a
664
valid instance is via a Create...Brush call on the graphics context or
665
the renderer instance.", "");
666
class wxGraphicsBrush : public wxGraphicsObject
670
virtual ~wxGraphicsBrush();
674
DocStr(wxGraphicsFont,
675
"A `wx.GraphicsFont` is a native representation of a font (including
676
text colour). The contents are specific an private to the respective
677
renderer. The only way to get a valid instance is via a CreateFont
678
call on the graphics context or the renderer instance.", "");
679
class wxGraphicsFont : public wxGraphicsObject
683
virtual ~wxGraphicsFont();
687
DocStr(wxGraphicsBitmap,
689
class wxGraphicsBitmap : public wxGraphicsObject
693
virtual ~wxGraphicsBitmap();
697
//---------------------------------------------------------------------------
699
DocStr(wxGraphicsMatrix,
700
"A wx.GraphicsMatrix is a native representation of an affine
701
matrix. The contents are specific and private to the respective
702
renderer. The only way to get a valid instance is via a CreateMatrix
703
call on the graphics context or the renderer instance.", "");
704
class wxGraphicsMatrix : public wxGraphicsObject
707
// wxGraphicsMatrix();
708
virtual ~wxGraphicsMatrix();
711
virtual void , Concat( const wxGraphicsMatrix& t ),
712
"Concatenates the passed in matrix to the current matrix.", "");
716
virtual void , Set(wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
717
wxDouble tx=0.0, wxDouble ty=0.0),
718
"Sets the matrix to the specified values (default values are the
719
identity matrix.)", "");
723
virtual void , Get(wxDouble* OUTPUT, wxDouble* OUTPUT, wxDouble* OUTPUT,
724
wxDouble* OUTPUT, wxDouble* OUTPUT, wxDouble* OUTPUT),
725
"Get(self) --> (a, b, c, d, tx, ty)",
726
"Gets the component values of the matrix and returns them as a tuple.", "");
730
virtual void , Invert(),
731
"Inverts the matrix.", "");
735
virtual bool , IsEqual( const wxGraphicsMatrix& t) const,
736
"Returns ``True`` if the elements of the transformation matrix are
741
virtual bool , IsIdentity() const,
742
"Returns ``True`` if this is the identity matrix", "");
746
virtual void , Translate( wxDouble dx , wxDouble dy ),
747
"Add a translation to this matrix.", "");
751
virtual void , Scale( wxDouble xScale , wxDouble yScale ),
752
"Scales this matrix.", "");
756
virtual void , Rotate( wxDouble angle ),
757
"Rotates this matrix. The angle should be specified in radians.", "");
761
virtual void , TransformPoint( wxDouble *INOUT, wxDouble *INOUT ) const,
762
"TransformPoint(self, x, y) --> (x, y)",
763
"Applies this matrix to a point, returns the resulting point values", "");
767
virtual void , TransformDistance( wxDouble *INOUT, wxDouble *INOUT ) const,
768
"TransformDistance(self, dx, dy) --> (dx, dy)",
769
"Applies this matrix to a distance (ie. performs all transforms except
774
virtual void * , GetNativeMatrix() const,
775
"Returns the native representation of the matrix. For CoreGraphics this
776
is a CFAffineMatrix pointer. For GDIPlus a Matrix Pointer and for
777
Cairo a cairo_matrix_t pointer. NOTE: For wxPython we still need a
778
way to make this value usable.", "");
781
//---------------------------------------------------------------------------
783
class wxGraphicsPath : public wxGraphicsObject
787
virtual ~wxGraphicsPath();
790
%nokwargs MoveToPoint;
792
"Begins a new subpath at the specified point.", "");
793
virtual void MoveToPoint( wxDouble x, wxDouble y );
794
void MoveToPoint( const wxPoint2D& p);
797
%nokwargs AddLineToPoint;
798
DocStr(AddLineToPoint,
799
"Adds a straight line from the current point to the specified point.", "");
800
virtual void AddLineToPoint( wxDouble x, wxDouble y );
801
void AddLineToPoint( const wxPoint2D& p);
804
%nokwargs AddCurveToPoint;
805
DocStr(AddCurveToPoint,
806
"Adds a cubic Bezier curve from the current point, using two control
807
points and an end point", "");
808
virtual void AddCurveToPoint( wxDouble cx1, wxDouble cy1,
809
wxDouble cx2, wxDouble cy2,
810
wxDouble x, wxDouble y );
811
void AddCurveToPoint( const wxPoint2D& c1, const wxPoint2D& c2, const wxPoint2D& e);
816
virtual void , AddPath( const wxGraphicsPath& path ),
817
"Adds another path", "");
821
virtual void , CloseSubpath(),
822
"Closes the current sub-path.", "");
826
wxPoint2D , GetCurrentPoint() const,
827
"Gets the last point of the current path, (0,0) if not yet set", "");
832
"Adds an arc of a circle centering at (x,y) with radius (r) from
833
startAngle to endAngle", "");
834
virtual void AddArc( wxDouble x, wxDouble y, wxDouble r,
835
wxDouble startAngle, wxDouble endAngle, bool clockwise=true );
836
void AddArc( const wxPoint2D& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise=true);
840
virtual void , AddQuadCurveToPoint( wxDouble cx, wxDouble cy, wxDouble x, wxDouble y ),
841
"Adds a quadratic Bezier curve from the current point, using a control
842
point and an end point", "");
846
virtual void , AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ),
847
"Appends a rectangle as a new closed subpath.", "");
851
virtual void , AddCircle( wxDouble x, wxDouble y, wxDouble r ),
852
"Appends a circle around (x,y) with radius r as a new closed subpath.", "");
856
virtual void , AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) ,
857
"Appends an arc to two tangents connecting (current) to (x1,y1) and
858
(x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)", "");
862
virtual void , AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h),
863
"Appends an ellipse fitting into the passed in rectangle.", "");
867
virtual void , AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius),
868
"Appends a rounded rectangle.", "");
872
virtual void * , GetNativePath() const,
873
"Returns the native path (CGPathRef for Core Graphics, Path pointer for
874
GDIPlus and a cairo_path_t pointer for cairo). NOTE: For wxPython we
875
still need a way to make this value usable.", "");
879
virtual void , UnGetNativePath(void *p) const,
880
"Gives back the native path returned by GetNativePath() because there
881
might be some deallocations necessary (eg on cairo the native path
882
returned by GetNativePath is newly allocated each time).", "");
886
virtual void , Transform( const wxGraphicsMatrix& matrix ),
887
"Transforms each point of this path by the matrix", "");
891
wxRect2D , GetBox() const,
892
"Gets the bounding box enclosing all points (possibly including control
898
"Returns ``True`` if the point is within the path.", "");
899
virtual bool Contains( wxDouble x, wxDouble y, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const;
900
bool Contains( const wxPoint2D& c, wxPolygonFillMode fillStyle = wxODDEVEN_RULE) const;
905
//---------------------------------------------------------------------------
908
const wxGraphicsPen wxNullGraphicsPen;
909
const wxGraphicsBrush wxNullGraphicsBrush;
910
const wxGraphicsFont wxNullGraphicsFont;
911
const wxGraphicsBitmap wxNullGraphicsBitmap;
912
const wxGraphicsMatrix wxNullGraphicsMatrix;
913
const wxGraphicsPath wxNullGraphicsPath;
916
//---------------------------------------------------------------------------
918
// Describes a single gradient stop.
919
class wxGraphicsGradientStop
922
wxGraphicsGradientStop(wxColour col = wxTransparentColour,
924
~wxGraphicsGradientStop();
926
const wxColour& GetColour() const;
927
void SetColour(const wxColour& col);
929
float GetPosition() const;
930
void SetPosition(float pos);
932
%property(Position, GetPosition, SetPosition);
933
%property(Colour, GetColour, SetColour);
936
// A collection of gradient stops ordered by their positions (from lowest to
937
// highest). The first stop (index 0, position 0.0) is always the starting
938
// colour and the last one (index GetCount() - 1, position 1.0) is the end
940
class wxGraphicsGradientStops
943
wxGraphicsGradientStops(wxColour startCol = wxTransparentColour,
944
wxColour endCol = wxTransparentColour);
945
~wxGraphicsGradientStops();
947
// Add a stop in correct order.
949
void Add(const wxGraphicsGradientStop& stop);
950
void Add(wxColour col, float pos);
952
// Get the number of stops.
955
// Return the stop at the given index (which must be valid).
956
wxGraphicsGradientStop Item(unsigned n) const;
958
// Get/set start and end colours.
959
void SetStartColour(wxColour col);
960
wxColour GetStartColour() const;
961
void SetEndColour(wxColour col);
962
wxColour GetEndColour() const;
966
{ return self->GetCount(); }
967
wxGraphicsGradientStop __getitem__(unsigned n)
968
{ return self->Item(n); }
971
%property(Count, GetCount);
972
%property(StartColour, GetStartColour, SetStartColour);
973
%property(EndColour, GetEndColour, SetEndColour);
978
//---------------------------------------------------------------------------
980
DocStr(wxGraphicsContext,
981
"A `wx.GraphicsContext` instance is the object that is drawn upon. It is
982
created by a renderer using the CreateContext calls, this can be done
983
either directly using a renderer instance, or indirectly using the
984
static convenience CreateXXX functions of wx.GraphicsContext that
985
always delegate the task to the default renderer.", "");
987
class wxGraphicsContext : public wxGraphicsObject
990
//wxGraphicsContext(); This is an ABC, use Create to make an instance...
991
virtual ~wxGraphicsContext();
996
"val.__dc = args[0] # save a ref so the dc will not be deleted before self";
998
"Creates a wx.GraphicsContext either from a window or a DC.", "");
999
static wxGraphicsContext* Create( const wxWindowDC& dc);
1000
static wxGraphicsContext* Create( const wxMemoryDC& dc);
1001
static wxGraphicsContext* Create( wxWindow* window ) ;
1002
static wxGraphicsContext* Create( const wxPrinterDC& dc) ;
1004
static wxGraphicsContext* Create( const wxMetaFileDC& dc) ;
1005
static wxGraphicsContext* Create( const wxEnhMetaFileDC& dc) ;
1007
static wxGraphicsContext* Create(wxImage& );
1009
%pythonAppend Create "";
1011
static wxGraphicsContext* , Create(),
1012
"Create a lightwieght context that can be used for measuring text only.", "",
1013
CreateMeasuringContext);
1015
%newobject CreateFromNative;
1017
static wxGraphicsContext* , CreateFromNative( void * context ) ,
1018
"Creates a wx.GraphicsContext from a native context. This native
1019
context must be eg a CGContextRef for Core Graphics, a Graphics
1020
pointer for GDIPlus or a cairo_t pointer for Cairo. NOTE: For
1021
wxPython we still need a way to make this value usable.", "");
1024
%newobject CreateFromNativeWindow;
1026
static wxGraphicsContext* , CreateFromNativeWindow( void * window ) ,
1027
"Creates a wx.GraphicsContext from a native window. NOTE: For wxPython
1028
we still need a way to make this value usable.", "");
1032
virtual bool , StartDoc( const wxString& message ) ,
1033
"Begin a new document (relevant only for printing / pdf etc) if there
1034
is a progress dialog, message will be shown", "");
1038
virtual void , EndDoc(),
1039
"Done with that document (relevant only for printing / pdf etc) ", "");
1043
virtual void , StartPage( wxDouble width = 0, wxDouble height = 0 ),
1044
"Opens a new page (relevant only for printing / pdf etc) with the given
1045
size in points (if both are null the default page size will be used)
1050
virtual void , EndPage(),
1051
"Ends the current page (relevant only for printing / pdf etc) ", "");
1055
virtual void , Flush(),
1056
"Make sure that the current content of this context is immediately visible", "");
1059
virtual wxGraphicsPath , CreatePath(),
1060
"Creates a native graphics path which is initially empty.", "");
1064
virtual wxGraphicsPen , CreatePen(const wxPen& pen),
1065
"Creates a native pen from a `wx.Pen`.", "");
1069
virtual wxGraphicsBrush , CreateBrush(const wxBrush& brush ),
1070
"Creates a native brush from a `wx.Brush`.", "");
1073
DocStr(CreateLinearGradientBrush,
1074
"Creates a native brush, having a linear gradient, starting at (x1,y1)
1075
to (x2,y2) with the given boundary colors or the specified stops.", "");
1076
%nokwargs CreateLinearGradientBrush;
1078
CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2,
1079
const wxColour& c1, const wxColour& c2) const;
1081
CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
1082
wxDouble x2, wxDouble y2,
1083
const wxGraphicsGradientStops& stops) const;
1086
DocStr(CreateRadialGradientBrush,
1087
"Creates a native brush, having a radial gradient originating at point
1088
(xo,yo) and ending on a circle around (xc,yc) with the given radius; the colours may be
1089
specified by just the two extremes or the full array of gradient stops.", "");
1090
%nokwargs CreateRadialGradientBrush;
1092
CreateRadialGradientBrush( wxDouble xo, wxDouble yo,
1093
wxDouble xc, wxDouble yc, wxDouble radius,
1094
const wxColour &oColor, const wxColour &cColor) const;
1096
CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
1097
wxDouble xc, wxDouble yc, wxDouble radius,
1098
const wxGraphicsGradientStops& stops) const;
1101
%nokwargs CreateFont;
1103
virtual wxGraphicsFont , CreateFont( const wxFont &font , const wxColour &col = *wxBLACK ),
1104
"Creates a native graphics font from a `wx.Font` and a text colour.", "");
1106
virtual wxGraphicsFont CreateFont(double sizeInPixels,
1107
const wxString& facename,
1108
int flags = wxFONTFLAG_DEFAULT,
1109
const wxColour& col = *wxBLACK) const;
1112
virtual wxGraphicsBitmap , CreateBitmap( const wxBitmap &bitmap ) const,
1113
"Create a native bitmap representation.", "");
1115
wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) const;
1119
virtual wxGraphicsBitmap , CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h ) const,
1120
"Create a native bitmap representation using a subset of a wx.Bitmap.", "");
1124
virtual wxGraphicsMatrix , CreateMatrix( wxDouble a=1.0, wxDouble b=0.0,
1125
wxDouble c=0.0, wxDouble d=1.0,
1126
wxDouble tx=0.0, wxDouble ty=0.0),
1127
"Creates a native affine transformation matrix from the passed in
1128
values. The defaults result in an identity matrix.", "");
1133
virtual void , PushState(),
1134
"Push the current state of the context, (ie the transformation matrix)
1139
virtual void , PopState(),
1140
"Pops a stored state from the stack", "");
1144
virtual void , Clip( const wxRegion ®ion ),
1145
"Clips drawings to the region intersected with the current clipping region.", "",
1150
virtual void , Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ),
1151
"Clips drawings to the rectangle intersected with the current clipping region..", "");
1155
virtual void , ResetClip(),
1156
"Resets the clipping to original shape.", "");
1160
virtual void * , GetNativeContext(),
1161
"Returns the native context (CGContextRef for Core Graphics, Graphics
1162
pointer for GDIPlus and cairo_t pointer for cairo).", "");
1166
virtual wxAntialiasMode , GetAntialiasMode() const,
1167
"Returns the current shape antialiasing mode", "");
1170
virtual bool , SetAntialiasMode(wxAntialiasMode antialias),
1171
"Sets the antialiasing mode, returns true if it is supported", "");
1173
// returns the current interpolation quality
1174
virtual wxInterpolationQuality GetInterpolationQuality() const;
1176
// sets the interpolation quality, returns true if it supported
1177
virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation);
1180
virtual wxCompositionMode , GetCompositionMode() const,
1181
"Returns the current compositing operator", "");
1185
virtual bool , SetCompositionMode(wxCompositionMode op),
1186
"Sets the compositing operator, returns True if it supported", "");
1190
virtual void , GetSize( wxDouble* OUTPUT, wxDouble* OUTPUT),
1191
"GetSize(self) --> (width, height)",
1192
"Returns the size of the graphics context in device coordinates", "");
1196
virtual void , GetDPI( wxDouble* OUTPUT, wxDouble* OUTPUT),
1197
"GetDPI(self) --> (dpiX, dpiY)",
1198
"Returns the resolution of the graphics context in device points per inch", "");
1202
virtual void , BeginLayer(wxDouble opacity),
1203
"all rendering is done into a fully transparent temporary context", "");
1207
virtual void , EndLayer(),
1208
"composites back the drawings into the context with the opacity given
1209
at the BeginLayer call", "");
1214
virtual void , Translate( wxDouble dx , wxDouble dy ),
1215
"Translates the current transformation matrix.", "");
1219
virtual void , Scale( wxDouble xScale , wxDouble yScale ),
1220
"Scale the current transformation matrix of the context.", "");
1224
virtual void , Rotate( wxDouble angle ),
1225
"Rotate the current transformation matrix of the context. ``angle`` is
1226
specified in radians.", "");
1230
virtual void , ConcatTransform( const wxGraphicsMatrix& matrix ),
1231
"Concatenates the passed in transform with the current transform of
1232
this context.", "");
1236
virtual void , SetTransform( const wxGraphicsMatrix& matrix ),
1237
"Sets the current transform of this context.", "");
1241
virtual wxGraphicsMatrix , GetTransform() const,
1242
"Gets the current transformation matrix of this context.", "");
1246
DocStr(SetPen, "Sets the stroke pen", "");
1248
virtual void SetPen( const wxGraphicsPen& pen );
1249
void SetPen( const wxPen& pen );
1252
DocStr(SetBrush, "Sets the brush for filling", "");
1254
virtual void SetBrush( const wxGraphicsBrush& brush );
1255
void SetBrush( const wxBrush& brush );
1258
DocStr(SetFont, "Sets the font", "");
1260
virtual void SetFont( const wxGraphicsFont& font );
1261
void SetFont( const wxFont& font, const wxColour& colour = *wxBLACK);
1266
virtual void , StrokePath( const wxGraphicsPath& path ),
1267
"Strokes along a path with the current pen.", "");
1271
virtual void , FillPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ),
1272
"Fills a path with the current brush.", "");
1276
virtual void , DrawPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ),
1277
"Draws the path by first filling and then stroking.", "");
1282
"Draws a text string at the defined position.", "");
1283
void DrawText( const wxString &str, wxDouble x, wxDouble y,
1284
const wxGraphicsBrush& backgroundBrush = wxNullGraphicsBrush )
1286
if ( !backgroundBrush.IsNull() )
1287
self->DrawText(str, x, y, backgroundBrush);
1289
self->DrawText(str, x, y);
1292
DocStr(DrawRotatedText,
1293
"Draws a text string at the defined position, at the specified angle,
1294
which is given in radians.", "");
1295
void DrawRotatedText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle,
1296
const wxGraphicsBrush& backgroundBrush = wxNullGraphicsBrush )
1298
if ( !backgroundBrush.IsNull() )
1299
self->DrawText(str, x, y, angle, backgroundBrush);
1301
self->DrawText(str, x, y, angle);
1308
virtual void , GetTextExtent( const wxString &text,
1309
wxDouble *OUTPUT /*width*/,
1310
wxDouble *OUTPUT /*height*/,
1311
wxDouble *OUTPUT /*descent*/,
1312
wxDouble *OUTPUT /*externalLeading*/ ) const ,
1313
"GetFullTextExtent(self, text) --> (width, height, descent, externalLeading)",
1314
"Gets the dimensions of the string using the currently selected
1315
font. ``text`` is the string to measure, ``w`` and ``h`` are the total
1316
width and height respectively, ``descent`` is the dimension from the
1317
baseline of the font to the bottom of the descender, and
1318
``externalLeading`` is any extra vertical space added to the font by
1319
the font designer (usually is zero).", "",
1323
DocAStr(GetTextExtent,
1324
"GetTextExtent(self, text) --> (width, height)",
1325
"Gets the dimensions of the string using the currently selected
1326
font. ``text`` is the string to measure, ``w`` and ``h`` are the total
1327
width and height respectively.", "");
1329
PyObject* GetTextExtent( const wxString &text )
1331
wxDouble width = 0.0,
1333
self->GetTextExtent(text, &width, &height, NULL, NULL);
1334
// thread wrapers are turned off for this .i file, so no need to acquire GIL...
1335
PyObject* rv = PyTuple_New(2);
1336
PyTuple_SET_ITEM(rv, 0, PyFloat_FromDouble(width));
1337
PyTuple_SET_ITEM(rv, 1, PyFloat_FromDouble(height));
1344
DocAStr(GetPartialTextExtents,
1345
"GetPartialTextExtents(self, text) -> [widths]",
1346
"Returns a list of widths from the beginning of ``text`` to the
1347
coresponding character in ``text``.", "");
1348
wxArrayDouble GetPartialTextExtents(const wxString& text) {
1349
wxArrayDouble widths;
1350
self->GetPartialTextExtents(text, widths);
1356
%nokwargs DrawBitmap;
1358
"Draws the bitmap. In case of a mono bitmap, this is treated as a mask
1359
and the current brush is used for filling.", "");
1361
virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
1363
virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
1367
virtual void , DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ),
1368
"Draws the icon.", "");
1373
virtual void , StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2),
1374
"Strokes a single line.", "");
1378
virtual void , StrokeLines( size_t points, const wxPoint2D *points_array),
1379
"StrokeLines(self, List points)",
1380
"Stroke lines connecting each of the points", "");
1384
DocAStr(StrokeLineSegements,
1385
"StrokeLineSegments(self, List beginPoints, List endPoints)",
1386
"Stroke disconnected lines from begin to end points", "");
1387
void StrokeLineSegements(PyObject* beginPoints, PyObject* endPoints)
1389
size_t c1, c2, count;
1390
wxPoint2D* beginP = wxPoint2D_LIST_helper(beginPoints, &c1);
1391
wxPoint2D* endP = wxPoint2D_LIST_helper(endPoints, &c2);
1393
if ( beginP != NULL && endP != NULL )
1395
count = wxMin(c1, c2);
1396
self->StrokeLines(count, beginP, endP);
1405
virtual void , DrawLines( size_t points, const wxPoint2D *points_array,
1406
wxPolygonFillMode fillStyle = wxODDEVEN_RULE ),
1407
"Draws a polygon.", "");
1411
virtual void , DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h),
1412
"Draws a rectangle.", "");
1416
virtual void , DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h),
1417
"Draws an ellipse.", "");
1421
virtual void , DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius),
1422
"Draws a rounded rectangle", "");
1427
virtual bool , ShouldOffset() const,
1428
"helper to determine if a 0.5 offset should be applied for the drawing operation", "");
1431
// indicates whether the context should try to offset for pixel boundaries, this only makes sense on
1432
// bitmap devices like screen, by default this is turned off
1433
virtual void EnableOffset(bool enable = true);
1434
void DisableOffset() { EnableOffset(false); }
1435
bool OffsetEnabled() { return m_enableOffset; }
1440
//---------------------------------------------------------------------------
1442
class wxGraphicsRenderer : public wxObject
1445
// wxGraphicsRenderer(); This is an ABC, use GetDefaultRenderer
1447
virtual ~wxGraphicsRenderer();
1449
static wxGraphicsRenderer* GetDefaultRenderer();
1450
static wxGraphicsRenderer* GetCairoRenderer();
1452
%nokwargs CreateContext;
1453
%newobject CreateContext;
1454
virtual wxGraphicsContext * CreateContext( const wxWindowDC& dc) ;
1455
virtual wxGraphicsContext * CreateContext( const wxMemoryDC& dc) ;
1456
virtual wxGraphicsContext * CreateContext( const wxPrinterDC& dc) ;
1457
virtual wxGraphicsContext * CreateContext( wxWindow* window );
1459
virtual wxGraphicsContext * CreateContext( const wxMetaFileDC& dc) ;
1460
virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc) ;
1463
virtual wxGraphicsContext * CreateContextFromImage(wxImage& image);
1465
// create a context that can be used for measuring texts only, no drawing allowed
1466
virtual wxGraphicsContext * CreateMeasuringContext();
1468
%newobject CreateContextFromNativeContext;
1469
virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
1471
%newobject CreateContextFromNativeWindow;
1472
virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window );
1475
virtual wxGraphicsPath CreatePath();
1477
virtual wxGraphicsMatrix CreateMatrix( wxDouble a=1.0, wxDouble b=0.0, wxDouble c=0.0, wxDouble d=1.0,
1478
wxDouble tx=0.0, wxDouble ty=0.0);
1480
virtual wxGraphicsPen CreatePen(const wxPen& pen) ;
1482
virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) ;
1485
CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
1486
wxDouble x2, wxDouble y2,
1487
const wxGraphicsGradientStops& stops);
1490
CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
1491
wxDouble xc, wxDouble yc, wxDouble radius,
1492
const wxGraphicsGradientStops& stops);
1495
virtual wxGraphicsFont CreateFont( const wxFont &font , const wxColour &col = *wxBLACK );
1496
virtual wxGraphicsFont CreateFont(double sizeInPixels,
1497
const wxString& facename,
1498
int flags = wxFONTFLAG_DEFAULT,
1499
const wxColour& col = *wxBLACK);
1501
virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap );
1502
virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image);
1503
virtual wxGraphicsBitmap CreateSubBitmap( const wxGraphicsBitmap &bitmap, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
1508
//---------------------------------------------------------------------------
1511
#include "wx/dcgraph.h"
1514
class wxGCDC: public wxDC
1518
%pythonAppend wxGCDC
1519
"self.__dc = args[0] # save a ref so the other dc will not be deleted before self";
1520
wxGCDC(const wxWindowDC& dc);
1521
wxGCDC(const wxMemoryDC& dc);
1522
wxGCDC(const wxPrinterDC& dc);
1523
wxGCDC(wxWindow* window);
1525
%disownarg( wxGraphicsContext* ctx );
1526
wxGCDC(wxGraphicsContext* ctx);
1527
%cleardisown( wxGraphicsContext* ctx );
1532
wxGraphicsContext* GetGraphicsContext() const;
1534
%disownarg( wxGraphicsContext* ctx );
1535
virtual void SetGraphicsContext( wxGraphicsContext* ctx );
1536
%cleardisown( wxGraphicsContext* ctx );
1538
%property(GraphicsContext, GetGraphicsContext, SetGraphicsContext);
1542
//---------------------------------------------------------------------------
1544
// Turn GIL acquisition back on.