~brian-sidebotham/wxwidgets-cmake/wxpython-2.9.4

« back to all changes in this revision

Viewing changes to wxPython/src/_graphics.i

  • Committer: Brian Sidebotham
  • Date: 2013-08-03 14:30:08 UTC
  • Revision ID: brian.sidebotham@gmail.com-20130803143008-c7806tkych1tp6fc
Initial import into Bazaar

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/////////////////////////////////////////////////////////////////////////////
 
2
// Name:        _graphics.i
 
3
// Purpose:     Wrapper definitions for wx.GraphicsPath, wx.GraphicsContext
 
4
//
 
5
// Author:      Robin Dunn
 
6
//
 
7
// Created:     2-Oct-2006
 
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
/////////////////////////////////////////////////////////////////////////////
 
12
 
 
13
// Not a %module
 
14
 
 
15
 
 
16
//---------------------------------------------------------------------------
 
17
%newgroup
 
18
 
 
19
%{
 
20
#include <wx/graphics.h>
 
21
%}
 
22
 
 
23
enum wxAntialiasMode
 
24
{
 
25
    wxANTIALIAS_NONE, // should be 0
 
26
    wxANTIALIAS_DEFAULT,
 
27
};
 
28
 
 
29
enum wxInterpolationQuality
 
30
{
 
31
    // default interpolation
 
32
    wxINTERPOLATION_DEFAULT,
 
33
    // no interpolation
 
34
    wxINTERPOLATION_NONE, 
 
35
    // fast interpolation, suited for interactivity
 
36
    wxINTERPOLATION_FAST,
 
37
    // better quality
 
38
    wxINTERPOLATION_GOOD,
 
39
    // best quality, not suited for interactivity
 
40
    wxINTERPOLATION_BEST
 
41
};
 
42
 
 
43
 
 
44
enum wxCompositionMode
 
45
{
 
46
    // R = Result, S = Source, D = Destination, premultiplied with alpha
 
47
    // Ra, Sa, Da their alpha components
 
48
    
 
49
    // classic Porter-Duff compositions
 
50
    // http://keithp.com/~keithp/porterduff/p253-porter.pdf
 
51
 
 
52
    wxCOMPOSITION_INVALID,
 
53
    
 
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) */
 
60
 
 
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) */
 
67
    
 
68
    // mathematical compositions
 
69
    wxCOMPOSITION_ADD, /* R = S + D */
 
70
};
 
71
 
 
72
// Turn off the aquisition of the Global Interpreter Lock for the classes and
 
73
// functions in this file
 
74
%threadWrapperOff
 
75
 
 
76
 
 
77
//---------------------------------------------------------------------------
 
78
//---------------------------------------------------------------------------
 
79
 
 
80
%{
 
81
#if !wxUSE_GRAPHICS_CONTEXT
 
82
// C++ stub classes for platforms or build configurations that don't have
 
83
// wxGraphicsContext yet.
 
84
 
 
85
enum wxAntialiasMode
 
86
{
 
87
    wxANTIALIAS_NONE, // should be 0
 
88
    wxANTIALIAS_DEFAULT,
 
89
};
 
90
 
 
91
enum wxInterpolationQuality
 
92
{
 
93
    // default interpolation
 
94
    wxINTERPOLATION_DEFAULT,
 
95
    // no interpolation
 
96
    wxINTERPOLATION_NONE, 
 
97
    // fast interpolation, suited for interactivity
 
98
    wxINTERPOLATION_FAST,
 
99
    // better quality
 
100
    wxINTERPOLATION_GOOD,
 
101
    // best quality, not suited for interactivity
 
102
    wxINTERPOLATION_BEST
 
103
};
 
104
 
 
105
enum wxCompositionMode
 
106
{
 
107
    // R = Result, S = Source, D = Destination, premultiplied with alpha
 
108
    // Ra, Sa, Da their alpha components
 
109
    
 
110
    // classic Porter-Duff compositions
 
111
    // http://keithp.com/~keithp/porterduff/p253-porter.pdf
 
112
    
 
113
    wxCOMPOSITION_INVALID,
 
114
 
 
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) */
 
121
 
 
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) */
 
128
    
 
129
    // mathematical compositions
 
130
    wxCOMPOSITION_ADD, /* R = S + D */
 
131
};
 
132
    
 
133
class wxGraphicsRenderer;
 
134
class wxGraphicsMatrix;
 
135
 
 
136
 
 
137
class wxGraphicsObject : public wxObject
 
138
{
 
139
public :
 
140
    wxGraphicsObject() {}
 
141
    wxGraphicsObject( wxGraphicsRenderer*  ) {
 
142
        PyErr_SetString(PyExc_NotImplementedError,
 
143
                        "wx.GraphicsObject is not available on this platform.");
 
144
    }
 
145
    wxGraphicsObject( const wxGraphicsObject&  ) {}
 
146
    virtual ~wxGraphicsObject() {}
 
147
    bool IsNull() const { return false; }
 
148
    wxGraphicsRenderer* GetRenderer() const { return NULL; }
 
149
} ;
 
150
 
 
151
 
 
152
 
 
153
class wxGraphicsPen : public wxGraphicsObject
 
154
{
 
155
public:
 
156
    wxGraphicsPen()  {}
 
157
    virtual ~wxGraphicsPen() {}
 
158
} ;
 
159
wxGraphicsPen wxNullGraphicsPen;
 
160
 
 
161
 
 
162
 
 
163
class wxGraphicsBrush : public wxGraphicsObject
 
164
{
 
165
public :
 
166
    wxGraphicsBrush() {}
 
167
    virtual ~wxGraphicsBrush() {}
 
168
} ;
 
169
wxGraphicsBrush wxNullGraphicsBrush;
 
170
 
 
171
 
 
172
 
 
173
class wxGraphicsFont : public wxGraphicsObject
 
174
{
 
175
public :
 
176
    wxGraphicsFont() {}
 
177
    virtual ~wxGraphicsFont() {}
 
178
} ;
 
179
wxGraphicsFont wxNullGraphicsFont;
 
180
 
 
181
 
 
182
class wxGraphicsBitmap : public wxGraphicsObject
 
