.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc



.. _wx.GraphicsContext:

==========================================================================================================================================
|phoenix_title|  **wx.GraphicsContext**
==========================================================================================================================================

A :ref:`wx.GraphicsContext`  instance is the object that is drawn upon.          

It is created by a renderer using :meth:`wx.GraphicsRenderer.CreateContext` . This can be either directly using a renderer instance, or indirectly using the static convenience :meth:`~wx.GraphicsContext.Create`  functions of :ref:`wx.GraphicsContext`  that always delegate the task to the default renderer. 

::

        def OnPaint(self, event):

            # Create paint DC
            dc = wx.PaintDC(self)

            # Create graphics context from it
            gc = wx.GraphicsContext.Create(dc)

            if gc:

                # make a path that contains a circle and some lines
                gc.SetPen(wx.RED_PEN)
                path = gc.CreatePath()
                path.AddCircle(50.0, 50.0, 50.0)
                path.MoveToPoint(0.0, 50.0)
                path.AddLineToPoint(100.0, 50.0)
                path.MoveToPoint(50.0, 0.0)
                path.AddLineToPoint(50.0, 100.0)
                path.CloseSubpath()
                path.AddRectangle(25.0, 25.0, 50.0, 50.0)

                gc.StrokePath(path)









         



.. seealso:: :meth:`wx.GraphicsRenderer.CreateContext` , :ref:`wx.GCDC`, :ref:`wx.DC`    







