1//---------------------------------------------------------------------------
2// This file is generated by wxPython's SIP generator.  Do not edit by hand.
3//
4// Copyright: (c) 2018 by Total Control Software
5// License:   wxWindows License
6//
7// This file will be included by _core.sip
8//
9//---------------------------------------------------------------------------
10
11%ModuleHeaderCode
12#include <wx/gdicmn.h>
13typedef wxPoint2DDouble wxPoint2D;
14typedef wxRect2DDouble wxRect2D;
15%End
16
17
18//---------------------------------------------------------------------------
19
20enum wxAntialiasMode
21{
22    wxANTIALIAS_NONE,
23    wxANTIALIAS_DEFAULT
24};
25
26enum wxInterpolationQuality
27{
28    wxINTERPOLATION_DEFAULT,
29    wxINTERPOLATION_NONE,
30    wxINTERPOLATION_FAST,
31    wxINTERPOLATION_GOOD,
32    wxINTERPOLATION_BEST
33};
34
35enum wxCompositionMode
36{
37    wxCOMPOSITION_INVALID,
38    wxCOMPOSITION_CLEAR,
39    wxCOMPOSITION_SOURCE,
40    wxCOMPOSITION_OVER,
41    wxCOMPOSITION_IN,
42    wxCOMPOSITION_OUT,
43    wxCOMPOSITION_ATOP,
44    wxCOMPOSITION_DEST,
45    wxCOMPOSITION_DEST_OVER,
46    wxCOMPOSITION_DEST_IN,
47    wxCOMPOSITION_DEST_OUT,
48    wxCOMPOSITION_DEST_ATOP,
49    wxCOMPOSITION_XOR,
50    wxCOMPOSITION_ADD
51};
52
53class wxGraphicsObject : wxObject
54{
55    %Docstring
56        This class is the superclass of native graphics objects like pens etc.
57    %End
58    %TypeHeaderCode
59        #include <wx/graphics.h>
60    %End
61
62public:
63    wxGraphicsRenderer * GetRenderer() const;
64    %Docstring
65        GetRenderer() -> GraphicsRenderer
66
67        Returns the renderer that was used to create this instance, or NULL if
68        it has not been initialized yet.
69    %End
70
71    bool IsNull() const;
72    %Docstring
73        IsNull() -> bool
74    %End
75
76    bool IsOk();
77    %Docstring
78        IsOk() -> bool
79    %End
80    %MethodCode
81        PyErr_Clear();
82        Py_BEGIN_ALLOW_THREADS
83        sipRes = _wxGraphicsObject_IsOk(sipCpp);
84        Py_END_ALLOW_THREADS
85        if (PyErr_Occurred()) sipIsErr = 1;
86    %End
87    %TypeCode
88    bool _wxGraphicsObject_IsOk(wxGraphicsObject* self)
89    {
90        return !self->IsNull();
91    }
92    %End
93
94    int __nonzero__();
95    %Docstring
96        __nonzero__() -> int
97    %End
98    %MethodCode
99        PyErr_Clear();
100        Py_BEGIN_ALLOW_THREADS
101        sipRes = _wxGraphicsObject___nonzero__(sipCpp);
102        Py_END_ALLOW_THREADS
103        if (PyErr_Occurred()) sipIsErr = 1;
104    %End
105    %TypeCode
106    int _wxGraphicsObject___nonzero__(wxGraphicsObject* self)
107    {
108        return !self->IsNull();
109    }
110    %End
111
112    int __bool__();
113    %Docstring
114        __bool__() -> int
115    %End
116    %MethodCode
117        PyErr_Clear();
118        Py_BEGIN_ALLOW_THREADS
119        sipRes = _wxGraphicsObject___bool__(sipCpp);
120        Py_END_ALLOW_THREADS
121        if (PyErr_Occurred()) sipIsErr = 1;
122    %End
123    %TypeCode
124    int _wxGraphicsObject___bool__(wxGraphicsObject* self)
125    {
126        return !self->IsNull();
127    }
128    %End
129
130    public:
131
132
133    %Property(name=Renderer, get=GetRenderer)
134};  // end of class wxGraphicsObject
135
136
137class wxGraphicsBitmap : wxGraphicsObject
138{
139    %Docstring
140        GraphicsBitmap()
141
142        Represents a bitmap.
143    %End
144    %TypeHeaderCode
145        #include <wx/graphics.h>
146    %End
147
148public:
149    wxGraphicsBitmap();
150
151    wxImage ConvertToImage() const;
152    %Docstring
153        ConvertToImage() -> Image
154
155        Return the contents of this bitmap as wxImage.
156    %End
157
158    void * GetNativeBitmap() const;
159    %Docstring
160        GetNativeBitmap() -> void
161
162        Return the pointer to the native bitmap data.
163    %End
164
165    public:
166
167
168    %Property(name=NativeBitmap, get=GetNativeBitmap)
169};  // end of class wxGraphicsBitmap
170
171
172class wxGraphicsBrush : wxGraphicsObject
173{
174    %Docstring
175        A wxGraphicsBrush is a native representation of a brush.
176    %End
177    %TypeHeaderCode
178        #include <wx/graphics.h>
179    %End
180
181public:
182};  // end of class wxGraphicsBrush
183
184
185class wxGraphicsFont : wxGraphicsObject
186{
187    %Docstring
188        A wxGraphicsFont is a native representation of a font.
189    %End
190    %TypeHeaderCode
191        #include <wx/graphics.h>
192    %End
193
194public:
195};  // end of class wxGraphicsFont
196
197
198class wxGraphicsPen : wxGraphicsObject
199{
200    %Docstring
201        A wxGraphicsPen is a native representation of a pen.
202    %End
203    %TypeHeaderCode
204        #include <wx/graphics.h>
205    %End
206
207public:
208};  // end of class wxGraphicsPen
209
210
211class wxGraphicsContext : wxGraphicsObject   /Abstract/
212{
213    %Docstring
214        A wxGraphicsContext instance is the object that is drawn upon.
215    %End
216    %TypeHeaderCode
217        #include <wx/graphics.h>
218    %End
219
220    %TypeCode
221        // Convert a Python sequence of wxPoint2D objects, or items that can be converted
222        // to wxPoint2D into a C array of wxPoint2D instances.
223        static
224        wxPoint2D* wxPoint2D_array_helper(PyObject* source, size_t *count)
225        {
226            wxPoint2D* array;
227            Py_ssize_t idx, len;
228            wxPyThreadBlocker blocker;
229
230            // ensure that it is a sequence
231            if (! PySequence_Check(source))
232                goto error0;
233            // ensure it is not a string or unicode object (they are sequences too)
234            else if (PyBytes_Check(source) || PyUnicode_Check(source))
235                goto error0;
236            // ensure each item can be converted to wxPoint2D
237            else {
238                len = PySequence_Length(source);
239                for (idx=0; idx<len; idx++) {
240                    PyObject* item = PySequence_ITEM(source, idx);
241                    if (!sipCanConvertToType(item, sipType_wxPoint2DDouble, SIP_NOT_NONE)) {
242                        Py_DECREF(item);
243                        goto error0;
244                    }
245                    Py_DECREF(item);
246                }
247            }
248
249            // The length of the sequence is returned in count.
250            *count = len;
251            array = new wxPoint2D[*count];
252            if (!array) {
253                PyErr_SetString(PyExc_MemoryError, "Unable to allocate temporary array");
254                return NULL;
255            }
256            for (idx=0; idx<len; idx++) {
257                PyObject* obj = PySequence_ITEM(source, idx);
258                int state = 0;
259                int err = 0;
260                wxPoint2D* item = reinterpret_cast<wxPoint2D*>(
261                                sipConvertToType(obj, sipType_wxPoint2DDouble, NULL, 0, &state, &err));
262                array[idx] = *item;
263                sipReleaseType((void*)item, sipType_wxPoint2DDouble, state); // delete temporary instances
264                Py_DECREF(obj);
265            }
266            return array;
267
268        error0:
269            PyErr_SetString(PyExc_TypeError, "Expected a sequence of length-2 sequences or wx.Point2D objects.");
270            return NULL;
271        }
272    %End
273public:
274    wxGraphicsBrush CreateLinearGradientBrush(
275        wxDouble x1,
276        wxDouble y1,
277        wxDouble x2,
278        wxDouble y2,
279        const wxColour & c1,
280        const wxColour & c2
281    ) const;
282    %Docstring
283        CreateLinearGradientBrush(x1, y1, x2, y2, c1, c2) -> GraphicsBrush
284        CreateLinearGradientBrush(x1, y1, x2, y2, stops) -> GraphicsBrush
285
286        Creates a native brush with a linear gradient.
287    %End
288
289    wxGraphicsBrush CreateLinearGradientBrush(
290        wxDouble x1,
291        wxDouble y1,
292        wxDouble x2,
293        wxDouble y2,
294        const wxGraphicsGradientStops & stops
295    ) const;
296
297    wxGraphicsBrush CreateRadialGradientBrush(
298        wxDouble xo,
299        wxDouble yo,
300        wxDouble xc,
301        wxDouble yc,
302        wxDouble radius,
303        const wxColour & oColor,
304        const wxColour & cColor
305    ) const;
306    %Docstring
307        CreateRadialGradientBrush(xo, yo, xc, yc, radius, oColor, cColor) -> GraphicsBrush
308        CreateRadialGradientBrush(xo, yo, xc, yc, radius, stops) -> GraphicsBrush
309
310        Creates a native brush with a radial gradient.
311    %End
312
313    wxGraphicsBrush CreateRadialGradientBrush(
314        wxDouble xo,
315        wxDouble yo,
316        wxDouble xc,
317        wxDouble yc,
318        wxDouble radius,
319        const wxGraphicsGradientStops & stops
320    );
321
322    void DrawBitmap(
323        const wxGraphicsBitmap & bmp,
324        wxDouble x,
325        wxDouble y,
326        wxDouble w,
327        wxDouble h
328    );
329    %Docstring
330        DrawBitmap(bmp, x, y, w, h)
331        DrawBitmap(bmp, x, y, w, h)
332
333        Draws the bitmap.
334    %End
335
336    void DrawBitmap(
337        const wxBitmap & bmp,
338        wxDouble x,
339        wxDouble y,
340        wxDouble w,
341        wxDouble h
342    );
343
344    static
345    wxGraphicsContext * Create(
346        wxWindow * window
347    )   /Factory/;
348    %Docstring
349        Create(window) -> GraphicsContext
350        Create(windowDC) -> GraphicsContext
351        Create(memoryDC) -> GraphicsContext
352        Create(printerDC) -> GraphicsContext
353        Create(metaFileDC) -> GraphicsContext
354        Create(image) -> GraphicsContext
355        Create() -> GraphicsContext
356        Create(autoPaintDC) -> GraphicsContext
357
358        Creates a wxGraphicsContext from a wxWindow.
359    %End
360
361    static
362    wxGraphicsContext * Create(
363        const wxWindowDC & windowDC   /KeepReference/
364    )   /Factory/;
365
366    static
367    wxGraphicsContext * Create(
368        const wxMemoryDC & memoryDC   /KeepReference/
369    )   /Factory/;
370
371    static
372    wxGraphicsContext * Create(
373        const wxPrinterDC & printerDC   /KeepReference/
374    )   /Factory/;
375
376    static
377    wxGraphicsContext * Create(
378        const wxMetafileDC& metaFileDC   /KeepReference/
379    )   /Factory/;
380    %MethodCode
381        PyErr_Clear();
382        Py_BEGIN_ALLOW_THREADS
383        sipRes = _wxGraphicsContext_Create(metaFileDC);
384        Py_END_ALLOW_THREADS
385        if (PyErr_Occurred()) sipIsErr = 1;
386    %End
387    %TypeCode
388    wxGraphicsContext * _wxGraphicsContext_Create(const wxMetafileDC* metaFileDC)
389    {
390        #ifdef __WXMSW__
391        #if wxUSE_ENH_METAFILE
392            return wxGraphicsContext::Create(*metaFileDC);
393        #endif
394        #endif
395            wxPyRaiseNotImplemented();
396            return NULL;
397    }
398    %End
399
400    static
401    wxGraphicsContext * Create(
402        wxImage & image   /KeepReference/
403    )   /Factory/;
404
405    static
406    wxGraphicsContext * Create()   /Factory/;
407
408    static wxGraphicsContext* Create(wxAutoBufferedPaintDC* autoPaintDC /KeepReference/)   /Factory/;
409    %MethodCode
410        PyErr_Clear();
411        Py_BEGIN_ALLOW_THREADS
412        sipRes = _wxGraphicsContext_Create(autoPaintDC);
413        Py_END_ALLOW_THREADS
414        if (PyErr_Occurred()) sipIsErr = 1;
415    %End
416    %TypeCode
417    wxGraphicsContext* _wxGraphicsContext_Create(wxAutoBufferedPaintDC* autoPaintDC )
418    {
419        return wxGraphicsContext::Create(*autoPaintDC);
420    }
421    %End
422
423    static
424    wxGraphicsContext * CreateFromNative(
425        void * context
426    )   /Factory/;
427    %Docstring
428        CreateFromNative(context) -> GraphicsContext
429
430        Creates a wxGraphicsContext from a native context.
431    %End
432
433    static
434    wxGraphicsContext * CreateFromNativeWindow(
435        void * window
436    )   /Factory/;
437    %Docstring
438        CreateFromNativeWindow(window) -> GraphicsContext
439
440        Creates a wxGraphicsContext from a native window.
441    %End
442
443    void Clip(
444        const wxRegion & region
445    );
446    %Docstring
447        Clip(region)
448        Clip(x, y, w, h)
449
450        Clips drawings to the specified region.
451    %End
452
453    void Clip(
454        wxDouble x,
455        wxDouble y,
456        wxDouble w,
457        wxDouble h
458    );
459
460    void ConcatTransform(
461        const wxGraphicsMatrix & matrix
462    );
463    %Docstring
464        ConcatTransform(matrix)
465
466        Concatenates the passed in transform with the current transform of
467        this context.
468    %End
469
470    wxGraphicsBitmap CreateBitmap(
471        const wxBitmap & bitmap
472    );
473    %Docstring
474        CreateBitmap(bitmap) -> GraphicsBitmap
475
476        Creates wxGraphicsBitmap from an existing wxBitmap.
477    %End
478
479    wxGraphicsBitmap CreateBitmapFromImage(
480        const wxImage & image
481    );
482    %Docstring
483        CreateBitmapFromImage(image) -> GraphicsBitmap
484
485        Creates wxGraphicsBitmap from an existing wxImage.
486    %End
487
488    wxGraphicsBitmap CreateSubBitmap(
489        const wxGraphicsBitmap & bitmap,
490        wxDouble x,
491        wxDouble y,
492        wxDouble w,
493        wxDouble h
494    );
495    %Docstring
496        CreateSubBitmap(bitmap, x, y, w, h) -> GraphicsBitmap
497
498        Extracts a sub-bitmap from an existing bitmap.
499    %End
500
501    wxGraphicsBrush CreateBrush(
502        const wxBrush & brush
503    ) const;
504    %Docstring
505        CreateBrush(brush) -> GraphicsBrush
506
507        Creates a native brush from a wxBrush.
508    %End
509
510    wxGraphicsFont CreateFont(
511        const wxFont & font,
512        const wxColour & col = *wxBLACK
513    ) const;
514    %Docstring
515        CreateFont(font, col=BLACK) -> GraphicsFont
516        CreateFont(sizeInPixels, facename, flags=FONTFLAG_DEFAULT, col=BLACK) -> GraphicsFont
517
518        Creates a native graphics font from a wxFont and a text colour.
519    %End
520
521    wxGraphicsFont CreateFont(
522        double sizeInPixels,
523        const wxString & facename,
524        int flags = wxFONTFLAG_DEFAULT,
525        const wxColour & col = *wxBLACK
526    ) const;
527
528    wxGraphicsMatrix CreateMatrix(
529        wxDouble a = 1.0,
530        wxDouble b = 0.0,
531        wxDouble c = 0.0,
532        wxDouble d = 1.0,
533        wxDouble tx = 0.0,
534        wxDouble ty = 0.0
535    ) const;
536    %Docstring
537        CreateMatrix(a=1.0, b=0.0, c=0.0, d=1.0, tx=0.0, ty=0.0) -> GraphicsMatrix
538        CreateMatrix(mat) -> GraphicsMatrix
539
540        Creates a native affine transformation matrix from the passed in
541        values.
542    %End
543
544    wxGraphicsMatrix CreateMatrix(
545        const wxAffineMatrix2DBase & mat
546    ) const;
547
548    wxGraphicsPath CreatePath() const;
549    %Docstring
550        CreatePath() -> GraphicsPath
551
552        Creates a native graphics path which is initially empty.
553    %End
554
555    wxGraphicsPen CreatePen(
556        const wxPen & pen
557    ) const;
558    %Docstring
559        CreatePen(pen) -> GraphicsPen
560
561        Creates a native pen from a wxPen.
562    %End
563
564    void DrawEllipse(
565        wxDouble x,
566        wxDouble y,
567        wxDouble w,
568        wxDouble h
569    );
570    %Docstring
571        DrawEllipse(x, y, w, h)
572
573        Draws an ellipse.
574    %End
575
576    void DrawIcon(
577        const wxIcon & icon,
578        wxDouble x,
579        wxDouble y,
580        wxDouble w,
581        wxDouble h
582    );
583    %Docstring
584        DrawIcon(icon, x, y, w, h)
585
586        Draws the icon.
587    %End
588
589    void DrawLines(PyObject* points,  wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
590    %Docstring
591        DrawLines(point2Ds, fillStyle=ODDEVEN_RULE)
592
593        Draws a polygon.
594    %End
595    %MethodCode
596        PyErr_Clear();
597        Py_BEGIN_ALLOW_THREADS
598        _wxGraphicsContext_DrawLines(sipCpp, points, fillStyle);
599        Py_END_ALLOW_THREADS
600        if (PyErr_Occurred()) sipIsErr = 1;
601    %End
602    %TypeCode
603    void _wxGraphicsContext_DrawLines(wxGraphicsContext* self, PyObject* points, wxPolygonFillMode fillStyle)
604    {
605        size_t count;
606        wxPoint2D* ptsArray = wxPoint2D_array_helper(points, &count);
607
608        if ( ptsArray != NULL ) {
609            self->DrawLines(count, ptsArray, fillStyle);
610            delete [] ptsArray;
611        }
612    }
613    %End
614
615    void DrawPath(
616        const wxGraphicsPath & path,
617        wxPolygonFillMode fillStyle = wxODDEVEN_RULE
618    );
619    %Docstring
620        DrawPath(path, fillStyle=ODDEVEN_RULE)
621
622        Draws the path by first filling and then stroking.
623    %End
624
625    void DrawRectangle(
626        wxDouble x,
627        wxDouble y,
628        wxDouble w,
629        wxDouble h
630    );
631    %Docstring
632        DrawRectangle(x, y, w, h)
633
634        Draws a rectangle.
635    %End
636
637    void DrawRoundedRectangle(
638        wxDouble x,
639        wxDouble y,
640        wxDouble w,
641        wxDouble h,
642        wxDouble radius
643    );
644    %Docstring
645        DrawRoundedRectangle(x, y, w, h, radius)
646
647        Draws a rounded rectangle.
648    %End
649
650    void DrawText(
651        const wxString & str,
652        wxDouble x,
653        wxDouble y
654    );
655    %Docstring
656        DrawText(str, x, y)
657        DrawText(str, x, y, angle)
658        DrawText(str, x, y, backgroundBrush)
659        DrawText(str, x, y, angle, backgroundBrush)
660
661        Draws text at the defined position.
662    %End
663
664    void DrawText(
665        const wxString & str,
666        wxDouble x,
667        wxDouble y,
668        wxDouble angle
669    );
670
671    void DrawText(
672        const wxString & str,
673        wxDouble x,
674        wxDouble y,
675        const wxGraphicsBrush & backgroundBrush
676    );
677
678    void DrawText(
679        const wxString & str,
680        wxDouble x,
681        wxDouble y,
682        wxDouble angle,
683        const wxGraphicsBrush & backgroundBrush
684    );
685
686    void FillPath(
687        const wxGraphicsPath & path,
688        wxPolygonFillMode fillStyle = wxODDEVEN_RULE
689    );
690    %Docstring
691        FillPath(path, fillStyle=ODDEVEN_RULE)
692
693        Fills the path with the current brush.
694    %End
695
696    void * GetNativeContext();
697    %Docstring
698        GetNativeContext() -> void
699
700        Returns the native context (CGContextRef for Core Graphics, Graphics
701        pointer for GDIPlus and cairo_t pointer for cairo).
702    %End
703
704    wxArrayDouble* GetPartialTextExtents(
705        const wxString & text
706    ) const   /Factory/;
707    %Docstring
708        GetPartialTextExtents(text) -> ArrayDouble
709
710        Fills the widths array with the widths from the beginning of text to
711        the corresponding character of text.
712    %End
713    %MethodCode
714        PyErr_Clear();
715        Py_BEGIN_ALLOW_THREADS
716        sipRes = _wxGraphicsContext_GetPartialTextExtents(sipCpp, text);
717        Py_END_ALLOW_THREADS
718        if (PyErr_Occurred()) sipIsErr = 1;
719    %End
720    %TypeCode
721    wxArrayDouble* _wxGraphicsContext_GetPartialTextExtents(const wxGraphicsContext* self, const wxString *text)
722    {
723        wxArrayDouble rval;
724        self->GetPartialTextExtents(*text, rval);
725        return new wxArrayDouble(rval);
726    }
727    %End
728
729    void GetTextExtent(
730        const wxString & text,
731        wxDouble * width   /Out/,
732        wxDouble * height   /Out/,
733        wxDouble * descent   /Out/,
734        wxDouble * externalLeading   /Out/
735    ) const   /PyName=GetFullTextExtent/;
736    %Docstring
737        GetFullTextExtent(text) -> (width, height, descent, externalLeading)
738        GetTextExtent(text) -> (width, height)
739
740        Gets the dimensions of the string using the currently selected font.
741    %End
742
743    PyObject* GetTextExtent(const wxString& text);
744    %MethodCode
745        PyErr_Clear();
746        Py_BEGIN_ALLOW_THREADS
747        sipRes = _wxGraphicsContext_GetTextExtent(sipCpp, text);
748        Py_END_ALLOW_THREADS
749        if (PyErr_Occurred()) sipIsErr = 1;
750    %End
751    %TypeCode
752    PyObject* _wxGraphicsContext_GetTextExtent(wxGraphicsContext* self, const wxString* text)
753    {
754        wxDouble width = 0.0, height = 0.0;
755        self->GetTextExtent(*text, &width, &height, NULL, NULL);
756        wxPyThreadBlocker blocker;
757        return sipBuildResult(0, "(dd)", width, height);
758    }
759    %End
760
761    wxGraphicsMatrix GetTransform() const;
762    %Docstring
763        GetTransform() -> GraphicsMatrix
764
765        Gets the current transformation matrix of this context.
766    %End
767
768    void ResetClip();
769    %Docstring
770        ResetClip()
771
772        Resets the clipping to original shape.
773    %End
774
775    void Rotate(
776        wxDouble angle
777    );
778    %Docstring
779        Rotate(angle)
780
781        Rotates the current transformation matrix (in radians).
782    %End
783
784    void Scale(
785        wxDouble xScale,
786        wxDouble yScale
787    );
788    %Docstring
789        Scale(xScale, yScale)
790
791        Scales the current transformation matrix.
792    %End
793
794    void SetBrush(
795        const wxBrush & brush
796    );
797    %Docstring
798        SetBrush(brush)
799        SetBrush(brush)
800
801        Sets the brush for filling paths.
802    %End
803
804    void SetBrush(
805        const wxGraphicsBrush & brush
806    );
807
808    void SetFont(
809        const wxFont & font,
810        const wxColour & colour
811    );
812    %Docstring
813        SetFont(font, colour)
814        SetFont(font)
815
816        Sets the font for drawing text.
817    %End
818
819    void SetFont(
820        const wxGraphicsFont & font
821    );
822
823    void SetPen(
824        const wxPen & pen
825    );
826    %Docstring
827        SetPen(pen)
828        SetPen(pen)
829
830        Sets the pen used for stroking.
831    %End
832
833    void SetPen(
834        const wxGraphicsPen & pen
835    );
836
837    void SetTransform(
838        const wxGraphicsMatrix & matrix
839    );
840    %Docstring
841        SetTransform(matrix)
842
843        Sets the current transformation matrix of this context.
844    %End
845
846    void StrokeLine(
847        wxDouble x1,
848        wxDouble y1,
849        wxDouble x2,
850        wxDouble y2
851    );
852    %Docstring
853        StrokeLine(x1, y1, x2, y2)
854
855        Strokes a single line.
856    %End
857
858    void StrokeLines(PyObject* points);
859    %Docstring
860        StrokeLines(point2Ds)
861
862        Stroke lines conencting all the points.
863    %End
864    %MethodCode
865        PyErr_Clear();
866        Py_BEGIN_ALLOW_THREADS
867        _wxGraphicsContext_StrokeLines(sipCpp, points);
868        Py_END_ALLOW_THREADS
869        if (PyErr_Occurred()) sipIsErr = 1;
870    %End
871    %TypeCode
872    void _wxGraphicsContext_StrokeLines(wxGraphicsContext* self, PyObject* points)
873    {
874        size_t count;
875        wxPoint2D* ptsArray = wxPoint2D_array_helper(points, &count);
876
877        if ( ptsArray != NULL ) {
878            self->StrokeLines(count, ptsArray);
879            delete [] ptsArray;
880        }
881    }
882    %End
883
884    void StrokePath(
885        const wxGraphicsPath & path
886    );
887    %Docstring
888        StrokePath(path)
889
890        Strokes along a path with the current pen.
891    %End
892
893    void Translate(
894        wxDouble dx,
895        wxDouble dy
896    );
897    %Docstring
898        Translate(dx, dy)
899
900        Translates the current transformation matrix.
901    %End
902
903    void BeginLayer(
904        wxDouble opacity
905    );
906    %Docstring
907        BeginLayer(opacity)
908
909        Redirects all rendering is done into a fully transparent temporary
910        context.
911    %End
912
913    void EndLayer();
914    %Docstring
915        EndLayer()
916
917        Composites back the drawings into the context with the opacity given
918        at the BeginLayer call.
919    %End
920
921    bool SetAntialiasMode(
922        wxAntialiasMode antialias
923    );
924    %Docstring
925        SetAntialiasMode(antialias) -> bool
926
927        Sets the antialiasing mode, returns true if it supported.
928    %End
929
930    wxAntialiasMode GetAntialiasMode() const;
931    %Docstring
932        GetAntialiasMode() -> AntialiasMode
933
934        Returns the current shape antialiasing mode.
935    %End
936
937    bool SetInterpolationQuality(
938        wxInterpolationQuality interpolation
939    );
940    %Docstring
941        SetInterpolationQuality(interpolation) -> bool
942
943        Sets the interpolation quality, returns true if it is supported.
944    %End
945
946    wxInterpolationQuality GetInterpolationQuality() const;
947    %Docstring
948        GetInterpolationQuality() -> InterpolationQuality
949
950        Returns the current interpolation quality.
951    %End
952
953    bool SetCompositionMode(
954        wxCompositionMode op
955    );
956    %Docstring
957        SetCompositionMode(op) -> bool
958
959        Sets the compositing operator, returns true if it supported.
960    %End
961
962    wxCompositionMode GetCompositionMode() const;
963    %Docstring
964        GetCompositionMode() -> CompositionMode
965
966        Returns the current compositing operator.
967    %End
968
969    void PushState();
970    %Docstring
971        PushState()
972
973        Push the current state of the context's transformation matrix on a
974        stack.
975    %End
976
977    void PopState();
978    %Docstring
979        PopState()
980
981        Pops a stored state from the stack and sets the current transformation
982        matrix to that state.
983    %End
984
985    bool ShouldOffset() const;
986    %Docstring
987        ShouldOffset() -> bool
988    %End
989
990    void EnableOffset(
991        bool enable = true
992    );
993    %Docstring
994        EnableOffset(enable=True)
995    %End
996
997    void DisableOffset();
998    %Docstring
999        DisableOffset()
1000    %End
1001
1002    bool OffsetEnabled();
1003    %Docstring
1004        OffsetEnabled() -> bool
1005    %End
1006
1007    bool StartDoc(
1008        const wxString & message
1009    );
1010    %Docstring
1011        StartDoc(message) -> bool
1012
1013        Begin a new document (relevant only for printing / pdf etc.) If there
1014        is a progress dialog, message will be shown.
1015    %End
1016
1017    void EndDoc();
1018    %Docstring
1019        EndDoc()
1020
1021        Done with that document (relevant only for printing / pdf etc.)
1022    %End
1023
1024    void StartPage(
1025        wxDouble width = 0,
1026        wxDouble height = 0
1027    );
1028    %Docstring
1029        StartPage(width=0, height=0)
1030
1031        Opens a new page (relevant only for printing / pdf etc.) with the
1032        given size in points.
1033    %End
1034
1035    void EndPage();
1036    %Docstring
1037        EndPage()
1038
1039        Ends the current page (relevant only for printing / pdf etc.)
1040    %End
1041
1042    void Flush();
1043    %Docstring
1044        Flush()
1045
1046        Make sure that the current content of this context is immediately
1047        visible.
1048    %End
1049
1050    void GetSize(
1051        wxDouble * width   /Out/,
1052        wxDouble * height   /Out/
1053    ) const;
1054    %Docstring
1055        GetSize() -> (width, height)
1056
1057        Returns the size of the graphics context in device coordinates.
1058    %End
1059
1060    void GetDPI(
1061        wxDouble * dpiX   /Out/,
1062        wxDouble * dpiY   /Out/
1063    );
1064    %Docstring
1065        GetDPI() -> (dpiX, dpiY)
1066
1067        Returns the resolution of the graphics context in device points per
1068        inch.
1069    %End
1070
1071    void StrokeLineSegments(PyObject* beginPoints,  PyObject* endPoints);
1072    %Docstring
1073        StrokeLineSegments(beginPoint2Ds, endPoint2Ds)
1074
1075        Stroke disconnected lines from begin to end points.
1076    %End
1077    %MethodCode
1078        PyErr_Clear();
1079        Py_BEGIN_ALLOW_THREADS
1080        _wxGraphicsContext_StrokeLineSegments(sipCpp, beginPoints, endPoints);
1081        Py_END_ALLOW_THREADS
1082        if (PyErr_Occurred()) sipIsErr = 1;
1083    %End
1084    %TypeCode
1085    void _wxGraphicsContext_StrokeLineSegments(wxGraphicsContext* self, PyObject* beginPoints, PyObject* endPoints)
1086    {
1087        size_t c1, c2, count;
1088        wxPoint2D* beginP = wxPoint2D_array_helper(beginPoints, &c1);
1089        wxPoint2D* endP =   wxPoint2D_array_helper(endPoints, &c2);
1090
1091        if ( beginP != NULL && endP != NULL ) {
1092            count = wxMin(c1, c2);
1093            self->StrokeLines(count, beginP, endP);
1094        }
1095        delete [] beginP;
1096        delete [] endP;
1097    }
1098    %End
1099
1100    public:
1101
1102
1103    %Property(name=AntialiasMode, get=GetAntialiasMode, set=SetAntialiasMode)
1104    %Property(name=CompositionMode, get=GetCompositionMode, set=SetCompositionMode)
1105    %Property(name=InterpolationQuality, get=GetInterpolationQuality, set=SetInterpolationQuality)
1106    %Property(name=NativeContext, get=GetNativeContext)
1107    %Property(name=TextExtent, get=GetTextExtent)
1108    %Property(name=Transform, get=GetTransform, set=SetTransform)
1109};  // end of class wxGraphicsContext
1110
1111
1112%Extract(id=pycode_core)
1113GraphicsContext.DrawRotatedText = wx.deprecated(GraphicsContext.DrawText, 'Use DrawText instead.')
1114
1115%End
1116
1117class wxGraphicsGradientStop
1118{
1119    %Docstring
1120        GraphicsGradientStop(col=TransparentColour, pos=0.)
1121
1122        Represents a single gradient stop in a collection of gradient stops as
1123        represented by wxGraphicsGradientStops.
1124    %End
1125    %TypeHeaderCode
1126        #include <wx/graphics.h>
1127    %End
1128
1129public:
1130    wxGraphicsGradientStop(
1131        wxColour col = wxTransparentColour,
1132        float pos = 0.
1133    );
1134
1135    const wxColour & GetColour() const;
1136    %Docstring
1137        GetColour() -> Colour
1138
1139        Return the stop colour.
1140    %End
1141
1142    void SetColour(
1143        const wxColour & col
1144    );
1145    %Docstring
1146        SetColour(col)
1147
1148        Change the stop colour.
1149    %End
1150
1151    float GetPosition() const;
1152    %Docstring
1153        GetPosition() -> float
1154
1155        Return the stop position.
1156    %End
1157
1158    void SetPosition(
1159        float pos
1160    );
1161    %Docstring
1162        SetPosition(pos)
1163
1164        Change the stop position.
1165    %End
1166
1167    public:
1168
1169
1170    %Property(name=Colour, get=GetColour, set=SetColour)
1171    %Property(name=Position, get=GetPosition, set=SetPosition)
1172};  // end of class wxGraphicsGradientStop
1173
1174
1175class wxGraphicsGradientStops
1176{
1177    %Docstring
1178        GraphicsGradientStops(startCol=TransparentColour, endCol=TransparentColour)
1179
1180        Represents a collection of wxGraphicGradientStop values for use with
1181        CreateLinearGradientBrush and CreateRadialGradientBrush.
1182    %End
1183    %TypeHeaderCode
1184        #include <wx/graphics.h>
1185    %End
1186
1187public:
1188    wxGraphicsGradientStops(
1189        wxColour startCol = wxTransparentColour,
1190        wxColour endCol = wxTransparentColour
1191    );
1192
1193    void Add(
1194        const wxGraphicsGradientStop & stop
1195    );
1196    %Docstring
1197        Add(stop)
1198        Add(col, pos)
1199
1200        Add a new stop.
1201    %End
1202
1203    void Add(
1204        wxColour col,
1205        float pos
1206    );
1207
1208    wxGraphicsGradientStop Item(
1209        unsigned n
1210    ) const;
1211    %Docstring
1212        Item(n) -> GraphicsGradientStop
1213
1214        Returns the stop at the given index.
1215    %End
1216
1217    size_t GetCount() const;
1218    %Docstring
1219        GetCount() -> size_t
1220
1221        Returns the number of stops.
1222    %End
1223
1224    void SetStartColour(
1225        wxColour col
1226    );
1227    %Docstring
1228        SetStartColour(col)
1229
1230        Set the start colour to col.
1231    %End
1232
1233    wxColour GetStartColour() const;
1234    %Docstring
1235        GetStartColour() -> Colour
1236
1237        Returns the start colour.
1238    %End
1239
1240    void SetEndColour(
1241        wxColour col
1242    );
1243    %Docstring
1244        SetEndColour(col)
1245
1246        Set the end colour to col.
1247    %End
1248
1249    wxColour GetEndColour() const;
1250    %Docstring
1251        GetEndColour() -> Colour
1252
1253        Returns the end colour.
1254    %End
1255
1256    SIP_SSIZE_T __len__();
1257    %Docstring
1258        __len__() -> SIP_SSIZE_T
1259    %End
1260    %MethodCode
1261        PyErr_Clear();
1262        Py_BEGIN_ALLOW_THREADS
1263        sipRes = _wxGraphicsGradientStops___len__(sipCpp);
1264        Py_END_ALLOW_THREADS
1265        if (PyErr_Occurred()) sipIsErr = 1;
1266    %End
1267    %TypeCode
1268    SIP_SSIZE_T _wxGraphicsGradientStops___len__(wxGraphicsGradientStops* self)
1269    {
1270        return (SIP_SSIZE_T)self->GetCount();
1271    }
1272    %End
1273
1274    wxGraphicsGradientStop* __getitem__(ulong n)   /Factory/;
1275    %Docstring
1276        __getitem__(n)
1277    %End
1278    %MethodCode
1279        PyErr_Clear();
1280        Py_BEGIN_ALLOW_THREADS
1281        sipRes = _wxGraphicsGradientStops___getitem__(sipCpp, n);
1282        Py_END_ALLOW_THREADS
1283        if (PyErr_Occurred()) sipIsErr = 1;
1284    %End
1285    %TypeCode
1286    wxGraphicsGradientStop* _wxGraphicsGradientStops___getitem__(wxGraphicsGradientStops* self, ulong n)
1287    {
1288        return new wxGraphicsGradientStop(self->Item(n));
1289    }
1290    %End
1291
1292    public:
1293
1294
1295    %Property(name=Count, get=GetCount)
1296    %Property(name=EndColour, get=GetEndColour, set=SetEndColour)
1297    %Property(name=StartColour, get=GetStartColour, set=SetStartColour)
1298};  // end of class wxGraphicsGradientStops
1299
1300
1301class wxGraphicsMatrix : wxGraphicsObject
1302{
1303    %Docstring
1304        A wxGraphicsMatrix is a native representation of an affine matrix.
1305    %End
1306    %TypeHeaderCode
1307        #include <wx/graphics.h>
1308    %End
1309
1310public:
1311    void Concat(
1312        const wxGraphicsMatrix * t
1313    );
1314    %Docstring
1315        Concat(t)
1316
1317        Concatenates the matrix passed with the current matrix.
1318    %End
1319
1320    void Get(
1321        wxDouble * a   /Out/ = NULL,
1322        wxDouble * b   /Out/ = NULL,
1323        wxDouble * c   /Out/ = NULL,
1324        wxDouble * d   /Out/ = NULL,
1325        wxDouble * tx   /Out/ = NULL,
1326        wxDouble * ty   /Out/ = NULL
1327    ) const;
1328    %Docstring
1329        Get() -> (a, b, c, d, tx, ty)
1330
1331        Returns the component values of the matrix via the argument pointers.
1332    %End
1333
1334    void * GetNativeMatrix() const;
1335    %Docstring
1336        GetNativeMatrix() -> void
1337
1338        Returns the native representation of the matrix.
1339    %End
1340
1341    void Invert();
1342    %Docstring
1343        Invert()
1344
1345        Inverts the matrix.
1346    %End
1347
1348    bool IsEqual(
1349        const wxGraphicsMatrix * t
1350    ) const;
1351    %Docstring
1352        IsEqual(t) -> bool
1353
1354        Returns true if the elements of the transformation matrix are equal.
1355    %End
1356
1357    bool IsIdentity() const;
1358    %Docstring
1359        IsIdentity() -> bool
1360
1361        Return true if this is the identity matrix.
1362    %End
1363
1364    void Rotate(
1365        wxDouble angle
1366    );
1367    %Docstring
1368        Rotate(angle)
1369
1370        Rotates this matrix clockwise (in radians).
1371    %End
1372
1373    void Scale(
1374        wxDouble xScale,
1375        wxDouble yScale
1376    );
1377    %Docstring
1378        Scale(xScale, yScale)
1379
1380        Scales this matrix.
1381    %End
1382
1383    void Set(
1384        wxDouble a = 1.0,
1385        wxDouble b = 0.0,
1386        wxDouble c = 0.0,
1387        wxDouble d = 1.0,
1388        wxDouble tx = 0.0,
1389        wxDouble ty = 0.0
1390    );
1391    %Docstring
1392        Set(a=1.0, b=0.0, c=0.0, d=1.0, tx=0.0, ty=0.0)
1393
1394        Sets the matrix to the respective values (default values are the
1395        identity matrix).
1396    %End
1397
1398    void TransformDistance(
1399        wxDouble * dx   /In, Out/,
1400        wxDouble * dy   /In, Out/
1401    ) const;
1402    %Docstring
1403        TransformDistance(dx, dy) -> (dx, dy)
1404
1405        Applies this matrix to a distance (ie.
1406    %End
1407
1408    void TransformPoint(
1409        wxDouble * x   /In, Out/,
1410        wxDouble * y   /In, Out/
1411    ) const;
1412    %Docstring
1413        TransformPoint(x, y) -> (x, y)
1414
1415        Applies this matrix to a point.
1416    %End
1417
1418    void Translate(
1419        wxDouble dx,
1420        wxDouble dy
1421    );
1422    %Docstring
1423        Translate(dx, dy)
1424
1425        Translates this matrix.
1426    %End
1427
1428    public:
1429
1430
1431    %Property(name=NativeMatrix, get=GetNativeMatrix)
1432};  // end of class wxGraphicsMatrix
1433
1434
1435class wxGraphicsPath : wxGraphicsObject
1436{
1437    %Docstring
1438        A wxGraphicsPath is a native representation of a geometric path.
1439    %End
1440    %TypeHeaderCode
1441        #include <wx/graphics.h>
1442    %End
1443
1444public:
1445    void AddArc(
1446        wxDouble x,
1447        wxDouble y,
1448        wxDouble r,
1449        wxDouble startAngle,
1450        wxDouble endAngle,
1451        bool clockwise
1452    );
1453    %Docstring
1454        AddArc(x, y, r, startAngle, endAngle, clockwise)
1455        AddArc(c, r, startAngle, endAngle, clockwise)
1456
1457        Adds an arc of a circle.
1458    %End
1459
1460    void AddArc(
1461        const wxPoint2D & c,
1462        wxDouble r,
1463        wxDouble startAngle,
1464        wxDouble endAngle,
1465        bool clockwise
1466    );
1467
1468    void AddArcToPoint(
1469        wxDouble x1,
1470        wxDouble y1,
1471        wxDouble x2,
1472        wxDouble y2,
1473        wxDouble r
1474    );
1475    %Docstring
1476        AddArcToPoint(x1, y1, x2, y2, r)
1477
1478        Appends a an arc to two tangents connecting (current) to (x1,y1) and
1479        (x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1).
1480    %End
1481
1482    void AddCircle(
1483        wxDouble x,
1484        wxDouble y,
1485        wxDouble r
1486    );
1487    %Docstring
1488        AddCircle(x, y, r)
1489
1490        Appends a circle around (x,y) with radius r as a new closed subpath.
1491    %End
1492
1493    void AddCurveToPoint(
1494        wxDouble cx1,
1495        wxDouble cy1,
1496        wxDouble cx2,
1497        wxDouble cy2,
1498        wxDouble x,
1499        wxDouble y
1500    );
1501    %Docstring
1502        AddCurveToPoint(cx1, cy1, cx2, cy2, x, y)
1503        AddCurveToPoint(c1, c2, e)
1504
1505        Adds a cubic bezier curve from the current point, using two control
1506        points and an end point.
1507    %End
1508
1509    void AddCurveToPoint(
1510        const wxPoint2D & c1,
1511        const wxPoint2D & c2,
1512        const wxPoint2D & e
1513    );
1514
1515    void AddEllipse(
1516        wxDouble x,
1517        wxDouble y,
1518        wxDouble w,
1519        wxDouble h
1520    );
1521    %Docstring
1522        AddEllipse(x, y, w, h)
1523
1524        Appends an ellipse fitting into the passed in rectangle.
1525    %End
1526
1527    void AddLineToPoint(
1528        wxDouble x,
1529        wxDouble y
1530    );
1531    %Docstring
1532        AddLineToPoint(x, y)
1533        AddLineToPoint(p)
1534
1535        Adds a straight line from the current point to (x,y).
1536    %End
1537
1538    void AddLineToPoint(
1539        const wxPoint2D & p
1540    );
1541
1542    void AddPath(
1543        const wxGraphicsPath & path
1544    );
1545    %Docstring
1546        AddPath(path)
1547
1548        Adds another path.
1549    %End
1550
1551    void AddQuadCurveToPoint(
1552        wxDouble cx,
1553        wxDouble cy,
1554        wxDouble x,
1555        wxDouble y
1556    );
1557    %Docstring
1558        AddQuadCurveToPoint(cx, cy, x, y)
1559
1560        Adds a quadratic bezier curve from the current point, using a control
1561        point and an end point.
1562    %End
1563
1564    void AddRectangle(
1565        wxDouble x,
1566        wxDouble y,
1567        wxDouble w,
1568        wxDouble h
1569    );
1570    %Docstring
1571        AddRectangle(x, y, w, h)
1572
1573        Appends a rectangle as a new closed subpath.
1574    %End
1575
1576    void AddRoundedRectangle(
1577        wxDouble x,
1578        wxDouble y,
1579        wxDouble w,
1580        wxDouble h,
1581        wxDouble radius
1582    );
1583    %Docstring
1584        AddRoundedRectangle(x, y, w, h, radius)
1585
1586        Appends a rounded rectangle as a new closed subpath.
1587    %End
1588
1589    void CloseSubpath();
1590    %Docstring
1591        CloseSubpath()
1592
1593        Closes the current sub-path.
1594    %End
1595
1596    bool Contains(
1597        const wxPoint2D & c,
1598        wxPolygonFillMode fillStyle = wxODDEVEN_RULE
1599    ) const;
1600    %Docstring
1601        Contains(c, fillStyle=ODDEVEN_RULE) -> bool
1602        Contains(x, y, fillStyle=ODDEVEN_RULE) -> bool
1603    %End
1604
1605    bool Contains(
1606        wxDouble x,
1607        wxDouble y,
1608        wxPolygonFillMode fillStyle = wxODDEVEN_RULE
1609    ) const;
1610
1611    wxRect2D GetBox() const;
1612    %Docstring
1613        GetBox() -> Rect2D
1614
1615        Gets the bounding box enclosing all points (possibly including control
1616        points).
1617    %End
1618
1619    wxPoint2D GetCurrentPoint() const;
1620    %Docstring
1621        GetCurrentPoint() -> Point2D
1622
1623        Gets the last point of the current path, (0,0) if not yet set.
1624    %End
1625
1626    void * GetNativePath() const;
1627    %Docstring
1628        GetNativePath() -> void
1629
1630        Returns the native path (CGPathRef for Core Graphics, Path pointer for
1631        GDIPlus and a cairo_path_t pointer for cairo).
1632    %End
1633
1634    void MoveToPoint(
1635        wxDouble x,
1636        wxDouble y
1637    );
1638    %Docstring
1639        MoveToPoint(x, y)
1640        MoveToPoint(p)
1641
1642        Begins a new subpath at (x,y).
1643    %End
1644
1645    void MoveToPoint(
1646        const wxPoint2D & p
1647    );
1648
1649    void Transform(
1650        const wxGraphicsMatrix & matrix
1651    );
1652    %Docstring
1653        Transform(matrix)
1654
1655        Transforms each point of this path by the matrix.
1656    %End
1657
1658    void UnGetNativePath(
1659        void * p
1660    ) const;
1661    %Docstring
1662        UnGetNativePath(p)
1663
1664        Gives back the native path returned by GetNativePath() because there
1665        might be some deallocations necessary (e.g.
1666    %End
1667
1668    public:
1669
1670
1671    %Property(name=Box, get=GetBox)
1672    %Property(name=CurrentPoint, get=GetCurrentPoint)
1673    %Property(name=NativePath, get=GetNativePath)
1674};  // end of class wxGraphicsPath
1675
1676
1677class wxGraphicsRenderer : wxObject   /Abstract/
1678{
1679    %Docstring
1680        A wxGraphicsRenderer is the instance corresponding to the rendering
1681        engine used.
1682    %End
1683    %TypeHeaderCode
1684        #include <wx/graphics.h>
1685    %End
1686
1687public:
1688    wxGraphicsBitmap CreateBitmap(
1689        const wxBitmap & bitmap
1690    );
1691    %Docstring
1692        CreateBitmap(bitmap) -> GraphicsBitmap
1693
1694        Creates wxGraphicsBitmap from an existing wxBitmap.
1695    %End
1696
1697    wxGraphicsBitmap CreateBitmapFromImage(
1698        const wxImage & image
1699    );
1700    %Docstring
1701        CreateBitmapFromImage(image) -> GraphicsBitmap
1702
1703        Creates wxGraphicsBitmap from an existing wxImage.
1704    %End
1705
1706    wxImage CreateImageFromBitmap(
1707        const wxGraphicsBitmap & bmp
1708    );
1709    %Docstring
1710        CreateImageFromBitmap(bmp) -> Image
1711
1712        Creates a wxImage from a wxGraphicsBitmap.
1713    %End
1714
1715    wxGraphicsBitmap CreateBitmapFromNativeBitmap(
1716        void * bitmap
1717    );
1718    %Docstring
1719        CreateBitmapFromNativeBitmap(bitmap) -> GraphicsBitmap
1720
1721        Creates wxGraphicsBitmap from a native bitmap handle.
1722    %End
1723
1724    wxGraphicsContext * CreateContext(
1725        wxWindow * window
1726    )   /Factory/;
1727    %Docstring
1728        CreateContext(window) -> GraphicsContext
1729        CreateContext(windowDC) -> GraphicsContext
1730        CreateContext(memoryDC) -> GraphicsContext
1731        CreateContext(printerDC) -> GraphicsContext
1732
1733        Creates a wxGraphicsContext from a wxWindow.
1734    %End
1735
1736    wxGraphicsContext * CreateContext(
1737        const wxWindowDC & windowDC   /KeepReference/
1738    )   /Factory/;
1739
1740    wxGraphicsContext * CreateContext(
1741        const wxMemoryDC & memoryDC   /KeepReference/
1742    )   /Factory/;
1743
1744    wxGraphicsContext * CreateContext(
1745        const wxPrinterDC & printerDC   /KeepReference/
1746    )   /Factory/;
1747
1748    wxGraphicsContext * CreateContextFromImage(
1749        wxImage & image   /KeepReference/
1750    )   /Factory/;
1751    %Docstring
1752        CreateContextFromImage(image) -> GraphicsContext
1753
1754        Creates a wxGraphicsContext associated with a wxImage.
1755    %End
1756
1757    wxGraphicsBrush CreateBrush(
1758        const wxBrush & brush
1759    );
1760    %Docstring
1761        CreateBrush(brush) -> GraphicsBrush
1762
1763        Creates a native brush from a wxBrush.
1764    %End
1765
1766    wxGraphicsContext * CreateContextFromNativeContext(
1767        void * context
1768    )   /Factory/;
1769    %Docstring
1770        CreateContextFromNativeContext(context) -> GraphicsContext
1771
1772        Creates a wxGraphicsContext from a native context.
1773    %End
1774
1775    wxGraphicsContext * CreateContextFromNativeWindow(
1776        void * window
1777    )   /Factory/;
1778    %Docstring
1779        CreateContextFromNativeWindow(window) -> GraphicsContext
1780
1781        Creates a wxGraphicsContext from a native window.
1782    %End
1783
1784    wxGraphicsContext * CreateMeasuringContext()   /Factory/;
1785    %Docstring
1786        CreateMeasuringContext() -> GraphicsContext
1787
1788        Creates a wxGraphicsContext that can be used for measuring texts only.
1789    %End
1790
1791    wxGraphicsFont CreateFont(
1792        const wxFont & font,
1793        const wxColour & col = *wxBLACK
1794    );
1795    %Docstring
1796        CreateFont(font, col=BLACK) -> GraphicsFont
1797        CreateFont(sizeInPixels, facename, flags=FONTFLAG_DEFAULT, col=BLACK) -> GraphicsFont
1798
1799        Creates a native graphics font from a wxFont and a text colour.
1800    %End
1801
1802    wxGraphicsFont CreateFont(
1803        double sizeInPixels,
1804        const wxString & facename,
1805        int flags = wxFONTFLAG_DEFAULT,
1806        const wxColour & col = *wxBLACK
1807    );
1808
1809    wxGraphicsBrush CreateLinearGradientBrush(
1810        wxDouble x1,
1811        wxDouble y1,
1812        wxDouble x2,
1813        wxDouble y2,
1814        const wxGraphicsGradientStops & stops
1815    );
1816    %Docstring
1817        CreateLinearGradientBrush(x1, y1, x2, y2, stops) -> GraphicsBrush
1818
1819        Creates a native brush with a linear gradient.
1820    %End
1821
1822    wxGraphicsMatrix CreateMatrix(
1823        wxDouble a = 1.0,
1824        wxDouble b = 0.0,
1825        wxDouble c = 0.0,
1826        wxDouble d = 1.0,
1827        wxDouble tx = 0.0,
1828        wxDouble ty = 0.0
1829    );
1830    %Docstring
1831        CreateMatrix(a=1.0, b=0.0, c=0.0, d=1.0, tx=0.0, ty=0.0) -> GraphicsMatrix
1832
1833        Creates a native affine transformation matrix from the passed in
1834        values.
1835    %End
1836
1837    wxGraphicsPath CreatePath();
1838    %Docstring
1839        CreatePath() -> GraphicsPath
1840
1841        Creates a native graphics path which is initially empty.
1842    %End
1843
1844    wxGraphicsPen CreatePen(
1845        const wxPen & pen
1846    );
1847    %Docstring
1848        CreatePen(pen) -> GraphicsPen
1849
1850        Creates a native pen from a wxPen.
1851    %End
1852
1853    wxGraphicsBrush CreateRadialGradientBrush(
1854        wxDouble xo,
1855        wxDouble yo,
1856        wxDouble xc,
1857        wxDouble yc,
1858        wxDouble radius,
1859        const wxGraphicsGradientStops & stops
1860    );
1861    %Docstring
1862        CreateRadialGradientBrush(xo, yo, xc, yc, radius, stops) -> GraphicsBrush
1863
1864        Creates a native brush with a radial gradient.
1865    %End
1866
1867    wxGraphicsBitmap CreateSubBitmap(
1868        const wxGraphicsBitmap & bitmap,
1869        wxDouble x,
1870        wxDouble y,
1871        wxDouble w,
1872        wxDouble h
1873    );
1874    %Docstring
1875        CreateSubBitmap(bitmap, x, y, w, h) -> GraphicsBitmap
1876
1877        Extracts a sub-bitmap from an existing bitmap.
1878    %End
1879
1880    static
1881    wxGraphicsRenderer * GetDefaultRenderer();
1882    %Docstring
1883        GetDefaultRenderer() -> GraphicsRenderer
1884
1885        Returns the default renderer on this platform.
1886    %End
1887
1888    static
1889    wxGraphicsRenderer * GetCairoRenderer();
1890    %Docstring
1891        GetCairoRenderer() -> GraphicsRenderer
1892    %End
1893
1894};  // end of class wxGraphicsRenderer
1895
1896
1897const wxGraphicsPen wxNullGraphicsPen;
1898
1899const wxGraphicsBrush wxNullGraphicsBrush;
1900
1901const wxGraphicsFont wxNullGraphicsFont;
1902
1903const wxGraphicsBitmap wxNullGraphicsBitmap;
1904
1905const wxGraphicsMatrix wxNullGraphicsMatrix;
1906
1907const wxGraphicsPath wxNullGraphicsPath;
1908
1909typedef wxPoint2DDouble wxPoint2D;
1910
1911typedef wxRect2DDouble wxRect2D;
1912
1913
1914//---------------------------------------------------------------------------
1915
1916