183
{
 
184
public :
 
185
    wxGraphicsBitmap() {}
 
186
    virtual ~wxGraphicsBitmap() {}
 
187
} ;
 
188
wxGraphicsBitmap wxNullGraphicsBitmap;
 
189
 
 
190
 
 
191
 
 
192
class wxGraphicsPath : public wxGraphicsObject
 
193
{
 
194
public :
 
195
    wxGraphicsPath() { }
 
196
    wxGraphicsPath(wxGraphicsRenderer* ) {
 
197
        PyErr_SetString(PyExc_NotImplementedError,
 
198
                        "wx.GraphicsPath is not available on this platform.");
 
199
    }
 
200
    virtual ~wxGraphicsPath() {}
 
201
 
 
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 ) {}
 
214
 
 
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 )  {}
 
219
 
 
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); }
 
227
 
 
228
    bool Contains( wxDouble , wxDouble , wxPolygonFillMode ) const { return false; }
 
229
    bool Contains( const wxPoint2DDouble& , wxPolygonFillMode ) const { return false; }
 
230
};
 
231
wxGraphicsPath wxNullGraphicsPath;
 
232
 
 
233
 
 
234
class wxGraphicsMatrix : public wxGraphicsObject
 
235
{
 
236
public :
 
237
    wxGraphicsMatrix() { }
 
238
    wxGraphicsMatrix(wxGraphicsRenderer* ) {
 
239
        PyErr_SetString(PyExc_NotImplementedError,
 
240
                        "wx.GraphicsMatrix is not available on this platform.");
 
241
    }
 
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; }
 
258
};
 
259
wxGraphicsMatrix wxNullGraphicsMatrix;
 
260
 
 
261
 
 
262
class wxGraphicsGradientStop
 
263
{
 
264
public:
 
265
    wxGraphicsGradientStop(wxColour col = wxTransparentColour,
 
266
                           float pos = 0.0) {} 
 
267
    ~wxGraphicsGradientStop() {}
 
268
    
 
269
    const wxColour& GetColour() const { return wxNullColour; }
 
270
    void SetColour(const wxColour& col) {}
 
271
 
 
272
    float GetPosition() const { return 0.0; }
 
273
    void SetPosition(float pos) {}
 
274
};
 
275
 
 
276
class wxGraphicsGradientStops
 
277
{
 
278
public:
 
279
    wxGraphicsGradientStops(wxColour, wxColour) {}
 
280
    ~wxGraphicsGradientStops() {}
 
281
    
 
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; }
 
290
};
 
291
 
 
292
 
 
293
 
 
294
class wxGraphicsContext : public wxGraphicsObject
 
295
{
 
296
public:
 
297
 
 
298
    wxGraphicsContext(wxGraphicsRenderer* ) {
 
299
        PyErr_SetString(PyExc_NotImplementedError,
 
300
                        "wx.GraphicsContext is not available on this platform.");
 
301
    }
 
302
 
 
303
    virtual ~wxGraphicsContext() {}
 
304
 
 
305
    static wxGraphicsContext* Create()   {
 
306
        PyErr_SetString(PyExc_NotImplementedError,
 
307
                        "wx.GraphicsContext is not available on this platform.");
 
308
        return NULL;
 
309
    }
 
310
 
 
311
    static wxGraphicsContext* Create( const wxEnhMetaFileDC& )  {
 
312
        PyErr_SetString(PyExc_NotImplementedError,
 
313
                        "wx.GraphicsContext is not available on this platform.");
 
314
        return NULL;
 
315
    }
 
316
 
 
317
    static wxGraphicsContext* Create( const wxWindowDC& )  {
 
318
        PyErr_SetString(PyExc_NotImplementedError,
 
319
                        "wx.GraphicsContext is not available on this platform.");
 
320
        return NULL;
 
321
    }
 
322
 
 
323
    static wxGraphicsContext * Create( const wxMemoryDC& dc) {
 
324
        PyErr_SetString(PyExc_NotImplementedError,
 
325
                        "wx.GraphicsContext is not available on this platform.");
 
326
        return NULL;
 
327
    }
 
328
 
 
329
    static wxGraphicsContext * Create( const wxPrinterDC& dc) {
 
330
        PyErr_SetString(PyExc_NotImplementedError,
 
331
                        "wx.GraphicsContext is not available on this platform.");
 
332
        return NULL;
 
333
    }
 
334
 
 
335
    static wxGraphicsContext* CreateFromNative( void *  )  {
 
336
        PyErr_SetString(PyExc_NotImplementedError,
 
337
                        "wx.GraphicsContext is not available on this platform.");
 
338
        return NULL;
 
339
    }
 
340
 
 
341
    static wxGraphicsContext* CreateFromNativeWindow( void *  )  {
 
342
        PyErr_SetString(PyExc_NotImplementedError,
 
343
                        "wx.GraphicsContext is not available on this platform.");
 
344
        return NULL;
 
345
    }
 
346
 
 
347
    static wxGraphicsContext* Create( wxWindow*  )  {
 
348
        PyErr_SetString(PyExc_NotImplementedError,
 
349
                        "wx.GraphicsContext is not available on this platform.");
 
350
        return NULL;
 
351
    }
 
352
 
 
353
    static wxGraphicsContext* Create(wxImage& ) {
 
354
        PyErr_SetString(PyExc_NotImplementedError,
 
355
                        "wx.GraphicsContext is not available on this platform.");
 
356
        return NULL;
 
357
    }
 
358
    
 
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() {}
 
366
 
 
367
    wxGraphicsPath CreatePath()  { return wxNullGraphicsPath; }
 
368
 
 
369
    virtual wxGraphicsPen CreatePen(const wxPen& )  { return wxNullGraphicsPen; }
 
370
 
 
371
    virtual wxGraphicsBrush CreateBrush(const wxBrush& ) { return wxNullGraphicsBrush; }
 
372
 
 
373
    wxGraphicsBrush CreateLinearGradientBrush(
 
374
        wxDouble , wxDouble , wxDouble , wxDouble ,
 
375
        const wxColour&, const wxColour&) const { return wxNullGraphicsBrush; }
 
376
    wxGraphicsBrush
 
377
    CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
 
378
                              wxDouble x2, wxDouble y2,
 
379
                              const wxGraphicsGradientStops& stops) const
 
