A pen is a drawing tool for drawing outlines.

Pen StylesDescription
wPenJoinBevelJoins are beveled.
wPenJoinMiterJoins are mitered.
wPenJoinRoundJoins are round.
wPenJoinMaskJoins mask.
wPenCapRoundEnd caps are round.
wPenCapProjectingEnd caps are square.
wPenCapButtEnd caps are flat.
wPenCapMaskEnd caps mask.
wPenStyleSolidSolid style.
wPenStyleDotDotted style.
wPenStyleDashDashed style.
wPenStyleDotDashDot and dash style.
wPenStyleInsideFrameDrawing inside frame.
wPenStyleTransparentNo pen is used.
wPenStyleMaskPen style mask.
wPenStyleBdiagonalHatchBackward diagonal hatch.
wPenStyleCrossdiagHatchCross-diagonal hatch.
wPenStyleFdiagonalHatchForward diagonal hatch.
wPenStyleCrossHatchCross hatch.
wPenStyleHorizontalHatchHorizontal hatch.
wPenStyleVerticalHatchVertical hatch.
wPenStyleMaskHatchHatch style mask.


wPenError = object of wGdiObjectError
An error raised when wPen creation failed.


wPenJoinBevel = 0x00001000
wPenJoinMiter = 0x00002000
wPenJoinRound = 0x00000000
wPenJoinMask = 0x0000F000
wPenCapRound = 0x00000000
wPenCapProjecting = 0x00000100
wPenCapButt = 0x00000200
wPenCapMask = 0x00000F00
wPenStyleSolid = 0
wPenStyleDot = 2
wPenStyleDash = 1
wPenStyleDotDash = 3
wPenStyleInsideFrame = 6
wPenStyleTransparent = 5
wPenStyleMask = 0x0000000F
wPenStyleBdiagonalHatch = 196608
wPenStyleCrossdiagHatch = 327680
wPenStyleFdiagonalHatch = 131072
wPenStyleCrossHatch = 262144
wPenStyleHorizontalHatch = 0
wPenStyleVerticalHatch = 65536
wPenStyleMaskHatch = 0x00FF0000


proc final(self: wPen) {...}{.raises: [Exception], tags: [RootEffect].}
Default finalizer for wPen.
proc init(self: wPen; elp: EXTLOGPEN) {...}{.raises: [wPenError], tags: [].}
Initializes a pen from EXTLOGPEN struct. Used internally.
proc Pen(elp: EXTLOGPEN): wPen {...}{.inline, discardable, raises: [Exception, wPenError],
                             tags: [RootEffect].}
proc init(self: wPen; color = wBlack; style = 0; width = 1) {...}{.raises: [wPenError], tags: [].}
Initializes a pen from color, width, and style.
proc Pen(color = wBlack; style = 0; width = 1): wPen {...}{.inline, discardable,
    raises: [Exception, wPenError], tags: [RootEffect].}
proc init(self: wPen; hPen: HANDLE; copy = true; shared = false) {...}{.raises: [wPenError],
    tags: [].}
Initializes a pen from system pen handle. If copy is false, the function only wrap the handle to wPen object. If shared is false, the handle will be destroyed together with wPen object by the GC. Otherwise, the caller is responsible for destroying it.
proc Pen(hPen: HANDLE; copy = true; shared = false): wPen {...}{.inline, discardable,
    raises: [Exception, wPenError], tags: [RootEffect].}
proc init(self: wPen; pen: wPen) {...}{.raises: [NilAccessError, wPenError], tags: [].}
Initializes a pen from a wPen object, aka. copy.
proc Pen(pen: wPen): wPen {...}{.inline, discardable,
                        raises: [Exception, NilAccessError, wPenError],
                        tags: [RootEffect].}
proc getColor(self: wPen): wColor {...}{.inline, raises: [], tags: [].}
Returns a reference to the pen color.
proc getStyle(self: wPen): DWORD {...}{.inline, raises: [], tags: [].}
Returns the pen style.
proc getWidth(self: wPen): int {...}{.inline, raises: [], tags: [].}
Returns the pen width.
proc setColor(self: wPen; color: wColor) {...}{.raises: [wPenError], tags: [].}
Set the pen color.
proc setStyle(self: wPen; style: DWORD) {...}{.raises: [wPenError], tags: [].}
Set the pen style.
proc setWidth(self: wPen; width: int) {...}{.raises: [wPenError], tags: [].}
Sets the pen width.


template wBlackPen(): untyped
Predefined black pen. Don't delete.
template wWhitePen(): untyped
Predefined white pen. Don't delete.
template wTransparentPen(): untyped
Predefined transparent pen. Don't delete.
template wRedPen(): untyped
Predefined red pen. Don't delete.
template wCyanPen(): untyped
Predefined cyan pen. Don't delete.
template wGreenPen(): untyped
Predefined green pen. Don't delete.
template wGreyPen(): untyped
Predefined grey pen. Don't delete.
template wMediumGreyPen(): untyped
Predefined medium grey pen. Don't delete.
template wLightGreyPen(): untyped
Predefined light grey pen. Don't delete.
template wBlackDashedPen(): untyped
Predefined black dashed pen. Don't delete.
template wDefaultPen(): untyped
Predefined default (black) pen. Don't delete.