Class: Wx::Brush

Inherits:
GDIObject show all
Defined in:
lib/wx/doc/gen/brush.rb,
lib/wx/doc/brush.rb

Overview

Note:

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:

See Also:

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GDIObject

#clone, #dup

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::Brush #initialize(colour, style = Wx::BrushStyle::BRUSHSTYLE_SOLID) ⇒ Wx::Brush #initialize(stippleBitmap) ⇒ Wx::Brush #initialize(brush) ⇒ Wx::Brush

Returns a new instance of Brush.

Overloads:

  • #initializeWx::Brush

    Default constructor.

    The brush will be uninitialised, and Wx::Brush:#is_ok will return false.

  • #initialize(colour, style = Wx::BrushStyle::BRUSHSTYLE_SOLID) ⇒ Wx::Brush

    Constructs a brush from a colour object and style.

    Parameters:

  • #initialize(stippleBitmap) ⇒ Wx::Brush

    Constructs a stippled brush using a bitmap.

    The brush style will be set to Wx::BrushStyle::BRUSHSTYLE_STIPPLE.

    Parameters:

  • #initialize(brush) ⇒ Wx::Brush

    Copy constructor, uses reference counting.

    Parameters:



159
# File 'lib/wx/doc/gen/brush.rb', line 159

def initialize(*args) end

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.

Parameters:

  • colour (Wx::Colour, String, Symbol)

    The Brush colour.

  • style (Wx::BrushStyle) (defaults to: Wx::BrushStyle::BRUSHSTYLE_SOLID)

    The brush style. See Wx::BrushStyle for a list of the styles.

Returns:



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.

Parameters:

Returns:

  • (Boolean)


246
# File 'lib/wx/doc/gen/brush.rb', line 246

def ==(brush) end

#get_colourWx::Colour Also known as: colour

Returns a reference to the brush colour.

Returns:

See Also:



166
# File 'lib/wx/doc/gen/brush.rb', line 166

def get_colour; end

#get_stippleWx::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).

Returns:

See Also:



174
# File 'lib/wx/doc/gen/brush.rb', line 174

def get_stipple; end

#get_styleWx::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_hatchBoolean Also known as: hatch?

Returns true if the style of the brush is any of hatched fills.

Returns:

  • (Boolean)

See Also:



192
# File 'lib/wx/doc/gen/brush.rb', line 192

def is_hatch; end

#is_non_transparentBoolean 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.

Returns:

  • (Boolean)

See Also:



207
# File 'lib/wx/doc/gen/brush.rb', line 207

def is_non_transparent; end

#is_okBoolean 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.

Returns:

  • (Boolean)


199
# File 'lib/wx/doc/gen/brush.rb', line 199

def is_ok; end

#is_transparentBoolean 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.

Returns:

  • (Boolean)

See Also:



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=

Overloads:

  • #set_colour(colour) ⇒ void

    This method returns an undefined value.

    Sets the brush colour using red, green and blue values.

    Parameters:

    See Also:

  • #set_colour(red, green, blue) ⇒ void

    This method returns an undefined value.

    Sets the brush colour using red, green and blue values.

    Parameters:

    • red (Integer)
    • green (Integer)
    • blue (Integer)

    See Also:



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.

Remark:

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.

Parameters:

  • bitmap (Wx::Bitmap)

    The bitmap to use for stippling.

See Also:



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.

Parameters:

See Also:



238
# File 'lib/wx/doc/gen/brush.rb', line 238

def set_style(style) end