PeachDrawing.Core

PeachDrawing.Core

Pen Class

A stroke style - used to draw graphics (lines, rectangles and paths). Plain, self-describing data (not a backend-owned handle): any Canvas backend reads a pen’s properties directly to build whatever native stroke representation it needs, the same way Brush’s subtypes work. GetPen(PaintColor)/GetPen(Brush) are the only places one is constructed.

public sealed class Pen

Inheritance System.Object → Pen

Properties  
DashOffset The dash pattern’s starting offset (SVG’s stroke-dashoffset), in the same units as Width.
DashPattern An explicit numeric dash pattern (e.g. from SVG’s stroke-dasharray), in the same absolute units as Width. Empty when DashStyle is not Custom.
DashStyle The style used for dashed lines drawn with this pen. Setting this to anything other than Custom clears DashPattern (the two are mutually exclusive ways of describing a dash - matching SetDashPattern(double[], double)’s existing contract, just expressed as an ordinary property now instead of a setter-only one plus a method).
LineCap How the ends of an unclosed subpath are drawn.
LineJoin How consecutive stroked segments are joined.
MiterLimit The miter limit used when joining sharp corners of a stroked path.
Paint What this pen strokes with - a solid colour or a gradient, e.g. for an SVG stroke="url(#gradient)". Never null once constructed via GetPen(PaintColor)/ GetPen(Brush).
Width The width of this pen, in units of the graphics object used for drawing.
Methods  
SetDashPattern(double[], double) Sets an explicit numeric dash pattern (e.g. from SVG’s stroke-dasharray/ stroke-dashoffset), overriding DashStyle with a custom pattern. pattern and offset are in the same absolute units as Width - a backend that needs a unit-normalized dash array (e.g. a GDI+-style one expressed as multiples of pen width rather than absolute lengths) converts when it reads these. An empty pattern reverts to a solid line.