.. include:: headings.inc .. _Brush: ========================================================================================================================================== |phoenix_title| **Brush** ========================================================================================================================================== A brush is a drawing tool for filling in areas. It is used for painting the background of rectangles, ellipses, etc. It has a colour and a style. On a monochrome display, wxWidgets shows all brushes as white unless the colour is really black. Do not initialize objects on the stack before the program commences, since other required structures may not have been set up yet. Instead, define global pointers to objects and create them in :meth:`App.OnInit` or when required. An application may wish to create brushes with different characteristics dynamically, and there is the consequent danger that a large number of duplicate brushes will be created. Therefore an application may wish to get a pointer to a brush by using the global list of brushes ``TheBrushList`` and calling the member function :meth:`BrushList.FindOrCreateBrush` . This class uses reference counting and copy-on-write internally so that assignments between two instances of this class are very cheap. You can therefore use actual objects instead of pointers without efficiency problems. If an instance of this class is changed it will create its own data internally so that other instances, which previously shared the data using the reference counting, are not affected. .. seealso:: :ref:`BrushList`, :ref:`DC`, :meth:`DC.SetBrush` | |class_hierarchy| Inheritance Diagram ===================================== Inheritance diagram for class **Brush** .. raw:: html
| |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~Brush.__init__` Default constructor. :meth:`~Brush.GetColour` Returns a reference to the brush colour. :meth:`~Brush.GetStipple` Gets a pointer to the stipple bitmap. :meth:`~Brush.GetStyle` Returns the brush style, one of the :ref:`BrushStyle` values. :meth:`~Brush.IsHatch` Returns ``True`` if the style of the brush is any of hatched fills. :meth:`~Brush.IsNonTransparent` Returns ``True`` if the brush is a valid non-transparent brush. :meth:`~Brush.IsOk` Returns ``True`` if the brush is initialised. :meth:`~Brush.IsTransparent` Returns ``True`` if the brush is transparent. :meth:`~Brush.MacSetTheme` :meth:`~Brush.SetColour` Sets the brush colour using red, green and blue values. :meth:`~Brush.SetStipple` Sets the stipple bitmap. :meth:`~Brush.SetStyle` Sets the brush style. :meth:`~Brush.__nonzero__` :meth:`~Brush._copyFrom` For internal use only. :meth:`~Brush.__ne__` Inequality operator. :meth:`~Brush.__eq__` Equality operator. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~Brush.Colour` See :meth:`~Brush.GetColour` and :meth:`~Brush.SetColour` :attr:`~Brush.Stipple` See :meth:`~Brush.GetStipple` and :meth:`~Brush.SetStipple` :attr:`~Brush.Style` See :meth:`~Brush.GetStyle` and :meth:`~Brush.SetStyle` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: Brush(GDIObject) A brush is a drawing tool for filling in areas. **Possible constructors**:: Brush() Brush(colour, style=BRUSHSTYLE_SOLID) Brush(stippleBitmap) Brush(brush) .. method:: __init__(self, *args, **kw) |overload| **Overloaded Implementations**: **~~~** **__init__** `(self)` Default constructor. The brush will be uninitialised, and :ref:`Brush`: :meth:`IsOk` will return ``False``. **~~~** **__init__** `(self, colour, style=BRUSHSTYLE_SOLID)` Constructs a brush from a colour object and `style`. :param `colour`: Colour object. :type `colour`: Colour :param `style`: One of the :ref:`BrushStyle` enumeration values. :type `style`: BrushStyle **~~~** **__init__** `(self, stippleBitmap)` Constructs a stippled brush using a bitmap. The brush style will be set to ``BRUSHSTYLE_STIPPLE`` . :param `stippleBitmap`: :type `stippleBitmap`: Bitmap **~~~** **__init__** `(self, brush)` Copy constructor, uses :ref:`reference counting