wxPen(3erl)
π wxPen β the Erlang module definition, bestie π
okay so this is the wxPen page from the Erlang module definition set β it's all about the pen object, aka the lil drawing tool that gives your lines their whole look. ngl it's a good one. let's get into it π
β¨ NAME β¨
wxPen β literally just "Functions for wxPen class." that's it, that's the name, short and iconic π«Ά
πΈ DESCRIPTION πΈ
okay so picture this: a pen is a drawing tool for drawing outlines. that's its whole job. it draws lines, and it paints the outline of rectangles, ellipses, etc. it's got three personality traits: a colour, a width, and a style. main character energy fr β¨
π Note: on a monochrome display, wxWidgets shows all non-white pens as black. so like... your gorgeous pink pen? black. your mint green pen? also black. monochrome said "no." π
Do not initialize objects on the stack before the program commences β highkey important, 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 whenever they're actually needed.
so an application may wish to dynamically create pens with different characteristics β and there's the consequent danger that a large number of duplicate pens will be created π yeah. pen hoarding. it's real. 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 π¦
okay and this part is so slay: 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. it's giving "i'm not like other pens." iykyk π
Predefined objects (include wx.hrl):
See: wxPenList (not implemented in wx), wxDC, wxDC:setPen/2
wxWidgets docs: wxPen
π¦ DATA TYPES π¦
wxPen() = wx:wx_object()
that's the whole type section, she's compact and she knows it π
π EXPORTS π
new() -> wxPen()
new()β default constructor. the pen will be uninitialised, andisOk/1will returnfalse. so like, she exists but she's not ready yet, y'know? πΈ
new(Colour) -> wxPen()
new(Pen) -> wxPen()
new(Pen)β copy constructor, usesoverview_refcount.- Types:
Pen = wxPen()
- Types:
new(Colour, Options :: [Option]) -> wxPen()
new(Colour, Options :: [Option])β constructs a pen from a colour object, pen width and style β¨- Types:
Colour = wx:wx_colour()Option = {width, integer()} | {style, wx:wx_enum()}
- Types:
β οΈ Remark: different versions of Windows and different versions of other platforms support very different subsets of the styles above, so handle with care, bestie π like genuinely, don't assume, ok?
See: setStyle/2, setColour/4, setWidth/2
destroy(This :: wxPen()) -> ok
destroy(This :: wxPen())β 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 π so like... clean up after yourself, pls and thank u.
getCap(This) -> wx:wx_enum()
getCap(This)β returns the pen cap style, which may be one ofwxCAP_ROUND,wxCAP_PROJECTINGandwxCAP_BUTT. the default iswxCAP_ROUNDπ- Types:
This = wxPen()
- Types:
See: setCap/2
getColour(This) -> wx:wx_colour4()
getColour(This)β returns a reference to the pen colour π¨- Types:
This = wxPen()
- Types:
See: setColour/4
getJoin(This) -> wx:wx_enum()
getJoin(This)β returns the pen join style, which may be one ofwxJOIN_BEVEL,wxJOIN_ROUNDandwxJOIN_MITER. the default iswxJOIN_ROUNDβ- Types:
This = wxPen()
- Types:
See: setJoin/2
getStyle(This) -> wx:wx_enum()
getStyle(This)β returns the pen style π«- Types:
This = wxPen()
- Types:
See: new/2, setStyle/2
getWidth(This) -> integer()
getWidth(This)β returns the pen width π- Types:
This = wxPen()
- Types:
See: setWidth/2
isOk(This) -> boolean()
isOk(This)β returnstrueif the pen is initialised π- Types:
This = wxPen()
- Types:
π 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 do the vibe check first, bestie. ask isOk/1 before you go poking at her internals π
setCap(This, CapStyle) -> ok
setCap(This, CapStyle)β sets the pen cap style, which may be one ofwxCAP_ROUND,wxCAP_PROJECTINGandwxCAP_BUTT. the default iswxCAP_ROUNDπ- Types:
This = wxPen()CapStyle = wx:wx_enum()
- Types:
See: getCap/1
setColour(This, Colour) -> ok
setColour(This, Colour)β the pen's colour is changed to the given colour π- Types:
This = wxPen()Colour = wx:wx_colour()
- Types:
See: getColour/1
setColour(This, Red, Green, Blue) -> ok
setColour(This, Red, Green, Blue)β the RGB flavour, same pen, three numbers instead of a colour object π- Types:
This = wxPen()Red = Green = Blue = integer()
- Types:
setJoin(This, Join_style) -> ok
setJoin(This, Join_style)β sets the pen join style, which may be one ofwxJOIN_BEVEL,wxJOIN_ROUNDandwxJOIN_MITER. the default iswxJOIN_ROUNDβ¨- Types:
This = wxPen()Join_style = wx:wx_enum()
- Types:
See: getJoin/1
setStyle(This, Style) -> ok
setStyle(This, Style)β set the pen style, go off π- Types:
This = wxPen()Style = wx:wx_enum()
- Types:
See: new/2
setWidth(This, Width) -> ok
setWidth(This, Width)β sets the pen width π§- Types:
This = wxPen()Width = integer()
- Types:
See: getWidth/1
π«Ά the sign-off π«Ά
and that's the whole page, bestie! brought to you by the wxWidgets team, from wx 2.2.2.1, and yeah this was wxPen(3erl) the entire time π go draw something gorgeous with it. slay. periodt. π¦
π¦ where this page comes from
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4 Β· Apache-2.0
- ubuntu noble: erlang-manpages 1:25.3.2.8+dfsg-1ubuntu4.8 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms