.. wxPython Phoenix documentation

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

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

.. include:: headings.inc

.. currentmodule:: wx.lib.graphics

.. highlight:: python



.. _wx.lib.graphics.GraphicsBrush:

==========================================================================================================================================
|phoenix_title|  **wx.lib.graphics.GraphicsBrush**
==========================================================================================================================================

A ``GraphicsBrush`` is used to define how fills are painted.
They can have either a solid fill (colors with or without alpha), a
stipple created from a :class:`wx.Bitmap`, or a Cairo ``Pattern``
object.



|

|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>GraphicsBrush</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.lib.graphics.GraphicsBrush_inheritance.png" alt="Inheritance diagram of GraphicsBrush" 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.lib.graphics.GraphicsObject.html" title="Base class for the other ``Graphics*`` classes." alt="" coords="5,5,220,35"/> <area shape="rect" id="node2" href="wx.lib.graphics.GraphicsBrush.html" title="A ``GraphicsBrush`` is used to define how fills are painted." alt="" coords="7,83,218,112"/> </map> 
   </p>

|


|super_classes| Known Superclasses
==================================

:class:`wx.lib.graphics.GraphicsObject`

|


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

================================================================================ ================================================================================
:meth:`~wx.lib.graphics.GraphicsBrush.__init__`                                  Create a new ``GraphicsBrush``.
:meth:`~wx.lib.graphics.GraphicsBrush.Apply`                                     Apply this brush's properties to the given context.
:meth:`~wx.lib.graphics.GraphicsBrush.CreateFromBrush`                           Converts a :class:`wx.Brush` to a ``GraphicsBrush``.
:meth:`~wx.lib.graphics.GraphicsBrush.CreateFromPattern`                         Create a ``GraphicsBrush`` directly from a Cairo ``Pattern`` object.
================================================================================ ================================================================================


|


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

================================================================================ ================================================================================
:attr:`~wx.lib.graphics.GraphicsBrush.Colour`                                    The color to use when filling with the brush.
:attr:`~wx.lib.graphics.GraphicsBrush.Pattern`                                   A pattern to be used when filling with this brush.
:attr:`~wx.lib.graphics.GraphicsBrush.Stipple`                                   The Stipple is a bitmap to be used as a pattern when filling with this brush.
:attr:`~wx.lib.graphics.GraphicsBrush.Style`                                     The style of the brush to be used when filling.
================================================================================ ================================================================================


|


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


.. class:: GraphicsBrush(GraphicsObject)

   A ``GraphicsBrush`` is used to define how fills are painted.
   They can have either a solid fill (colors with or without alpha), a
   stipple created from a :class:`wx.Bitmap`, or a Cairo ``Pattern``
   object.

   .. method:: __init__(self, colour=wx.BLACK, style=wx.BRUSHSTYLE_SOLID)

      Create a new ``GraphicsBrush``.


   .. method:: Apply(self, ctx)

      Apply this brush's properties to the given context.
      Called by :class:`GraphicsContext` as needed.


   .. staticmethod:: CreateFromBrush(brush)

      Converts a :class:`wx.Brush` to a ``GraphicsBrush``.


   .. staticmethod:: CreateFromPattern(pattern)

      Create a ``GraphicsBrush`` directly from a Cairo ``Pattern`` object.
      This is similar to using a stipple bitmap, but saves a step, and
      patterns can include gradients, etc.


   .. attribute:: Colour

      The color to use when filling with the brush.
      
      :type: :class:`wx.Colour`


   .. attribute:: Pattern

      A pattern to be used when filling with this brush.
      
      :type: Cairo ``Pattern``


   .. attribute:: Stipple

      The Stipple is a bitmap to be used as a pattern when filling with this brush.
      
      This will be converted to a Cairo ``Pattern`` when applied to
      a :class:`GraphicsContext`.
      
      :type: :class:`wx.Bitmap`


   .. attribute:: Style

      The style of the brush to be used when filling.
      Currently, ``wx.BRUSHSTYLE_SOLID`` and ``wx.BRUSHSTYLE_STIPPLE``
      are supported.
      
      :type: :ref:`wx.BrushStyle`


