wxPen(3)
π NAME π
okay bestie, welcome to the wxPen(3) page β it lives in the Erlang Module Definition section and it's all about wxPen.
A pen is a drawing tool for drawing outlines. that's the whole vibe. ποΈ
β¨ DESCRIPTION β¨
So what does a pen actually do? It draws lines, and it paints the outline of rectangles, ellipses, etc. That's it, that's the job. It's got three things going on: a colour, a width and a style. iconic triple threat energy. π
Note: On a monochrome display, wxWidgets shows all non-white pens as black. no cap, that's just what it does.
BIG IMPORTANT ONE, don't skip this: Do not initialize objects on the stack before the program commences, because 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 just create them whenever you actually need them.
Another thing: an app might wanna dynamically create pens with different characteristics, and there's the consequent danger that you'll end up creating a whole crowd of duplicate pens. like, a lot of them. π So instead, you might wanna 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). Peep wxPenList (not implemented in wx) for more info. π«Ά
Now the fun part: this class uses reference counting and copy-on-write internally, which means assignments between two instances of this class are super cheap. So you can use actual objects instead of pointers with zero efficiency problems β go off. And if an instance of this class gets changed, it creates its own data internally, so the other instances that were previously sharing the data via the reference counting do not get affected. protective queen behavior honestly. π
π Predefined objects (include wx.hrl) π
?wxNullPen?wxBLACK_DASHED_PEN?wxBLACK_PEN?wxBLUE_PEN?wxCYAN_PEN?wxGREEN_PEN?wxYELLOW_PEN?wxGREY_PEN?wxLIGHT_GREY_PEN?wxMEDIUM_GREY_PEN?wxRED_PEN?wxTRANSPARENT_PEN?wxWHITE_PEN
π See:
wxDCwxDC:setPen/2
wxWidgets docs: wxPen
π DATA TYPES π
wxPen() :: wx:wx_object().
that's the one and only type, she's simple and she serves. β
π₯ FUNCTIONS π₯
π« destroy(This :: wxPen()) -> ok.
Destroys the object. bye bestie, it was real. π¦
π« getCap(This) -> wx:wx_enum() when This :: wxPen().
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() when This :: wxPen().
Returns a reference to the pen colour.
See: setColour/4
π« getJoin(This) -> wx:wx_enum() when This :: wxPen().
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() when This :: wxPen().
Returns the pen style.
See:
new/2setStyle/2
π« getWidth(This) -> integer() when This :: wxPen().
Returns the pen width.
See: setWidth/2
π« isOk(This) -> boolean() when This :: wxPen().
Returns true if the pen is initialised.
Notice: 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. π so like. don't do that.
π« new() -> wxPen().
Default constructor.
The pen will be uninitialised, and isOk/1 will return false.
π« new(Colour) -> wxPen() when Colour :: wx:wx_colour(); (Pen) -> wxPen() when Pen :: wxPen().
Copy constructor, uses overview_refcount.
π« new(Colour, [Option]) -> wxPen() when Colour :: wx:wx_colour(), Option :: {width, integer()} | {style, wx:wx_enum()}.
new(Colour, [Option]) -> wxPen()
when
Colour :: wx:wx_colour(),
Option :: {width, integer()} | {style, wx:wx_enum()}.
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. fr fr, be gentle with her. π
See:
setStyle/2setColour/4setWidth/2
π« setCap(This, CapStyle) -> ok when This :: wxPen(), CapStyle :: wx:wx_enum().
setCap(This, CapStyle) -> ok
when This :: wxPen(), CapStyle :: wx:wx_enum().
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
π« setColour(This, Colour) -> ok when This :: wxPen(), Colour :: wx:wx_colour().
setColour(This, Colour) -> ok
when This :: wxPen(), Colour :: wx:wx_colour().
The pen's colour is changed to the given colour. π
See: getColour/1
π« setColour(This, Red, Green, Blue) -> ok when This :: wxPen(), Red :: integer(), Green :: integer(), Blue :: integer().
setColour(This, Red, Green, Blue) -> ok
when
This :: wxPen(),
Red :: integer(),
Green :: integer(),
Blue :: integer().
π« setJoin(This, Join_style) -> ok when This :: wxPen(), Join_style :: wx:wx_enum().
setJoin(This, Join_style) -> ok
when This :: wxPen(), Join_style :: wx:wx_enum().
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
π« setStyle(This, Style) -> ok when This :: wxPen(), Style :: wx:wx_enum().
setStyle(This, Style) -> ok
when This :: wxPen(), Style :: wx:wx_enum().
Set the pen style.
See: new/2
π« setWidth(This, Width) -> ok when This :: wxPen(), Width :: integer().
setWidth(This, Width) -> ok
when This :: wxPen(), Width :: integer().
Sets the pen width.
See: getWidth/1
and that's the whole page, bestie!! πβ¨ this one came from Ericsson AB and it's the wx 2.6 era of the docs β go draw something cute with it. π no cap, you're gonna slay.
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms