Class: Wx::Pen

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

Overview

Note:

This class is untracked and should not be derived from nor instances extended!

A pen is a drawing tool for drawing outlines.

It is used for drawing lines and painting the outline of rectangles, ellipses, etc. It has a colour, a width and a style.

Note:

On a monochrome display, wxWidgets shows all non-white pens as 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#on_init or when required. An application may wish to dynamically create pens with different characteristics, and there is the consequent danger that a large number of duplicate pens will be created. Therefore an application may wish to get a pointer to a pen by using the global list of pens ThePenList, and calling the member function Wx::PenList#find_or_create_pen. See PenList for more info. 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::Pen #initialize(colour, width = 1, style = Wx::PenStyle::PENSTYLE_SOLID) ⇒ Wx::Pen #initialize(stipple, width) ⇒ Wx::Pen #initialize(pen) ⇒ Wx::Pen

Returns a new instance of Pen.

Overloads:



271
# File 'lib/wx/doc/gen/pen.rb', line 271

def initialize(*args) end

Class Method Details

.find_or_create_pen(colour, width = 1, style = Wx::PenStyle::PENSTYLE_SOLID) ⇒ Wx::Pen

Finds a pen with the specified attributes in the global list and returns it, else creates a new pen, adds it to the global pen list, and returns it.

Parameters:

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

    Colour of the pen.

  • width (Integer) (defaults to: 1)

    Width of the pen.

  • style (Wx::PenStyle) (defaults to: Wx::PenStyle::PENSTYLE_SOLID)

    Pen style. See Wx::PenStyle for a list of styles.

Returns:



17
# File 'lib/wx/doc/pen.rb', line 17

def self.find_or_create_pen(colour, width=1, style=Wx::PenStyle::PENSTYLE_SOLID) end

Instance Method Details

#==(pen) ⇒ Boolean

Equality operator.

See reference-counted object comparison for more info.

Parameters:

Returns:

  • (Boolean)


414
# File 'lib/wx/doc/gen/pen.rb', line 414

def ==(pen) end

#get_capWx::PenCap Also known as: cap

Returns the pen cap style, which may be one of Wx::PenCap::CAP_ROUND, Wx::PenCap::CAP_PROJECTING and Wx::PenCap::CAP_BUTT.

The default is Wx::PenCap::CAP_ROUND.

Returns:

See Also:



278
# File 'lib/wx/doc/gen/pen.rb', line 278

def get_cap; end

#get_colourWx::Colour Also known as: colour

Returns a reference to the pen colour.

Returns:

See Also:



295
# File 'lib/wx/doc/gen/pen.rb', line 295

def get_colour; end

#get_dashesArray<Integer> Also known as: dashes

Gets an array of dashes.

Returns:

  • (Array<Integer>)

See Also:



30
# File 'lib/wx/doc/pen.rb', line 30

def get_dashes; end

#get_joinWx::PenJoin Also known as: join

Returns the pen join style, which may be one of Wx::PenJoin::JOIN_BEVEL, Wx::PenJoin::JOIN_ROUND and Wx::PenJoin::JOIN_MITER.

The default is Wx::PenJoin::JOIN_ROUND.

Returns:

See Also:



303
# File 'lib/wx/doc/gen/pen.rb', line 303

def get_join; end

#get_qualityWx::PenQuality Also known as: quality

Returns the pen quality.

The default is Wx::PenQuality::PEN_QUALITY_DEFAULT.



287
# File 'lib/wx/doc/gen/pen.rb', line 287

def get_quality; end

#get_stippleWx::Bitmap Also known as: stipple

Gets a pointer to the stipple bitmap.

Returns:

See Also:



311
# File 'lib/wx/doc/gen/pen.rb', line 311

def get_stipple; end

#get_styleWx::PenStyle Also known as: style

Returns the pen style.

Returns:

See Also:



320
# File 'lib/wx/doc/gen/pen.rb', line 320

def get_style; end

#get_widthInteger Also known as: width

Returns the pen width.

