wxPen
Module
Module Summary
Description
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 wxApp::OnInit() (not implemented in wx) 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 ?wxThePenList, and calling the member function wxPenList::FindOrCreatePen() (not implemented in wx). See wxPenList (not implemented in wx) 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.
Predefined objects/pointers:
See: wxPenList (not implemented in wx), wxDC, wxDC:setPen/2
wxWidgets docs: wxPen
new() -> wxPen()
|
Default constructor.
The pen will be uninitialised, and isOk/1 will return false.
new(Colour) -> wxPen()
|
new(Pen) -> wxPen()
|
Types
Copy constructor, uses overview_refcount.
new(Colour, Options :: [Option]) -> wxPen()
|
Constructs a pen from a colour object, pen width and style.
Remark: Different versions of Windows and different versions of other platforms support very different subsets of the styles above so handle with care.
See: setStyle/2, setColour/4, setWidth/2
destroy(This :: wxPen()) -> ok |
Destructor.
See: reference-counted object destruction
Remark: Although all remaining pens are deleted when the application exits, the application should try to clean up all pens itself. This is because wxWidgets cannot know if a pointer to the pen object is stored in an application data structure, and there is a risk of double deletion.
getCap(This) -> wx:wx_enum()
|
Types
Returns the pen cap style, which may be one of wxCAP_ROUND, wxCAP_PROJECTING and wxCAP_BUTT.
The default is wxCAP_ROUND.
See: setCap/2
getColour(This) -> wx:wx_colour4()
|
Types
Returns a reference to the pen colour.
See: setColour/4
getJoin(This) -> wx:wx_enum()
|
Types
Returns the pen join style, which may be one of wxJOIN_BEVEL, wxJOIN_ROUND and wxJOIN_MITER.
The default is wxJOIN_ROUND.
See: setJoin/2
getStyle(This) -> wx:wx_enum()
|
Types
Returns the pen style.
See: new/2, setStyle/2
Types
Returns the pen width.
See: setWidth/2
Types
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.
Sets the pen cap style, which may be one of wxCAP_ROUND, wxCAP_PROJECTING and wxCAP_BUTT.
The default is wxCAP_ROUND.
See: getCap/1
The pen's colour is changed to the given colour.
See: getColour/1
Sets the pen join style, which may be one of wxJOIN_BEVEL, wxJOIN_ROUND and wxJOIN_MITER.
The default is wxJOIN_ROUND.
See: getJoin/1
Set the pen style.
See: new/2
Sets the pen width.
See: getWidth/1