380
         { return wxNullGraphicsBrush; }
 
381
 
 
382
    wxGraphicsBrush
 
383
    CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
 
384
                              wxDouble xc, wxDouble yc, wxDouble radius,
 
385
                              const wxColour &oColor, const wxColour &cColor) const
 
386
        { return wxNullGraphicsBrush; }
 
387
    
 
388
    wxGraphicsBrush
 
389
    CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
 
390
                              wxDouble xc, wxDouble yc, wxDouble radius,
 
391
                              const wxGraphicsGradientStops& stops) const
 
392
         { return wxNullGraphicsBrush; }
 
393
 
 
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; }
 
399
 
 
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; }
 
403
    
 
404
    virtual wxGraphicsMatrix CreateMatrix( wxDouble, wxDouble, wxDouble, wxDouble,
 
405
                                            wxDouble, wxDouble)  { return wxNullGraphicsMatrix; }
 
406
 
 
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; }
 
415
 
 
416
    virtual wxInterpolationQuality GetInterpolationQuality() const { return wxINTERPOLATION_DEFAULT; }
 
417
    virtual bool SetInterpolationQuality(wxInterpolationQuality) { return false; };
 
418
 
 
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* );
 
423
    
 
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; }
 
430
 
 
431
    virtual void SetPen( const wxGraphicsPen& ) {}
 
432
    void SetPen( const wxPen& ) {}
 
433
 
 
434
    virtual void SetBrush( const wxGraphicsBrush& ) {}
 
435
    void SetBrush( const wxBrush& ) {}
 
436
 
 
437
    virtual void SetFont( const wxGraphicsFont& ) {}
 
438
    void SetFont( const wxFont&, const wxColour& ) {}
 
439
 
 
440
    virtual void StrokePath( const wxGraphicsPath & ) {}
 
441
    virtual void FillPath( const wxGraphicsPath &, wxPolygonFillMode ) {}
 
442
    virtual void DrawPath( const wxGraphicsPath &, wxPolygonFillMode ) {}
 
443
 
 
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  {}
 
451
 
 
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  )  {}
 
455
 
 
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; }
 
464
 
 
465
    virtual void EnableOffset(bool enable = true) {}
 
466
    void DisableOffset() { }
 
467
    bool OffsetEnabled() { return false; }
 
468
  
 
469
};
 
470
 
 
471
 
 
472
class wxGraphicsRenderer : public wxObject
 
473
{
 
474
public :
 
475
    wxGraphicsRenderer() {
 
476
        PyErr_SetString(PyExc_NotImplementedError,
 
477
                        "wx.GraphicsRenderer is not available on this platform.");
 
478
    }
 
479
 
 
480
    virtual ~wxGraphicsRenderer() {}
 
481
 
 
482
    static wxGraphicsRenderer* GetDefaultRenderer() {
 
483
        PyErr_SetString(PyExc_NotImplementedError,
 
484
                        "wx.GraphicsRenderer is not available on this platform.");
 
485
        return NULL;
 
486
    }
 
487
    static wxGraphicsRenderer* GetCairoRenderer() {
 
488
        PyErr_SetString(PyExc_NotImplementedError,
 
489
                        "wx.GraphicsRenderer is not available on this platform.");
 
490
        return NULL;
 
491
    }   
 
492
 
 
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; }
 
502
 
 
503
    virtual wxGraphicsPath CreatePath()  { return wxNullGraphicsPath; }
 
504
 
 
505
    virtual wxGraphicsMatrix CreateMatrix( wxDouble , wxDouble , wxDouble , wxDouble ,
 
506
                                             wxDouble , wxDouble ) { return wxNullGraphicsMatrix; }
 
507
 
 
508
    virtual wxGraphicsPen CreatePen(const wxPen& )  { return wxNullGraphicsPen; }
 
509
    virtual wxGraphicsBrush CreateBrush(const wxBrush&  )  { return wxNullGraphicsBrush; }
 
510
 
 
511
    wxGraphicsBrush
 
512
    CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
 
513
                              wxDouble x2, wxDouble y2,
 
514
                              const wxGraphicsGradientStops& stops) const
 
515
    { return wxNullGraphicsBrush; }
 
516
    
 
517
    wxGraphicsBrush
 
518
    CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
 
519
                              wxDouble xc, wxDouble yc, wxDouble radius,
 
520
                              const wxGraphicsGradientStops& stops) const
 
521
    { return wxNullGraphicsBrush; }
 
522
 
 
523
    virtual wxGraphicsFont CreateFont( const wxFont & , const wxColour & ) { return wxNullGraphicsFont; }
 
524
    virtual wxGraphicsFont CreateFont(double,
 
525
                                      const wxString&,
 
526
                                      int flags,
 
527
                                      const wxColour&)  { return wxNullGraphicsFont; }
 
528
 
 
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; }
 
532
};
 
533
 
 
534
 
 
535
 
 
536
class wxGCDC: public wxDC
 
