Class: Wx::Pen
- Defined in:
- lib/wx/doc/gen/pen.rb,
lib/wx/doc/pen.rb
Overview
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.
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:
Class Method Summary collapse
-
.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.
Instance Method Summary collapse
-
#==(pen) ⇒ Boolean
Equality operator.
-
#get_cap ⇒ Wx::PenCap
(also: #cap)
Returns the pen cap style, which may be one of Wx::PenCap::CAP_ROUND, Wx::PenCap::CAP_PROJECTING and Wx::PenCap::CAP_BUTT.
-
#get_colour ⇒ Wx::Colour
(also: #colour)
Returns a reference to the pen colour.
-
#get_dashes ⇒ Array<Integer>
(also: #dashes)
Gets an array of dashes.
-
#get_join ⇒ Wx::PenJoin
(also: #join)
Returns the pen join style, which may be one of Wx::PenJoin::JOIN_BEVEL, Wx::PenJoin::JOIN_ROUND and Wx::PenJoin::JOIN_MITER.
-
#get_quality ⇒ Wx::PenQuality
(also: #quality)
Returns the pen quality.
-
#get_stipple ⇒ Wx::Bitmap
(also: #stipple)
Gets a pointer to the stipple bitmap.
-
#get_style ⇒ Wx::PenStyle
(also: #style)
Returns the pen style.
-
#get_width ⇒ Integer
(also: #width)
Returns the pen width.
-
#initialize(*args) ⇒ Pen
constructor
A new instance of Pen.
-
#is_non_transparent ⇒ Boolean
(also: #non_transparent?)
Returns true if the pen is a valid non-transparent pen.
-
#is_ok ⇒ Boolean
(also: #ok?)
Returns true if the pen is initialised.
-
#is_transparent ⇒ Boolean
(also: #transparent?)
Returns true if the pen is transparent.
-
#set_cap(capStyle) ⇒ void
(also: #cap=)
Sets the pen cap style, which may be one of Wx::PenCap::CAP_ROUND, Wx::PenCap::CAP_PROJECTING and Wx::PenCap::CAP_BUTT.
- #set_colour(*args) ⇒ Object (also: #colour=)
-
#set_dashes(dashes) ⇒ void
Associates an array of dash values with the pen.
-
#set_join(join_style) ⇒ void
(also: #join=)
Sets the pen join style, which may be one of Wx::PenJoin::JOIN_BEVEL, Wx::PenJoin::JOIN_ROUND and Wx::PenJoin::JOIN_MITER.
-
#set_quality(quality) ⇒ void
(also: #quality=)
Sets the pen quality.
-
#set_stipple(stipple) ⇒ void
(also: #stipple=)
Sets the bitmap for stippling.
-
#set_style(style) ⇒ void
(also: #style=)
Set the pen style.
-
#set_width(width) ⇒ void
(also: #width=)
Sets the pen width.
Methods inherited from GDIObject
Methods inherited from Object
#clone, #dup, #is_same_as, #un_share
Constructor Details
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.
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.
414 |
# File 'lib/wx/doc/gen/pen.rb', line 414 def ==(pen) end |
#get_cap ⇒ Wx::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.
278 |
# File 'lib/wx/doc/gen/pen.rb', line 278 def get_cap; end |
#get_colour ⇒ Wx::Colour Also known as: colour
Returns a reference to the pen colour.
295 |
# File 'lib/wx/doc/gen/pen.rb', line 295 def get_colour; end |
#get_dashes ⇒ Array<Integer> Also known as: dashes
Gets an array of dashes.
30 |
# File 'lib/wx/doc/pen.rb', line 30 def get_dashes; end |
#get_join ⇒ Wx::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.
303 |
# File 'lib/wx/doc/gen/pen.rb', line 303 def get_join; end |
#get_quality ⇒ Wx::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_stipple ⇒ Wx::Bitmap Also known as: stipple
Gets a pointer to the stipple bitmap.
311 |
# File 'lib/wx/doc/gen/pen.rb', line 311 def get_stipple; end |
#get_style ⇒ Wx::PenStyle Also known as: style
Returns the pen style.
320 |
# File 'lib/wx/doc/gen/pen.rb', line 320 def get_style; end |
#get_width ⇒ Integer Also known as: width
Returns the pen width.
328 |
# File 'lib/wx/doc/gen/pen.rb', line 328 def get_width; end |
#is_non_transparent ⇒ Boolean 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.
343 |
# File 'lib/wx/doc/gen/pen.rb', line 343 def is_non_transparent; end |
#is_ok ⇒ Boolean 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.
335 |
# File 'lib/wx/doc/gen/pen.rb', line 335 def is_ok; end |
#is_transparent ⇒ Boolean 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.
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.
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=
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.
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.
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.
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.
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.
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.
406 |
# File 'lib/wx/doc/gen/pen.rb', line 406 def set_width(width) end |