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 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 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.
See also
__init__ | Default constructor. |
GetColour | Returns a reference to the brush colour. |
GetStipple | Gets a pointer to the stipple bitmap. |
GetStyle | Returns the brush style, one of the BrushStyle values. |
IsHatch | Returns True if the style of the brush is any of hatched fills. |
IsNonTransparent | Returns True if the brush is a valid non-transparent brush. |
IsOk | Returns True if the brush is initialised. |
IsTransparent | Returns True if the brush is transparent. |
MacSetTheme | |
SetColour | Sets the brush colour using red, green and blue values. |
SetStipple | Sets the stipple bitmap. |
SetStyle | Sets the brush style. |
__nonzero__ | |
_copyFrom | For internal use only. |
__ne__ | Inequality operator. |
__eq__ | Equality operator. |
Colour | See GetColour and SetColour |
Stipple | See GetStipple and SetStipple |
Style | See GetStyle and SetStyle |
A brush is a drawing tool for filling in areas.
Possible constructors:
Brush()
Brush(colour, style=BRUSHSTYLE_SOLID)
Brush(stippleBitmap)
Brush(brush)
Overloaded Implementations:
__init__ (self)
Default constructor.
The brush will be uninitialised, and Brush: IsOk will return False.
__init__ (self, colour, style=BRUSHSTYLE_SOLID)
Constructs a brush from a colour object and style.
Parameters: |
|
---|
__init__ (self, stippleBitmap)
Constructs a stippled brush using a bitmap.
The brush style will be set to BRUSHSTYLE_STIPPLE .
Parameters: | stippleBitmap (Bitmap) – |
---|
__init__ (self, brush)
Copy constructor, uses reference counting.
Parameters: | brush (Brush) – |
---|
Gets a pointer to the stipple bitmap.
If the brush does not have a BRUSHSTYLE_STIPPLE style, this bitmap may be not None but uninitialised (i.e. Bitmap: IsOk returns False).
Return type: | Bitmap |
---|
See also
Returns the brush style, one of the BrushStyle values.
Return type: | BrushStyle |
---|
See also
Returns True if the style of the brush is any of hatched fills.
Return type: | bool |
---|
See also
Returns True if the brush is a valid non-transparent brush.
This method returns True if the brush object is initialized and has a non-transparent style. Notice that this should be used instead of simply testing whether GetStyle returns a style different from BRUSHSTYLE_TRANSPARENT if the brush may be invalid as GetStyle would assert in this case.
Return type: | bool |
---|
New in version 2.9.2..
See also
Returns True if the brush is initialised.
Notice that an uninitialized brush object can’t be queried for any brush properties and all calls to the accessor methods on it will result in an assert failure.
Return type: | bool |
---|
Returns True if the brush is transparent.
A transparent brush is simply a brush with BRUSHSTYLE_TRANSPARENT style.
Notice that this function works even for non-initialized brushes (for which it returns False) unlike tests of the form GetStyle == BRUSHSTYLE_TRANSPARENT which would assert if the brush is invalid.
Return type: | bool |
---|
New in version 2.9.2..
See also
Sets the brush colour using red, green and blue values.
See also
Overloaded Implementations:
SetColour (self, colour)
Parameters: | colour (Colour) – |
---|
SetColour (self, red, green, blue)
Parameters: |
|
---|
Sets the stipple bitmap.
Parameters: | bitmap (Bitmap) – The bitmap to use for stippling. |
---|
Note
The style will be set to BRUSHSTYLE_STIPPLE , unless the bitmap has a mask associated to it, in which case the style will be set to BRUSHSTYLE_STIPPLE_MASK_OPAQUE .
See also
Sets the brush style.
Parameters: | style (BrushStyle) – One of the BrushStyle values. |
---|
See also
Return type: | int |
---|
For internal use only.
Inequality operator.
See Object Comparison for more info.
Parameters: | brush (Brush) – |
---|
Equality operator.
See Object Comparison for more info.
Parameters: | brush (Brush) – |
---|
See GetStipple and SetStipple