|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>GraphicsContext</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.GraphicsContext_inheritance.png" alt="Inheritance diagram of GraphicsContext" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.GraphicsObject.html" title="wx.GraphicsObject" alt="" coords="9,83,148,112"/> <area shape="rect" id="node3" href="wx.GraphicsContext.html" title="wx.GraphicsContext" alt="" coords="5,160,152,189"/> <area shape="rect" id="node2" href="wx.Object.html" title="wx.Object" alt="" coords="37,5,119,35"/> </map> 
   </p>

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.GraphicsContext.BeginLayer`                                           Redirects all rendering is done into a fully transparent temporary context.
:meth:`~wx.GraphicsContext.Clip`                                                 Clips drawings to the specified region.
:meth:`~wx.GraphicsContext.ConcatTransform`                                      Concatenates the passed in transform with the current transform of this context.
:meth:`~wx.GraphicsContext.Create`                                               Creates a :ref:`wx.GraphicsContext`  from a :ref:`wx.Window`.
:meth:`~wx.GraphicsContext.CreateBitmap`                                         Creates :ref:`wx.GraphicsBitmap`  from an existing :ref:`wx.Bitmap`.
:meth:`~wx.GraphicsContext.CreateBitmapFromImage`                                Creates :ref:`wx.GraphicsBitmap`  from an existing :ref:`wx.Image`.
:meth:`~wx.GraphicsContext.CreateBrush`                                          Creates a native brush from a :ref:`wx.Brush`.
:meth:`~wx.GraphicsContext.CreateFont`                                           Creates a native graphics font from a :ref:`wx.Font`  and a text colour.
:meth:`~wx.GraphicsContext.CreateFromNative`                                     Creates a :ref:`wx.GraphicsContext`  from a native context.
:meth:`~wx.GraphicsContext.CreateFromNativeWindow`                               Creates a :ref:`wx.GraphicsContext`  from a native window.
:meth:`~wx.GraphicsContext.CreateLinearGradientBrush`                            Creates a native brush with a linear gradient.
:meth:`~wx.GraphicsContext.CreateMatrix`                                         Creates a native affine transformation matrix from the passed in values.
:meth:`~wx.GraphicsContext.CreatePath`                                           Creates a native graphics path which is initially empty.
:meth:`~wx.GraphicsContext.CreatePen`                                            Creates a native pen from a :ref:`wx.Pen`.
:meth:`~wx.GraphicsContext.CreateRadialGradientBrush`                            Creates a native brush with a radial gradient.
:meth:`~wx.GraphicsContext.CreateSubBitmap`                                      Extracts a sub-bitmap from an existing bitmap.
:meth:`~wx.GraphicsContext.DisableOffset`                                        
:meth:`~wx.GraphicsContext.DrawBitmap`                                           Draws the bitmap.
:meth:`~wx.GraphicsContext.DrawEllipse`                                          Draws an ellipse.
:meth:`~wx.GraphicsContext.DrawIcon`                                             Draws the icon.
:meth:`~wx.GraphicsContext.DrawLines`                                            Draws a polygon.
:meth:`~wx.GraphicsContext.DrawPath`                                             Draws the path by first filling and then stroking.
:meth:`~wx.GraphicsContext.DrawRectangle`                                        Draws a rectangle.
:meth:`~wx.GraphicsContext.DrawRoundedRectangle`                                 Draws a rounded rectangle.
:meth:`~wx.GraphicsContext.DrawText`                                             Draws text at the defined position.
:meth:`~wx.GraphicsContext.EnableOffset`                                         
:meth:`~wx.GraphicsContext.EndDoc`                                               Done with that document (relevant only for printing / pdf etc.)
:meth:`~wx.GraphicsContext.EndLayer`                                             Composites back the drawings into the context with the opacity given at the BeginLayer call.
:meth:`~wx.GraphicsContext.EndPage`                                              Ends the current page (relevant only for printing / pdf etc.)
:meth:`~wx.GraphicsContext.FillPath`                                             Fills the path with the current brush.
:meth:`~wx.GraphicsContext.Flush`                                                Make sure that the current content of this context is immediately visible.
:meth:`~wx.GraphicsContext.GetAntialiasMode`                                     Returns the current shape antialiasing mode.
:meth:`~wx.GraphicsContext.GetCompositionMode`                                   Returns the current compositing operator.
:meth:`~wx.GraphicsContext.GetDPI`                                               Returns the resolution of the graphics context in device points per inch.
:meth:`~wx.GraphicsContext.GetInterpolationQuality`                              Returns the current interpolation quality.
:meth:`~wx.GraphicsContext.GetNativeContext`                                     Returns the native context (CGContextRef for Core Graphics, Graphics pointer for GDIPlus and cairo_t pointer for cairo).
:meth:`~wx.GraphicsContext.GetPartialTextExtents`                                Fills the `widths`  array with the widths from the beginning of `text`  to the corresponding character of `text`.
:meth:`~wx.GraphicsContext.GetSize`                                              Returns the size of the graphics context in device coordinates.
:meth:`~wx.GraphicsContext.GetFullTextExtent`                                    Gets the dimensions of the string using the currently selected font.
:meth:`~wx.GraphicsContext.GetTransform`                                         Gets the current transformation matrix of this context.
:meth:`~wx.GraphicsContext.OffsetEnabled`                                        
:meth:`~wx.GraphicsContext.PopState`                                             Pops a stored state from the stack and sets the current transformation matrix to that state.
:meth:`~wx.GraphicsContext.PushState`                                            Push the current state of the context's transformation matrix on a stack.
:meth:`~wx.GraphicsContext.ResetClip`                                            Resets the clipping to original shape.
:meth:`~wx.GraphicsContext.Rotate`                                               Rotates the current transformation matrix (in radians).
:meth:`~wx.GraphicsContext.Scale`                                                Scales the current transformation matrix.
:meth:`~wx.GraphicsContext.SetAntialiasMode`                                     Sets the antialiasing mode, returns ``True`` if it supported.
:meth:`~wx.GraphicsContext.SetBrush`                                             Sets the brush for filling paths.
:meth:`~wx.GraphicsContext.SetCompositionMode`                                   Sets the compositing operator, returns ``True`` if it supported.
:meth:`~wx.GraphicsContext.SetFont`                                              Sets the font for drawing text.
:meth:`~wx.GraphicsContext.SetInterpolationQuality`                              Sets the interpolation quality, returns ``True`` if it is supported.
:meth:`~wx.GraphicsContext.SetPen`                                               Sets the pen used for stroking.
:meth:`~wx.GraphicsContext.SetTransform`                                         Sets the current transformation matrix of this context.
:meth:`~wx.GraphicsContext.ShouldOffset`                                         
:meth:`~wx.GraphicsContext.StartDoc`                                             Begin a new document (relevant only for printing / pdf etc.) If there is a progress dialog, message will be shown.
:meth:`~wx.GraphicsContext.StartPage`                                            Opens a new page (relevant only for printing / pdf etc.) with the given size in points.
:meth:`~wx.GraphicsContext.StrokeLine`                                           Strokes a single line.
:meth:`~wx.GraphicsContext.StrokeLineSegments`                                   Stroke disconnected lines from begin to end points.
:meth:`~wx.GraphicsContext.StrokeLines`                                          Stroke lines conencting all the points.
:meth:`~wx.GraphicsContext.StrokePath`                                           Strokes along a path with the current pen.
:meth:`~wx.GraphicsContext.Translate`                                            Translates the current transformation matrix.
================================================================================ ================================================================================


|


|property_summary| Properties Summary
=====================================

================================================================================ ================================================================================
:attr:`~wx.GraphicsContext.AntialiasMode`                                        See :meth:`~wx.GraphicsContext.GetAntialiasMode` and :meth:`~wx.GraphicsContext.SetAntialiasMode`
:attr:`~wx.GraphicsContext.CompositionMode`                                      See :meth:`~wx.GraphicsContext.GetCompositionMode` and :meth:`~wx.GraphicsContext.SetCompositionMode`
:attr:`~wx.GraphicsContext.InterpolationQuality`                                 See :meth:`~wx.GraphicsContext.GetInterpolationQuality` and :meth:`~wx.GraphicsContext.SetInterpolationQuality`
:attr:`~wx.GraphicsContext.NativeContext`                                        See :meth:`~wx.GraphicsContext.GetNativeContext`
:attr:`~wx.GraphicsContext.TextExtent`                                           See :meth:`~wx.GraphicsContext.GetTextExtent`
:attr:`~wx.GraphicsContext.Transform`                                            See :meth:`~wx.GraphicsContext.GetTransform` and :meth:`~wx.GraphicsContext.SetTransform`
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: wx.GraphicsContext(GraphicsObject)

   A GraphicsContext instance is the object that is drawn upon.



   .. method:: BeginLayer(self, opacity)

      Redirects all rendering is done into a fully transparent temporary context.                  


      :param `opacity`: 
      :type `opacity`: wx.Double







   .. method:: Clip(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **Clip** `(self, region)`
      
      Clips drawings to the specified region.                  
      
      
      :param `region`: 
      :type `region`: wx.Region
      
      
      
      
      
      
      **~~~**

      
      **Clip** `(self, x, y, w, h)`
      
      Clips drawings to the specified rectangle.                  
      
      
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double
      
      
      
      
      
      
      **~~~**






   .. method:: ConcatTransform(self, matrix)

      Concatenates the passed in transform with the current transform of this context.                  


      :param `matrix`: 
      :type `matrix`: wx.GraphicsMatrix







   .. staticmethod:: Create(*args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **Create** `(window)`
      
      Creates a :ref:`wx.GraphicsContext`  from a :ref:`wx.Window`.                  
      
                      
      
      
      :param `window`: 
      :type `window`: wx.Window
      
      
      
      
      :rtype: :ref:`wx.GraphicsContext`
      
      
      
      
      
      
      
      .. seealso:: :meth:`wx.GraphicsRenderer.CreateContext`     
      
      
      
      
      
      
      
      **~~~**

      
      **Create** `(windowDC)`
      
      Creates a :ref:`wx.GraphicsContext`  from a :ref:`wx.WindowDC`.                  
      
                      
      
      
      :param `windowDC`: 
      :type `windowDC`: wx.WindowDC
      
      
      
      
      :rtype: :ref:`wx.GraphicsContext`
      
      
      
      
      
      
      
      .. seealso:: :meth:`wx.GraphicsRenderer.CreateContext`     
      
      
      
      
      
      
      
      **~~~**

      
      **Create** `(memoryDC)`
      
      Creates a :ref:`wx.GraphicsContext`  from a :ref:`wx.MemoryDC`.                  
      
                      
      
      
      :param `memoryDC`: 
      :type `memoryDC`: wx.MemoryDC
      
      
      
      
      :rtype: :ref:`wx.GraphicsContext`
      
      
      
      
      
      
      
      .. seealso:: :meth:`wx.GraphicsRenderer.CreateContext`     
      
      
      
      
      
      
      
      **~~~**

      
      **Create** `(printerDC)`
      
      Creates a :ref:`wx.GraphicsContext`  from a :ref:`wx.PrinterDC`.                  
      
      Under GTK+, this will only work when using the GtkPrint printing backend which is available since GTK+ 2.10. 
      
                      
      
      
      :param `printerDC`: 
      :type `printerDC`: wx.PrinterDC
      
      
      
      
      :rtype: :ref:`wx.GraphicsContext`
      
      
      
      
      
      
      
      .. seealso:: :meth:`wx.GraphicsRenderer.CreateContext` ,       
      
      
      
      
      
      
      
      **~~~**

      
      **Create** `(metaFileDC)`
      
      Creates a :ref:`wx.GraphicsContext`  from a EnhMetaFileDC.                  
      
      This function, as EnhMetaFileDC class itself, is only available only under MSW. 
      
                      
      
      
      :param `metaFileDC`: 
      :type `metaFileDC`: :class:`MetafileDC`
      
      
      
      
      :rtype: :ref:`wx.GraphicsContext`
      
      
      
      
      
      
      
      .. seealso:: :meth:`wx.GraphicsRenderer.CreateContext`     
      
      
      
      
      
      
      
      **~~~**

      
      **Create** `(image)`
      
      Creates a :ref:`wx.GraphicsContext`  associated with a :ref:`wx.Image`.                  
      
      The image specifies the size of the context as well as whether alpha is supported (if :meth:`wx.Image.HasAlpha` ) or not and the initial contents of the context. The `image`  object must have a life time greater than that of the new context as the context copies its contents back to the image when it is destroyed. 
      
                      
      
      
      :param `image`: 
      :type `image`: wx.Image
      
      
      
      
      :rtype: :ref:`wx.GraphicsContext`
      
      
      
      
      
      
      
      .. versionadded:: 2.9.3 
           
      
      
      
      
      
      
      
      **~~~**

      
      **Create** `()`
      
      Create a lightweight context that can be used only for measuring text.                  
      
      :rtype: :ref:`wx.GraphicsContext`
      
      
      
      
      
      
      
      **~~~**

      
      **Create** `(autoPaintDC)`
      
      
      
      :rtype: :ref:`wx.GraphicsContext`
      
      
      
      
      
      
      
      **~~~**






   .. method:: CreateBitmap(self, bitmap)

      Creates :ref:`wx.GraphicsBitmap`  from an existing :ref:`wx.Bitmap`.                  

      Returns an invalid NullGraphicsBitmap on failure.                  


      :param `bitmap`: 
      :type `bitmap`: wx.Bitmap




      :rtype: :ref:`wx.GraphicsBitmap`








   .. method:: CreateBitmapFromImage(self, image)

      Creates :ref:`wx.GraphicsBitmap`  from an existing :ref:`wx.Image`.                  

      This method is more efficient than converting :ref:`wx.Image`  to :ref:`wx.Bitmap`  first and then calling :meth:`CreateBitmap`   but otherwise has the same effect. 

      Returns an invalid NullGraphicsBitmap on failure. 

                


      :param `image`: 
      :type `image`: wx.Image




      :rtype: :ref:`wx.GraphicsBitmap`







      .. versionadded:: 2.9.3 
     








   .. method:: CreateBrush(self, brush)

      Creates a native brush from a :ref:`wx.Brush`.                  


      :param `brush`: 
      :type `brush`: wx.Brush




      :rtype: :ref:`wx.GraphicsBrush`








   .. method:: CreateFont(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **CreateFont** `(self, font, col=BLACK)`
      
      Creates a native graphics font from a :ref:`wx.Font`  and a text colour.                  
      
      
      :param `font`: 
      :type `font`: wx.Font
      :param `col`: 
      :type `col`: wx.Colour
      
      
      
      
      :rtype: :ref:`wx.GraphicsFont`
      
      
      
      
      
      
      
      **~~~**

      
      **CreateFont** `(self, sizeInPixels, facename, flags=FONTFLAG_DEFAULT, col=BLACK)`
      
      Creates a font object with the specified attributes.                  
      
      The use of overload taking :ref:`wx.Font`  is preferred, see :meth:`wx.GraphicsRenderer.CreateFont`   for more details. 
      
                      
      
      
      :param `sizeInPixels`: 
      :type `sizeInPixels`: float
      :param `facename`: 
      :type `facename`: string
      :param `flags`: 
      :type `flags`: int
      :param `col`: 
      :type `col`: wx.Colour
      
      
      
      
      :rtype: :ref:`wx.GraphicsFont`
      
      
      
      
      
      
      
      .. versionadded:: 2.9.3 
           
      
      
      
      
      
      
      
      **~~~**






   .. staticmethod:: CreateFromNative(context)

      Creates a :ref:`wx.GraphicsContext`  from a native context.                  

      This native context must be a CGContextRef for Core Graphics, a Graphics pointer for GDIPlus, or a cairo_t pointer for cairo. 

                


      :param `context`: 




      :rtype: :ref:`wx.GraphicsContext`







      .. seealso:: :meth:`wx.GraphicsRenderer.CreateContextFromNativeContext`     








   .. staticmethod:: CreateFromNativeWindow(window)

      Creates a :ref:`wx.GraphicsContext`  from a native window.                  

                


      :param `window`: 




      :rtype: :ref:`wx.GraphicsContext`







      .. seealso:: :meth:`wx.GraphicsRenderer.CreateContextFromNativeWindow`     








   .. method:: CreateLinearGradientBrush(self, *args, **kw)

      Creates a native brush with a linear gradient.                  

      The brush starts at (`x1`, `y1`) and ends at (`x2`, `y2`). Either just the start and end gradient colours (`c1`  and `c2`) or full set of gradient `stops`  can be specified. 

      The version taking :ref:`wx.GraphicsGradientStops`  is new in wxWidgets 2.9.1.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **CreateLinearGradientBrush** `(self, x1, y1, x2, y2, c1, c2)`
      
      
      
      
      :param `x1`: 
      :type `x1`: wx.Double
      :param `y1`: 
      :type `y1`: wx.Double
      :param `x2`: 
      :type `x2`: wx.Double
      :param `y2`: 
      :type `y2`: wx.Double
      :param `c1`: 
      :type `c1`: wx.Colour
      :param `c2`: 
      :type `c2`: wx.Colour
      
      
      
      
      :rtype: :ref:`wx.GraphicsBrush`
      
      
      
      
      
      
      
      **~~~**

      
      **CreateLinearGradientBrush** `(self, x1, y1, x2, y2, stops)`
      
      
      
      
      :param `x1`: 
      :type `x1`: wx.Double
      :param `y1`: 
      :type `y1`: wx.Double
      :param `x2`: 
      :type `x2`: wx.Double
      :param `y2`: 
      :type `y2`: wx.Double
      :param `stops`: 
      :type `stops`: wx.GraphicsGradientStops
      
      
      
      
      :rtype: :ref:`wx.GraphicsBrush`
      
      
      
      
      
      
      
      **~~~**






   .. method:: CreateMatrix(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **CreateMatrix** `(self, a=1.0, b=0.0, c=0.0, d=1.0, tx=0.0, ty=0.0)`
      
      Creates a native affine transformation matrix from the passed in values.                  
      
      The default parameters result in an identity matrix.                  
      
      
      :param `a`: 
      :type `a`: wx.Double
      :param `b`: 
      :type `b`: wx.Double
      :param `c`: 
      :type `c`: wx.Double
      :param `d`: 
      :type `d`: wx.Double
      :param `tx`: 
      :type `tx`: wx.Double
      :param `ty`: 
      :type `ty`: wx.Double
      
      
      
      
      :rtype: :ref:`wx.GraphicsMatrix`
      
      
      
      
      
      
      
      **~~~**

      
      **CreateMatrix** `(self, mat)`
      
      Creates a native affine transformation matrix from the passed generic one.                  
      
                      
      
      
      :param `mat`: 
      :type `mat`: wx.AffineMatrix2DBase
      
      
      
      
      :rtype: :ref:`wx.GraphicsMatrix`
      
      
      
      
      
      
      
      .. versionadded:: 2.9.4 
           
      
      
      
      
      
      
      
      **~~~**






   .. method:: CreatePath(self)

      Creates a native graphics path which is initially empty.                  

      :rtype: :ref:`wx.GraphicsPath`








   .. method:: CreatePen(self, pen)

      Creates a native pen from a :ref:`wx.Pen`.                  


      :param `pen`: 
      :type `pen`: wx.Pen




      :rtype: :ref:`wx.GraphicsPen`








   .. method:: CreateRadialGradientBrush(self, *args, **kw)

      Creates a native brush with a radial gradient.                  

      The brush originates at (`xo`, `yc`) and ends on a circle around (`xc`, `yc`) with the given `radius`. 

      The gradient may be specified either by its start and end colours `oColor`  and `cColor`  or by a full set of gradient `stops`. 

      The version taking :ref:`wx.GraphicsGradientStops`  is new in wxWidgets 2.9.1.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **CreateRadialGradientBrush** `(self, xo, yo, xc, yc, radius, oColor, cColor)`
      
      
      
      
      :param `xo`: 
      :type `xo`: wx.Double
      :param `yo`: 
      :type `yo`: wx.Double
      :param `xc`: 
      :type `xc`: wx.Double
      :param `yc`: 
      :type `yc`: wx.Double
      :param `radius`: 
      :type `radius`: wx.Double
      :param `oColor`: 
      :type `oColor`: wx.Colour
      :param `cColor`: 
      :type `cColor`: wx.Colour
      
      
      
      
      :rtype: :ref:`wx.GraphicsBrush`
      
      
      
      
      
      
      
      **~~~**

      
      **CreateRadialGradientBrush** `(self, xo, yo, xc, yc, radius, stops)`
      
      
      
      
      :param `xo`: 
      :type `xo`: wx.Double
      :param `yo`: 
      :type `yo`: wx.Double
      :param `xc`: 
      :type `xc`: wx.Double
      :param `yc`: 
      :type `yc`: wx.Double
      :param `radius`: 
      :type `radius`: wx.Double
      :param `stops`: 
      :type `stops`: wx.GraphicsGradientStops
      
      
      
      
      :rtype: :ref:`wx.GraphicsBrush`
      
      
      
      
      
      
      
      **~~~**






   .. method:: CreateSubBitmap(self, bitmap, x, y, w, h)

      Extracts a sub-bitmap from an existing bitmap.                  

      Currently this function is implemented in the native MSW and OS X versions but not when using Cairo.                  


      :param `bitmap`: 
      :type `bitmap`: wx.GraphicsBitmap
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double




      :rtype: :ref:`wx.GraphicsBitmap`








   .. method:: DisableOffset(self)






   .. method:: DrawBitmap(self, *args, **kw)

      Draws the bitmap.                  

      In case of a mono bitmap, this is treated as a mask and the current brushed is used for filling.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **DrawBitmap** `(self, bmp, x, y, w, h)`
      
      
      
      
      :param `bmp`: 
      :type `bmp`: wx.GraphicsBitmap
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double
      
      
      
      
      
      
      **~~~**

      
      **DrawBitmap** `(self, bmp, x, y, w, h)`
      
      
      
      
      :param `bmp`: 
      :type `bmp`: wx.Bitmap
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double
      
      
      
      
      
      
      **~~~**






   .. method:: DrawEllipse(self, x, y, w, h)

      Draws an ellipse.                  


      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double







   .. method:: DrawIcon(self, icon, x, y, w, h)

      Draws the icon.                  


      :param `icon`: 
      :type `icon`: wx.Icon
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double







   .. method:: DrawLines(self, point2Ds, fillStyle=ODDEVEN_RULE)

      Draws a polygon.  





   .. method:: DrawPath(self, path, fillStyle=ODDEVEN_RULE)

      Draws the path by first filling and then stroking.                  


      :param `path`: 
      :type `path`: wx.GraphicsPath
      :param `fillStyle`: 
      :type `fillStyle`: wx.PolygonFillMode







   .. method:: DrawRectangle(self, x, y, w, h)

      Draws a rectangle.                  


      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double







   .. method:: DrawRoundedRectangle(self, x, y, w, h, radius)

      Draws a rounded rectangle.                  


      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      :param `w`: 
      :type `w`: wx.Double
      :param `h`: 
      :type `h`: wx.Double
      :param `radius`: 
      :type `radius`: wx.Double







   .. method:: DrawText(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **DrawText** `(self, str, x, y)`
      
      Draws text at the defined position.                  
      
      
      :param `str`: 
      :type `str`: string
      :param `x`: 
      :type `x`: wx.Double
      :param `y`: 
      :type `y`: wx.Double
      
      
      
      
      
      
      **~~~**

      
      **DrawText** `(self, str, x, y, angle)`
      
      Draws text at the defined position.                  
      
      
      
      
      :param `str`: The text to draw.   
      :type `str`: string
      :param `x`: The x coordinate position to draw the text at.   
      :type `x`: wx.Double
      :param `y`: The y coordinate position to draw the text at.   
      :type `y`: wx.Double
      :param `angle`: The angle relative to the (default) horizontal direction to draw the string.   
      :type `angle`: wx.Double
      
      
      
      
      
      
      
      
      
      
                        
      
      
      
      
      **~~~**

      
      **DrawText** `(self, str, x, y, backgroundBrush)`
      
      Draws text at the defined position.                  
      
      
      
      
      :param `str`: The text to draw.   
      :type `str`: string
      :param `x`: The x coordinate position to draw the text at.   
      :type `x`: wx.Double
      :param `y`: The y coordinate position to draw the text at.   
      :type `y`: wx.Double
      :param `backgroundBrush`: Brush to fill the text with.   
      :type `backgroundBrush`: wx.GraphicsBrush
      
      
      
      
      
      
      
      
      
      
                        
      
      
      
      
      **~~~**

      
      **DrawText** `(self, str, x, y, angle, backgroundBrush)`
      
      Draws text at the defined position.                  
      
      
      
      
      :param `str`: The text to draw.   
      :type `str`: string
      :param `x`: The x coordinate position to draw the text at.   
      :type `x`: wx.Double
      :param `y`: The y coordinate position to draw the text at.   
      :type `y`: wx.Double
      :param `angle`: The angle relative to the (default) horizontal direction to draw the string.   
      :type `angle`: wx.Double
      :param `backgroundBrush`: Brush to fill the text with.   
      :type `backgroundBrush`: wx.GraphicsBrush
      
      
      
      
      
      
      
      
      
      
      
      
                        
      
      
      
      
      **~~~**






   .. method:: EnableOffset(self, enable=True)




      :param `enable`: 
      :type `enable`: bool







   .. method:: EndDoc(self)

      Done with that document (relevant only for printing / pdf etc.)                   





   .. method:: EndLayer(self)

      Composites back the drawings into the context with the opacity given at the BeginLayer call.                   





   .. method:: EndPage(self)

      Ends the current page (relevant only for printing / pdf etc.)                   





   .. method:: FillPath(self, path, fillStyle=ODDEVEN_RULE)

      Fills the path with the current brush.                  


      :param `path`: 
      :type `path`: wx.GraphicsPath
      :param `fillStyle`: 
      :type `fillStyle`: wx.PolygonFillMode







   .. method:: Flush(self)

      Make sure that the current content of this context is immediately visible.                   





   .. method:: GetAntialiasMode(self)

      Returns the current shape antialiasing mode.                  

      :rtype: :ref:`wx.AntialiasMode`








   .. method:: GetCompositionMode(self)

      Returns the current compositing operator.                  

      :rtype: :ref:`wx.CompositionMode`








   .. method:: GetDPI(self)

      Returns the resolution of the graphics context in device points per inch.                  

      :rtype: `tuple`







      :returns: 

         ( `dpiX`, `dpiY` ) 








   .. method:: GetInterpolationQuality(self)

      Returns the current interpolation quality.                  

      :rtype: :ref:`wx.InterpolationQuality`








   .. method:: GetNativeContext(self)

      Returns the native context (CGContextRef for Core Graphics, Graphics pointer for GDIPlus and cairo_t pointer for cairo).                   





   .. method:: GetPartialTextExtents(self, text)

      Fills the `widths`  array with the widths from the beginning of `text`  to the corresponding character of `text`.                  


      :param `text`: 
      :type `text`: string




      :rtype: `list of floats`








   .. method:: GetSize(self)

      Returns the size of the graphics context in device coordinates.                  

      :rtype: `tuple`







      :returns: 

         ( `width`, `height` ) 








   .. method:: GetFullTextExtent(self, *args, **kw)



      |overload| Overloaded Implementations:

      **~~~**

      
      **GetFullTextExtent** `(self, text)`
      
      Gets the dimensions of the string using the currently selected font.                  
      
      
      
      
      :param `text`: The text string to measure.   
      :type `text`: string
      
      
      
      
      
      
      
      
      
      
      
      
      
      
      :rtype: `tuple`
      
      
      
                        
      
      
      
      :returns: 
      
         ( `width`, `height`, `descent`, `externalLeading` ) 
      
      
      
      
      
      
      
      **~~~**

      
      **GetFullTextExtent** `(self, text)`
      
      Gets the dimensions of the string using the currently selected font. 
      
      :rtype: `tuple`
      
      
      
      
      
      
      
      :returns: 
      
         ( `width`, `height` ) 
      
      
      
      
      
      
      
      **~~~**






   .. method:: GetTransform(self)

      Gets the current transformation matrix of this context.                  

      :rtype: :ref:`wx.GraphicsMatrix`








   .. method:: OffsetEnabled(self)



      :rtype: `bool`








   .. method:: PopState(self)

      Pops a stored state from the stack and sets the current transformation matrix to that state.                  

                 



      .. seealso:: :meth:`wx.GraphicsContext.PopState`     








   .. method:: PushState(self)

      Push the current state of the context's transformation matrix on a stack.                  

                 



      .. seealso:: :meth:`wx.GraphicsContext.PopState`     








   .. method:: ResetClip(self)

      Resets the clipping to original shape.                   





   .. method:: Rotate(self, angle)

      Rotates the current transformation matrix (in radians).                  


      :param `angle`: 
      :type `angle`: wx.Double







   .. method:: Scale(self, xScale, yScale)

      Scales the current transformation matrix.                  


      :param `xScale`: 
      :type `xScale`: wx.Double
      :param `yScale`: 
      :type `yScale`: wx.Double







   .. method:: SetAntialiasMode(self, antialias)

      Sets the antialiasing mode, returns ``True`` if it supported.                  


      :param `antialias`: 
      :type `antialias`: wx.AntialiasMode




      :rtype: `bool`








   .. method:: SetBrush(self, *args, **kw)

      Sets the brush for filling paths.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **SetBrush** `(self, brush)`
      
      
      
      
      :param `brush`: 
      :type `brush`: wx.Brush
      
      
      
      
      
      
      **~~~**

      
      **SetBrush** `(self, brush)`
      
      
      
      
      :param `brush`: 
      :type `brush`: wx.GraphicsBrush
      
      
      
      
      
      
      **~~~**






   .. method:: SetCompositionMode(self, op)

      Sets the compositing operator, returns ``True`` if it supported.                  


      :param `op`: 
      :type `op`: wx.CompositionMode




      :rtype: `bool`








   .. method:: SetFont(self, *args, **kw)

      Sets the font for drawing text.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **SetFont** `(self, font, colour)`
      
      
      
      
      :param `font`: 
      :type `font`: wx.Font
      :param `colour`: 
      :type `colour`: wx.Colour
      
      
      
      
      
      
      **~~~**

      
      **SetFont** `(self, font)`
      
      
      
      
      :param `font`: 
      :type `font`: wx.GraphicsFont
      
      
      
      
      
      
      **~~~**






   .. method:: SetInterpolationQuality(self, interpolation)

      Sets the interpolation quality, returns ``True`` if it is supported.                  

      Not implemented in Cairo backend currently. 

      Notice that in wxWidgets 3.0 the default interpolation quality for GDI+-based implementation is ``INTERPOLATION_GOOD``  and `not`  ``INTERPOLATION_DEFAULT``  (unlike under OS X with CoreGraphics-based implementation). This will be changed in wxWidgets 3.1 and later version, call this method explicitly instead of relying on the default value to ensure consistent behaviour across different platforms and versions.                  


      :param `interpolation`: 
      :type `interpolation`: wx.InterpolationQuality




      :rtype: `bool`








   .. method:: SetPen(self, *args, **kw)

      Sets the pen used for stroking.                   


      |overload| Overloaded Implementations:

      **~~~**

      
      **SetPen** `(self, pen)`
      
      
      
      
      :param `pen`: 
      :type `pen`: wx.Pen
      
      
      
      
      
      
      **~~~**

      
      **SetPen** `(self, pen)`
      
      
      
      
      :param `pen`: 
      :type `pen`: wx.GraphicsPen
      
      
      
      
      
      
      **~~~**






   .. method:: SetTransform(self, matrix)

      Sets the current transformation matrix of this context.                  


      :param `matrix`: 
      :type `matrix`: wx.GraphicsMatrix







   .. method:: ShouldOffset(self)



      :rtype: `bool`








   .. method:: StartDoc(self, message)

      Begin a new document (relevant only for printing / pdf etc.) If there is a progress dialog, message will be shown.                  


      :param `message`: 
      :type `message`: string




      :rtype: `bool`








   .. method:: StartPage(self, width=0, height=0)

      Opens a new page (relevant only for printing / pdf etc.) with the given size in points.                  

      (If both are null the default page size will be used.)                  


      :param `width`: 
      :type `width`: wx.Double
      :param `height`: 
      :type `height`: wx.Double







   .. method:: StrokeLine(self, x1, y1, x2, y2)

      Strokes a single line.                  


      :param `x1`: 
      :type `x1`: wx.Double
      :param `y1`: 
      :type `y1`: wx.Double
      :param `x2`: 
      :type `x2`: wx.Double
      :param `y2`: 
      :type `y2`: wx.Double







   .. method:: StrokeLineSegments(self, beginPoint2Ds, endPoint2Ds)

      Stroke disconnected lines from begin to end points.  





   .. method:: StrokeLines(self, point2Ds)

      Stroke lines conencting all the points.  





   .. method:: StrokePath(self, path)

      Strokes along a path with the current pen.                  


      :param `path`: 
      :type `path`: wx.GraphicsPath







   .. method:: Translate(self, dx, dy)

      Translates the current transformation matrix.                  


      :param `dx`: 
      :type `dx`: wx.Double
      :param `dy`: 
      :type `dy`: wx.Double







   .. attribute:: AntialiasMode

      See :meth:`~wx.GraphicsContext.GetAntialiasMode` and :meth:`~wx.GraphicsContext.SetAntialiasMode`


   .. attribute:: CompositionMode

      See :meth:`~wx.GraphicsContext.GetCompositionMode` and :meth:`~wx.GraphicsContext.SetCompositionMode`


   .. attribute:: InterpolationQuality

      See :meth:`~wx.GraphicsContext.GetInterpolationQuality` and :meth:`~wx.GraphicsContext.SetInterpolationQuality`


   .. attribute:: NativeContext

      See :meth:`~wx.GraphicsContext.GetNativeContext`


   .. attribute:: TextExtent

      See :meth:`~wx.GraphicsContext.GetTextExtent`


   .. attribute:: Transform

      See :meth:`~wx.GraphicsContext.GetTransform` and :meth:`~wx.GraphicsContext.SetTransform`

