Class: Wx::Brush
- Defined in:
- lib/wx/doc/gen/brush.rb,
lib/wx/doc/brush.rb
Overview
This class is untracked and should not be derived from nor instances extended!
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 Wx::BrushList#find_or_create_brush. 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.
Category: Graphics Device Interface (GDI) Predefined objects/pointers:
Class Method Summary collapse
-
.find_or_create_brush(colour, style = Wx::BrushStyle::BRUSHSTYLE_SOLID) ⇒ Wx::Brush
Finds a brush with the specified attributes in the global list and returns it, else creates a new brush, adds it to the global brush list, and returns it.
Instance Method Summary collapse
-
#==(brush) ⇒ Boolean
Equality operator.
-
#get_colour ⇒ Wx::Colour
(also: #colour)
Returns a reference to the brush colour.
-
#get_stipple ⇒ Wx::Bitmap
(also: #stipple)
Gets a pointer to the stipple bitmap.
-
#get_style ⇒ Wx::BrushStyle
(also: #style)
Returns the brush style, one of the BrushStyle values.
-
#initialize(*args) ⇒ Brush
constructor
A new instance of Brush.
-
#is_hatch ⇒ Boolean
(also: #hatch?)
Returns true if the style of the brush is any of hatched fills.
-
#is_non_transparent ⇒ Boolean
(also: #non_transparent?)
Returns true if the brush is a valid non-transparent brush.
-
#is_ok ⇒ Boolean
(also: #ok?)
Returns true if the brush is initialised.
-
#is_transparent ⇒ Boolean
(also: #transparent?)
Returns true if the brush is transparent.
- #set_colour(*args) ⇒ Object (also: #colour=)
-
#set_stipple(bitmap) ⇒ void
(also: #stipple=)
Sets the stipple bitmap.
-
#set_style(style) ⇒ void
(also: #style=)
Sets the brush style.
Methods inherited from GDIObject
Methods inherited from Object
#clone, #dup, #is_same_as, #un_share
Constructor Details
Class Method Details
.find_or_create_brush(colour, style = Wx::BrushStyle::BRUSHSTYLE_SOLID) ⇒ Wx::Brush
Finds a brush with the specified attributes in the global list and returns it, else creates a new brush, adds it to the global brush list, and returns it.
16 |
# File 'lib/wx/doc/brush.rb', line 16 def self.find_or_create_brush(colour, style=Wx::BrushStyle::BRUSHSTYLE_SOLID) end |
Instance Method Details
#==(brush) ⇒ Boolean
Equality operator.
See Object Comparison for more info.
246 |
# File 'lib/wx/doc/gen/brush.rb', line 246 def ==(brush) end |
#get_colour ⇒ Wx::Colour Also known as: colour
Returns a reference to the brush colour.
166 |
# File 'lib/wx/doc/gen/brush.rb', line 166 def get_colour; end |
#get_stipple ⇒ Wx::Bitmap Also known as: stipple
Gets a pointer to the stipple bitmap.
If the brush does not have a Wx::BrushStyle::BRUSHSTYLE_STIPPLE style, this bitmap may be non-NULL but uninitialised (i.e. Wx::Bitmap:#is_ok returns false).
174 |
# File 'lib/wx/doc/gen/brush.rb', line 174 def get_stipple; end |
#get_style ⇒ Wx::BrushStyle Also known as: style
Returns the brush style, one of the Wx::BrushStyle values.
184 |
# File 'lib/wx/doc/gen/brush.rb', line 184 def get_style; end |
#is_hatch ⇒ Boolean Also known as: hatch?
Returns true if the style of the brush is any of hatched fills.
192 |
# File 'lib/wx/doc/gen/brush.rb', line 192 def is_hatch; end |
#is_non_transparent ⇒ Boolean Also known as: non_transparent?
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 #get_style returns a style different from Wx::BrushStyle::BRUSHSTYLE_TRANSPARENT if the brush may be invalid as #get_style would assert in this case.
207 |
# File 'lib/wx/doc/gen/brush.rb', line 207 def is_non_transparent; end |
#is_ok ⇒ Boolean Also known as: ok?
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.
199 |
# File 'lib/wx/doc/gen/brush.rb', line 199 def is_ok; end |
#is_transparent ⇒ Boolean Also known as: transparent?
Returns true if the brush is transparent.
A transparent brush is simply a brush with Wx::BrushStyle::BRUSHSTYLE_TRANSPARENT style. Notice that this function works even for non-initialized brushes (for which it returns false) unlike tests of the form get_style == wxBRUSHSTYLE_TRANSPARENT
which would assert if the brush is invalid.
216 |
# File 'lib/wx/doc/gen/brush.rb', line 216 def is_transparent; end |
#set_colour(colour) ⇒ void #set_colour(red, green, blue) ⇒ void Also known as: colour=
136 |
# File 'lib/wx/doc/gen/brush.rb', line 136 def set_colour(*args) end |
#set_stipple(bitmap) ⇒ void Also known as: stipple=
This method returns an undefined value.
Sets the stipple bitmap.
The style will be set to Wx::BrushStyle::BRUSHSTYLE_STIPPLE, unless the bitmap has a mask associated to it, in which case the style will be set to Wx::BrushStyle::BRUSHSTYLE_STIPPLE_MASK_OPAQUE.
229 |
# File 'lib/wx/doc/gen/brush.rb', line 229 def set_stipple(bitmap) end |
#set_style(style) ⇒ void Also known as: style=
This method returns an undefined value.
Sets the brush style.
238 |
# File 'lib/wx/doc/gen/brush.rb', line 238 def set_style(style) end |