537
{
 
538
public:
 
539
    wxGCDC(const wxWindowDC&)
 
540
        : wxDC(NULL)
 
541
    {
 
542
        wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
543
        PyErr_SetString(PyExc_NotImplementedError,
 
544
                        "wxGCDC is not available on this platform.");
 
545
        wxPyEndBlockThreads(blocked);
 
546
     }
 
547
 
 
548
    wxGCDC(const wxMemoryDC&)
 
549
        : wxDC(NULL)
 
550
    {
 
551
        wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
552
        PyErr_SetString(PyExc_NotImplementedError,
 
553
                        "wxGCDC is not available on this platform.");
 
554
        wxPyEndBlockThreads(blocked);
 
555
     }
 
556
 
 
557
    wxGCDC(const wxPrinterDC& dc)
 
558
        : wxDC(NULL)
 
559
    {
 
560
        wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
561
        PyErr_SetString(PyExc_NotImplementedError,
 
562
                        "wxGCDC is not available on this platform.");
 
563
        wxPyEndBlockThreads(blocked);
 
564
     }
 
565
 
 
566
    wxGCDC(wxGraphicsContext*&)
 
567
        : wxDC(NULL)
 
568
    {
 
569
        wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
570
        PyErr_SetString(PyExc_NotImplementedError,
 
571
                        "wxGCDC is not available on this platform.");
 
572
        wxPyEndBlockThreads(blocked);
 
573
     }
 
574
    
 
575
    wxGCDC(const wxGraphicsContext& ctx)
 
576
        : wxDC(NULL)
 
577
    {
 
578
        wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
579
        PyErr_SetString(PyExc_NotImplementedError,
 
580
                        "wxGCDC is not available on this platform.");
 
581
        wxPyEndBlockThreads(blocked);
 
582
     }
 
583
 
 
584
    wxGCDC()
 
585
        : wxDC(NULL)
 
586
    {
 
587
        wxPyBlock_t blocked = wxPyBeginBlockThreads();
 
588
        PyErr_SetString(PyExc_NotImplementedError,
 
589
                        "wxGCDC is not available on this platform.");
 
590
        wxPyEndBlockThreads(blocked);
 
591
    }
 
592
 
 
593
    virtual ~wxGCDC() {}
 
594
 
 
595
    wxGraphicsContext* GetGraphicsContext() const { return NULL; }
 
596
    void SetGraphicsContext( wxGraphicsContext* ) {}
 
597
    void Flush() {}
 
598
};
 
599
 
 
600
#endif
 
601
%}
 
602
 
 
603
//---------------------------------------------------------------------------
 
604
//---------------------------------------------------------------------------
 
605
//---------------------------------------------------------------------------
 
606
 
 
607
 
 
608
%typemap(in) (size_t points, wxPoint2D* points_array ) {
 
609
    $2 = wxPoint2D_LIST_helper($input, &$1);
 
610
    if ($2 == NULL) SWIG_fail;
 
611
}
 
612
%typemap(freearg) (size_t points, wxPoint2D* points_array ) {
 
613
    if ($2) delete [] $2;
 
614
}
 
615
 
 
616
 
 
617
 
 
618
MustHaveApp(wxGraphicsPath);
 
619
MustHaveApp(wxGraphicsContext);
 
620
MustHaveApp(wxGCDC);
 
621
 
 
622
//---------------------------------------------------------------------------
 
623
 
 
624
 
 
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
 