Returns:

  • (Integer)

See Also:



328
# File 'lib/wx/doc/gen/pen.rb', line 328

def get_width; end

#is_non_transparentBoolean Also known as: non_transparent?

Returns true if the pen is a valid non-transparent pen.

This method returns true if the pen 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::PenStyle::PENSTYLE_TRANSPARENT if the pen may be invalid as #get_style would assert in this case.

Returns:

  • (Boolean)

See Also:



343
# File 'lib/wx/doc/gen/pen.rb', line 343

def is_non_transparent; end

#is_okBoolean Also known as: ok?

Returns true if the pen is initialised.

Notice that an uninitialized pen object can’t be queried for any pen properties and all calls to the accessor methods on it will result in an assert failure.

Returns:

  • (Boolean)


335
# File 'lib/wx/doc/gen/pen.rb', line 335

def is_ok; end

#is_transparentBoolean Also known as: transparent?

Returns true if the pen is transparent.

A transparent pen is simply a pen with Wx::PenStyle::PENSTYLE_TRANSPARENT style. Notice that this function works even for non-initialized pens (for which it returns false) unlike tests of the form get_style == wxPENSTYLE_TRANSPARENT which would assert if the pen is invalid.

Returns:

  • (Boolean)

See Also:



352
# File 'lib/wx/doc/gen/pen.rb', line 352

def is_transparent; end

#set_cap(capStyle) ⇒ void Also known as: cap=

This method returns an undefined value.

Sets the pen cap style, which may be one of Wx::PenCap::CAP_ROUND, Wx::PenCap::CAP_PROJECTING and Wx::PenCap::CAP_BUTT.

The default is Wx::PenCap::CAP_ROUND.

Parameters:

See Also:



361
# File 'lib/wx/doc/gen/pen.rb', line 361

def set_cap(capStyle) 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.

    The pen’s colour is changed to the given colour.

    Parameters:

    See Also:

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

    This method returns an undefined value.

    The pen’s colour is changed to the given colour.

    Parameters:

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

    See Also:



234
# File 'lib/wx/doc/gen/pen.rb', line 234

def set_colour(*args) end

#set_dashes(dashes) ⇒ void

This method returns an undefined value.

Associates an array of dash values with the pen.

Parameters:

  • dashes (Array<Integer>)

See Also:



24
# File 'lib/wx/doc/pen.rb', line 24

def set_dashes(dashes) end

#set_join(join_style) ⇒ void Also known as: join=

This method returns an undefined value.

Sets the pen join style, which may be one of Wx::PenJoin::JOIN_BEVEL, Wx::PenJoin::JOIN_ROUND and Wx::PenJoin::JOIN_MITER.

The default is Wx::PenJoin::JOIN_ROUND.

Parameters:

See Also:



379
# File 'lib/wx/doc/gen/pen.rb', line 379

def set_join(join_style) end

#set_quality(quality) ⇒ void Also known as: quality=

This method returns an undefined value.

Sets the pen quality.

Explicitly selecting low pen quality may be useful in WXMSW if drawing performance is more important than the exact appearance of the lines drawn with this pen.

Parameters:

See Also:



370
# File 'lib/wx/doc/gen/pen.rb', line 370

def set_quality(quality) end

#set_stipple(stipple) ⇒ void Also known as: stipple=

This method returns an undefined value.

Sets the bitmap for stippling.

Parameters:

See Also:



388
# File 'lib/wx/doc/gen/pen.rb', line 388

def set_stipple(stipple) end

#set_style(style) ⇒ void Also known as: style=

This method returns an undefined value.

Set the pen style.

Parameters:

See Also:

  • pen


397
# File 'lib/wx/doc/gen/pen.rb', line 397

def set_style(style) end

#set_width(width) ⇒ void Also known as: width=

This method returns an undefined value.

Sets the pen width.

Parameters:

  • width (Integer)

See Also:



406
# File 'lib/wx/doc/gen/pen.rb', line 406

def set_width(width) end