630
{
 
631
public :
 
632
    wxGraphicsObject( wxGraphicsRenderer* renderer = NULL );
 
633
    virtual ~wxGraphicsObject();
 
634
    
 
635
    DocDeclStr(
 
636
        bool , IsNull() const ,
 
637
        "Is this object valid (false) or still empty (true)?", "");
 
638
    
 
639
    DocDeclStr(
 
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.", "");
 
643
    
 
644
};
 
645
 
 
646
 
 
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
 
652
instance.", "");
 
653
class wxGraphicsPen : public wxGraphicsObject
 
654
{
 
655
public :
 
656
    wxGraphicsPen();
 
657
    virtual ~wxGraphicsPen();
 
658
};
 
659
 
 
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
 
667
{
 
668
public :
 
669
    wxGraphicsBrush();
 
670
    virtual ~wxGraphicsBrush();
 
671
};
 
672
 
 
673
 
 
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
 
680
{
 
681
public :
 
682
    wxGraphicsFont();
 
683
    virtual ~wxGraphicsFont();
 
684
};
 
685
 
 
686
 
 
687
DocStr(wxGraphicsBitmap,
 
688
"", "");
 
689
class wxGraphicsBitmap : public wxGraphicsObject
 
690
{
 
691
public :
 
692
    wxGraphicsBitmap();
 
693
    virtual ~wxGraphicsBitmap();
 
694
};
 
695
 
 
696
 
 
697
//---------------------------------------------------------------------------
 
698
 
 
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
 
705
{
 
706
public :
 
707
//    wxGraphicsMatrix(); 
 
708
    virtual ~wxGraphicsMatrix();
 
709
 
 
710
    DocDeclStr(
 
711
        virtual void , Concat( const wxGraphicsMatrix& t ),
 
712
        "Concatenates the passed in matrix to the current matrix.", "");
 
713
 
 
714
 
 
715
    DocDeclStr(
 
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.)", "");
 
720
 
 
721
    
 
722
    DocDeclAStr(
 
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.", "");
 
727
    
 
728
 
 
729
    DocDeclStr(
 
730
        virtual void , Invert(),
 
731
        "Inverts the matrix.", "");
 
732
 
 
733
 
 
734
    DocDeclStr(
 
735
        virtual bool , IsEqual( const wxGraphicsMatrix& t) const,
 
736
        "Returns ``True`` if the elements of the transformation matrix are
 
737
equal", "");
 
738
 
 
739
 
 
740
    DocDeclStr(
 
741
        virtual bool , IsIdentity() const,
 
742
        "Returns ``True`` if this is the identity matrix", "");
 
743
 
 
744
 
 
745
    DocDeclStr(
 
746
        virtual void , Translate( wxDouble dx , wxDouble dy ),
 
747
        "Add a translation to this matrix.", "");
 
748
 
 
749
 
 
750
    DocDeclStr(
 
751
        virtual void , Scale( wxDouble xScale , wxDouble yScale ),
 
752
        "Scales this matrix.", "");
 
753
 
 
754
 
 
755
    DocDeclStr(
 
756
        virtual void , Rotate( wxDouble angle ),
 
757
        "Rotates this matrix.  The angle should be specified in radians.", "");
 
758
 
 
759
 
 
760
    DocDeclAStr(
 
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", "");
 
764
 
 
765
 
 
766
    DocDeclAStr(
 
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
 
770
translations)", "");
 
771
 
 
772
 
 
773
    DocDeclStr(
 
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.", "");
 
779
};
 
780
 
 
781
//---------------------------------------------------------------------------
 
782
 
 
783
class wxGraphicsPath : public wxGraphicsObject
 
784
{
 
785
public :
 
786
//    wxGraphicsPath();
 
787
    virtual ~wxGraphicsPath();
 
788
 
 
789
 
 
790
    %nokwargs MoveToPoint;
 
791
    DocStr(MoveToPoint,
 
792
           "Begins a new subpath at the specified point.", "");
 
793
    virtual void  MoveToPoint( wxDouble x, wxDouble y );
 
794
    void MoveToPoint( const wxPoint2D& p);
 
795
 
 
796
 
 
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);
 
802
 
 
803
 
 
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);
 
812
 
 
813
 
 
814
 
 
815
    DocDeclStr(
 
816
        virtual void , AddPath( const wxGraphicsPath& path ),
 
817
        "Adds another path", "");
 
818
 
 
819
 
 
820
    DocDeclStr(
 
821
        virtual void , CloseSubpath(),
 
822
        "Closes the current sub-path.", "");
 
823
 
 
824
 
 
825
    DocDeclStr(
 
826
        wxPoint2D , GetCurrentPoint() const,
 
827
        "Gets the last point of the current path, (0,0) if not yet set", "");
 
828
 
 
829
 
 
830
    %nokwargs AddArc;
 
831
    DocStr(AddArc,
 
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);
 
837
 
 
838
 
 
839
    DocDeclStr(
 
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", "");
 
843
 
 
844
 
 
845
    DocDeclStr(
 
846
        virtual void , AddRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h ),
 
847
        "Appends a rectangle as a new closed subpath.", "");
 
848
 
 
849
 
 
850
    DocDeclStr(
 
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.", "");
 
853
 
 
854
 
 
855
    DocDeclStr(
 
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)", "");
 
859
 
 
860
 
 
861
    DocDeclStr(
 
862
        virtual void , AddEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h),
 
863
        "Appends an ellipse fitting into the passed in rectangle.", "");
 
864
 
 
865
 
 
866
    DocDeclStr(
 
867
        virtual void , AddRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius),
 
868
        "Appends a rounded rectangle.", "");
 
869
 
 
870
 
 
871
    DocDeclStr(
 
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.", "");
 
876
 
 
877
 
 
878
    DocDeclStr(
 
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).", "");
 
883
 
 
884
 
 
885
    DocDeclStr(
 
886
        virtual void , Transform( const wxGraphicsMatrix& matrix ),
 
887
        "Transforms each point of this path by the matrix", "");
 
888
 
 
889
 
 
890
    DocDeclStr(
 
891
        wxRect2D , GetBox() const,
 
892
        "Gets the bounding box enclosing all points (possibly including control
 
893
points)", "");
 
894
 
 
895
 
 
896
    %nokwargs Contains;
 
897
    DocStr(Contains,
 
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;
 
901
 
 
902
};
 
903
 
 
904
 
 
905
//---------------------------------------------------------------------------
 
906
 
 
907
%immutable;
 
908
const wxGraphicsPen     wxNullGraphicsPen;
 
909
const wxGraphicsBrush   wxNullGraphicsBrush;
 
910
const wxGraphicsFont    wxNullGraphicsFont;
 
911
const wxGraphicsBitmap  wxNullGraphicsBitmap;
 
912
const wxGraphicsMatrix  wxNullGraphicsMatrix;
 
913
const wxGraphicsPath    wxNullGraphicsPath;
 
914
%mutable;
 
915
 
 
916
//---------------------------------------------------------------------------
 
917
 
 
918
// Describes a single gradient stop.
 
919
class wxGraphicsGradientStop
 
920
{
 
921
public:
 
922
    wxGraphicsGradientStop(wxColour col = wxTransparentColour,
 
923
                           float pos = 0.0);
 
924
    ~wxGraphicsGradientStop();
 
925
    
 
926
    const wxColour& GetColour() const;
 
927
    void SetColour(const wxColour& col);
 
928
 
 
929
    float GetPosition() const;
 
930
    void SetPosition(float pos);
 
931
 
 
932
    %property(Position, GetPosition, SetPosition);
 
933
    %property(Colour, GetColour, SetColour);
 
934
};
 
935
 
 
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
 
939
// colour.
 
940
class wxGraphicsGradientStops
 
941
{
 
942
public:
 
943
    wxGraphicsGradientStops(wxColour startCol = wxTransparentColour,
 
944
                            wxColour endCol = wxTransparentColour);
 
945
    ~wxGraphicsGradientStops();
 
946
 
 
947
    // Add a stop in correct order.
 
948
    %nokwargs Add;
 
949
    void Add(const wxGraphicsGradientStop& stop);
 
950
    void Add(wxColour col, float pos);
 
951
 
 
952
    // Get the number of stops.
 
953
    unsigned GetCount();
 
954
 
 
955
    // Return the stop at the given index (which must be valid).
 
956
    wxGraphicsGradientStop Item(unsigned n) const;
 
957
 
 
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;
 
963
 
 
964
    %extend {
 
965
        unsigned __len__()
 
966
            { return self->GetCount(); }
 
967
        wxGraphicsGradientStop __getitem__(unsigned n)
 
968
            { return self->Item(n); }
 
969
    }
 
970
 
 
971
    %property(Count, GetCount);
 
972
    %property(StartColour, GetStartColour, SetStartColour);
 
973
    %property(EndColour, GetEndColour, SetEndColour);
 
974
};
 
975
 
 
976
 
 
977
 
 
978
//---------------------------------------------------------------------------
 
979
 
 
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.", "");
 
986
 
 
987
class wxGraphicsContext : public wxGraphicsObject
 
988
{
 
989
public:
 
990
    //wxGraphicsContext();         This is an ABC, use Create to make an instance...
 
991
    virtual ~wxGraphicsContext();
 
992
 
 
993
    %newobject Create;
 
994
    %nokwargs Create;
 
995
    %pythonAppend Create
 
996
        "val.__dc = args[0] # save a ref so the dc will not be deleted before self";
 
997
    DocStr(Create,
 
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) ;
 
1003
#ifdef __WXMSW__
 
1004
    static wxGraphicsContext* Create( const wxMetaFileDC& dc) ;
 
1005
    static wxGraphicsContext* Create( const wxEnhMetaFileDC& dc) ;
 
1006
#endif
 
1007
    static wxGraphicsContext* Create(wxImage& );
 
1008
    
 
1009
    %pythonAppend Create "";
 
1010
    DocDeclStrName(
 
1011
        static wxGraphicsContext* , Create(),
 
1012
        "Create a lightwieght context that can be used for measuring text only.", "",
 
1013
        CreateMeasuringContext);
 
1014
    
 
1015
    %newobject CreateFromNative;
 
1016
    DocDeclStr(
 
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.", "");
 
1022
    
 
1023
 
 
1024
    %newobject CreateFromNativeWindow;
 
1025
    DocDeclStr(
 
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.", "");
 
1029
    
 
1030
 
 
1031
    DocDeclStr(
 
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", "");
 
1035
    
 
1036
    
 
1037
    DocDeclStr(
 
1038
        virtual void , EndDoc(),
 
1039
        "Done with that document (relevant only for printing / pdf etc) ", "");
 
1040
    
 
1041
 
 
1042
    DocDeclStr(
 
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)
 
1046
", "");
 
1047
    
 
1048
    
 
1049
    DocDeclStr(
 
1050
        virtual void , EndPage(),
 
1051
        "Ends the current page  (relevant only for printing / pdf etc) ", "");
 
1052
    
 
1053
    
 
1054
    DocDeclStr(
 
1055
        virtual void , Flush(),
 
1056
        "Make sure that the current content of this context is immediately visible", "");
 
1057
    
 
1058
    DocDeclStr(
 
1059
        virtual wxGraphicsPath , CreatePath(),
 
1060
        "Creates a native graphics path which is initially empty.", "");
 
1061
 
 
1062
 
 
1063
    DocDeclStr(
 
1064
        virtual wxGraphicsPen , CreatePen(const wxPen& pen),
 
1065
        "Creates a native pen from a `wx.Pen`.", "");
 
1066
 
 
1067
 
 
1068
    DocDeclStr(
 
1069
        virtual wxGraphicsBrush , CreateBrush(const wxBrush& brush ),
 
1070
        "Creates a native brush from a `wx.Brush`.", "");
 
1071
 
 
1072
 
 
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;
 
1077
    wxGraphicsBrush 
 
1078
    CreateLinearGradientBrush( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2,
 
1079
                               const wxColour& c1, const wxColour& c2) const;
 
1080
    wxGraphicsBrush
 
1081
    CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
 
1082
                              wxDouble x2, wxDouble y2,
 
1083
                              const wxGraphicsGradientStops& stops) const;
 
1084
 
 
1085
    
 
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;
 
1091
    wxGraphicsBrush 
 
1092
    CreateRadialGradientBrush( wxDouble xo, wxDouble yo,
 
1093
                               wxDouble xc, wxDouble yc, wxDouble radius,
 
1094
                               const wxColour &oColor, const wxColour &cColor) const;
 
1095
    wxGraphicsBrush
 
1096
    CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
 
1097
                              wxDouble xc, wxDouble yc, wxDouble radius,
 
1098
                              const wxGraphicsGradientStops& stops) const;
 
1099
 
 
1100
 
 
1101
    %nokwargs CreateFont;   
 
1102
    DocDeclStr(
 
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.", "");
 
1105
 
 
1106
    virtual wxGraphicsFont CreateFont(double sizeInPixels,
 
1107
                                      const wxString& facename,
 
1108
                                      int flags = wxFONTFLAG_DEFAULT,
 
1109
                                      const wxColour& col = *wxBLACK) const;
 
1110
 
 
1111
    DocDeclStr(
 
1112
        virtual wxGraphicsBitmap , CreateBitmap( const wxBitmap &bitmap ) const,
 
1113
        "Create a native bitmap representation.", "");
 
1114
 
 
1115
    wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image) const;
 
1116
 
 
1117
    
 
1118
    DocDeclStr(
 
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.", "");
 
1121
    
 
1122
 
 
1123
    DocDeclStr(
 
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.", "");
 
1129
 
 
1130
 
 
1131
 
 
1132
    DocDeclStr(
 
1133
        virtual void , PushState(),
 
1134
        "Push the current state of the context, (ie the transformation matrix)
 
1135
on a stack", "");
 
1136
 
 
1137
 
 
1138
    DocDeclStr(
 
1139
        virtual void , PopState(),
 
1140
        "Pops a stored state from the stack", "");
 
1141
 
 
1142
 
 
1143
    DocDeclStrName(
 
1144
        virtual void , Clip( const wxRegion &region ),
 
1145
        "Clips drawings to the region intersected with the current clipping region.", "",
 
1146
        ClipRegion);
 
1147
 
 
1148
    
 
1149
    DocDeclStr(
 
1150
        virtual void , Clip( wxDouble x, wxDouble y, wxDouble w, wxDouble h ),
 
1151
        "Clips drawings to the rectangle intersected with the current clipping region..", "");
 
1152
 
 
1153
 
 
1154
    DocDeclStr(
 
1155
        virtual void , ResetClip(),
 
1156
        "Resets the clipping to original shape.", "");
 
1157
 
 
1158
 
 
1159
    DocDeclStr(
 
1160
        virtual void * , GetNativeContext(),
 
1161
        "Returns the native context (CGContextRef for Core Graphics, Graphics
 
1162
pointer for GDIPlus and cairo_t pointer for cairo).", "");
 
1163
 
 
1164
    
 
1165
    DocDeclStr(
 
1166
        virtual wxAntialiasMode , GetAntialiasMode() const,
 
1167
        "Returns the current shape antialiasing mode", "");
 
1168
    
 
1169
    DocDeclStr(
 
1170
        virtual bool , SetAntialiasMode(wxAntialiasMode antialias),
 
1171
        "Sets the antialiasing mode, returns true if it is supported", "");
 
1172
    
 
1173
    // returns the current interpolation quality
 
1174
    virtual wxInterpolationQuality GetInterpolationQuality() const;
 
1175
    
 
1176
    // sets the interpolation quality, returns true if it supported
 
1177
    virtual bool SetInterpolationQuality(wxInterpolationQuality interpolation);
 
1178
 
 
1179
    DocDeclStr(
 
1180
        virtual wxCompositionMode , GetCompositionMode() const,
 
1181
        "Returns the current compositing operator", "");
 
1182
    
 
1183
    
 
1184
    DocDeclStr(
 
1185
        virtual bool , SetCompositionMode(wxCompositionMode op),
 
1186
        "Sets the compositing operator, returns True if it supported", "");
 
1187
 
 
1188
    
 
1189
    DocDeclAStr(
 
1190
        virtual void , GetSize( wxDouble* OUTPUT, wxDouble* OUTPUT),
 
1191
        "GetSize(self) --> (width, height)",
 
1192
        "Returns the size of the graphics context in device coordinates", "");
 
1193
    
 
1194
 
 
1195
    DocDeclAStr(
 
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", "");
 
1199
    
 
1200
 
 
1201
    DocDeclStr(
 
1202
        virtual void , BeginLayer(wxDouble opacity),
 
1203
        "all rendering is done into a fully transparent temporary context", "");
 
1204
    
 
1205
 
 
1206
    DocDeclStr(
 
1207
        virtual void , EndLayer(),
 
1208
        "composites back the drawings into the context with the opacity given
 
1209
at the BeginLayer call", "");
 
1210
    
 
1211
    
 
1212
 
 
1213
    DocDeclStr(
 
1214
        virtual void , Translate( wxDouble dx , wxDouble dy ),
 
1215
        "Translates the current transformation matrix.", "");
 
1216
 
 
1217
 
 
1218
    DocDeclStr(
 
1219
        virtual void , Scale( wxDouble xScale , wxDouble yScale ),
 
1220
        "Scale the current transformation matrix of the context.", "");
 
1221
 
 
1222
 
 
1223
    DocDeclStr(
 
1224
        virtual void , Rotate( wxDouble angle ),
 
1225
        "Rotate the current transformation matrix of the context.  ``angle`` is
 
1226
specified in radians.", "");
 
1227
 
 
1228
 
 
1229
    DocDeclStr(
 
1230
        virtual void , ConcatTransform( const wxGraphicsMatrix& matrix ),
 
1231
        "Concatenates the passed in transform with the current transform of
 
1232
this context.", "");
 
1233
    
 
1234
 
 
1235
    DocDeclStr(
 
1236
        virtual void , SetTransform( const wxGraphicsMatrix& matrix ),
 
1237
        "Sets the current transform of this context.", "");
 
1238
    
 
1239
 
 
1240
    DocDeclStr(
 
1241
        virtual wxGraphicsMatrix , GetTransform() const,
 
1242
        "Gets the current transformation matrix of this context.", "");
 
1243
        
 
1244
 
 
1245
 
 
1246
    DocStr(SetPen, "Sets the stroke pen", "");
 
1247
    %nokwargs SetPen;
 
1248
    virtual void SetPen( const wxGraphicsPen& pen );
 
1249
    void SetPen( const wxPen& pen );
 
1250
 
 
1251
    
 
1252
    DocStr(SetBrush, "Sets the brush for filling", "");
 
1253
    %nokwargs SetBrush;
 
1254
    virtual void SetBrush( const wxGraphicsBrush& brush );
 
1255
    void SetBrush( const wxBrush& brush );
 
1256
 
 
1257
    
 
1258
    DocStr(SetFont, "Sets the font", "");
 
1259
    %nokwargs SetFont;
 
1260
    virtual void SetFont( const wxGraphicsFont& font );
 
1261
    void SetFont( const wxFont& font, const wxColour& colour = *wxBLACK);
 
1262
 
 
1263
    
 
1264
   
 
1265
    DocDeclStr(
 
1266
        virtual void , StrokePath( const wxGraphicsPath& path ),
 
1267
        "Strokes along a path with the current pen.", "");
 
1268
 
 
1269
    
 
1270
    DocDeclStr(
 
1271
        virtual void , FillPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ),
 
1272
        "Fills a path with the current brush.", "");
 
1273
 
 
1274
   
 
1275
    DocDeclStr(
 
1276
        virtual void , DrawPath( const wxGraphicsPath& path, wxPolygonFillMode fillStyle = wxODDEVEN_RULE ),
 
1277
        "Draws the path by first filling and then stroking.", "");
 
1278
 
 
1279
 
 
1280
    %extend {
 
1281
        DocStr(DrawText,
 
1282
               "Draws a text string at the defined position.", "");
 
1283
        void DrawText( const wxString &str, wxDouble x, wxDouble y,
 
1284
                       const wxGraphicsBrush& backgroundBrush = wxNullGraphicsBrush )
 
1285
        {
 
1286
            if ( !backgroundBrush.IsNull() )
 
1287
                self->DrawText(str, x, y, backgroundBrush);
 
1288
            else
 
1289
                self->DrawText(str, x, y);
 
1290
        }
 
1291
 
 
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 )
 
1297
        {
 
1298
            if ( !backgroundBrush.IsNull() )
 
1299
                self->DrawText(str, x, y, angle, backgroundBrush);
 
1300
            else
 
1301
                self->DrawText(str, x, y, angle);
 
1302
        }
 
1303
    }
 
1304
   
 
1305
 
 
1306
 
 
1307
    DocDeclAStrName(
 
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).", "",
 
1320
        GetFullTextExtent);
 
1321
 
 
1322
    %extend {
 
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.", "");
 
1328
 
 
1329
        PyObject* GetTextExtent( const wxString &text )
 
1330
        {
 
1331
            wxDouble width = 0.0,
 
1332
                     height = 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));
 
1338
            return rv;
 
1339
        }
 
1340
    }
 
1341
 
 
1342
 
 
1343
    %extend {
 
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);
 
1351
            return widths;
 
1352
        }
 
1353
    }
 
1354
 
 
1355
 
 
1356
    %nokwargs DrawBitmap;
 
1357
    DocStr(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.", "");
 
1360
#ifndef __WXGTK__
 
1361
    virtual void DrawBitmap( const wxGraphicsBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h );
 
1362
#endif
 
1363
    virtual void DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDouble y, wxDouble w, wxDouble h );    
 
1364
 
 
1365
 
 
1366
    DocDeclStr(
 
1367
        virtual void , DrawIcon( const wxIcon &icon, wxDouble x, wxDouble y, wxDouble w, wxDouble h ),
 
1368
        "Draws the icon.", "");
 
1369
 
 
1370
 
 
1371
 
 
1372
    DocDeclStr(
 
1373
        virtual void , StrokeLine( wxDouble x1, wxDouble y1, wxDouble x2, wxDouble y2),
 
1374
        "Strokes a single line.", "");
 
1375
 
 
1376
    
 
1377
    DocDeclAStr(
 
1378
        virtual void , StrokeLines( size_t points, const wxPoint2D *points_array),
 
1379
        "StrokeLines(self, List points)",
 
1380
        "Stroke lines connecting each of the points", "");
 
1381
 
 
1382
 
 
1383
    %extend {
 
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)
 
1388
        {
 
1389
            size_t c1, c2, count;
 
1390
            wxPoint2D* beginP = wxPoint2D_LIST_helper(beginPoints, &c1);
 
1391
            wxPoint2D* endP =   wxPoint2D_LIST_helper(endPoints, &c2);
 
1392
 
 
1393
            if ( beginP != NULL && endP != NULL )
 
1394
            {
 
1395
                count = wxMin(c1, c2);
 
1396
                self->StrokeLines(count, beginP, endP);
 
1397
            }
 
1398
            delete [] beginP;
 
1399
            delete [] endP;
 
1400
        }
 
1401
    }
 
1402
 
 
1403
 
 
1404
    DocDeclStr(
 
1405
        virtual void , DrawLines( size_t points, const wxPoint2D *points_array,
 
1406
                                  wxPolygonFillMode fillStyle = wxODDEVEN_RULE ),
 
1407
        "Draws a polygon.", "");
 
1408
 
 
1409
 
 
1410
    DocDeclStr(
 
1411
        virtual void , DrawRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h),
 
1412
        "Draws a rectangle.", "");
 
1413
 
 
1414
 
 
1415
    DocDeclStr(
 
1416
        virtual void , DrawEllipse( wxDouble x, wxDouble y, wxDouble w, wxDouble h),
 
1417
        "Draws an ellipse.", "");
 
1418
 
 
1419
 
 
1420
    DocDeclStr(
 
1421
        virtual void , DrawRoundedRectangle( wxDouble x, wxDouble y, wxDouble w, wxDouble h, wxDouble radius),
 
1422
        "Draws a rounded rectangle", "");
 
1423
 
 
1424
    
 
1425
 
 
1426
    DocDeclStr(
 
1427
        virtual bool , ShouldOffset() const,
 
1428
        "helper to determine if a 0.5 offset should be applied for the drawing operation", "");
 
1429
 
 
1430
 
 
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; }
 
1436
      
 
1437
};
 
1438
 
 
1439
 
 
1440
//---------------------------------------------------------------------------
 
1441
 
 
1442
class wxGraphicsRenderer : public wxObject
 
1443
{
 
1444
public :
 
1445
    // wxGraphicsRenderer();  This is an ABC, use GetDefaultRenderer
 
1446
 
 
1447
    virtual ~wxGraphicsRenderer();
 
1448
 
 
1449
    static wxGraphicsRenderer* GetDefaultRenderer();
 
1450
    static wxGraphicsRenderer* GetCairoRenderer();
 
1451
 
 
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 );
 
1458
#ifdef __WXMSW__
 
1459
    virtual wxGraphicsContext * CreateContext( const wxMetaFileDC& dc) ;
 
1460
    virtual wxGraphicsContext * CreateContext( const wxEnhMetaFileDC& dc) ;
 
1461
#endif
 
1462
 
 
1463
    virtual wxGraphicsContext * CreateContextFromImage(wxImage& image);
 
1464
    
 
1465
    // create a context that can be used for measuring texts only, no drawing allowed
 
1466
    virtual wxGraphicsContext * CreateMeasuringContext();
 
1467
    
 
1468
    %newobject CreateContextFromNativeContext;
 
1469
    virtual wxGraphicsContext * CreateContextFromNativeContext( void * context );
 
1470
 
 
1471
    %newobject CreateContextFromNativeWindow;
 
1472
    virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window );
 
1473
 
 
1474
 
 
1475
    virtual wxGraphicsPath CreatePath();
 
1476
 
 
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);
 
1479
        
 
1480
    virtual wxGraphicsPen CreatePen(const wxPen& pen) ;
 
1481
    
 
1482
    virtual wxGraphicsBrush CreateBrush(const wxBrush& brush ) ;
 
1483
    
 
1484
    wxGraphicsBrush
 
1485
    CreateLinearGradientBrush(wxDouble x1, wxDouble y1,
 
1486
                              wxDouble x2, wxDouble y2,
 
1487
                              const wxGraphicsGradientStops& stops);
 
1488
    
 
1489
    wxGraphicsBrush
 
1490
    CreateRadialGradientBrush(wxDouble xo, wxDouble yo,
 
1491
                              wxDouble xc, wxDouble yc, wxDouble radius,
 
1492
                              const wxGraphicsGradientStops& stops);
 
1493
 
 
1494
 
 
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);
 
1500
 
 
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  );
 
1504
};
 
1505
 
 
1506
 
 
1507
 
 
1508
//---------------------------------------------------------------------------
 
1509
 
 
1510
%{
 
1511
#include "wx/dcgraph.h"
 
1512
%}
 
1513
 
 
1514
class wxGCDC: public wxDC
 
1515
{
 
1516
public:
 
1517
    %nokwargs wxGCDC;
 
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);
 
1524
 
 
1525
    %disownarg( wxGraphicsContext* ctx );
 
1526
    wxGCDC(wxGraphicsContext* ctx);
 
1527
    %cleardisown( wxGraphicsContext* ctx );
 
1528
    
 
1529
    //wxGCDC();
 
1530
    virtual ~wxGCDC();
 
1531
 
 
1532
    wxGraphicsContext* GetGraphicsContext() const; 
 
1533
 
 
1534
    %disownarg( wxGraphicsContext* ctx );
 
1535
    virtual void SetGraphicsContext( wxGraphicsContext* ctx );
 
1536
    %cleardisown( wxGraphicsContext* ctx );
 
1537
 
 
1538
    %property(GraphicsContext, GetGraphicsContext, SetGraphicsContext);
 
1539
};
 
1540
 
 
1541
 
 
1542
//---------------------------------------------------------------------------
 
1543
 
 
1544
// Turn GIL acquisition back on.
 
1545
%threadWrapperOn
 
1546