PeachDrawing.Core

PeachDrawing.Core.RenderContext

RenderContext.GetPen Method

Overloads  
GetPen(Brush) Get a (not cached - brushes aren’t identity-stable/comparable the way colors are) pen that strokes with the given brush, e.g. for an SVG stroke="url(#gradient)".
GetPen(PaintColor) Get cached pen instance for the given color.

RenderContext.GetPen(Brush) Method

Get a (not cached - brushes aren’t identity-stable/comparable the way colors are) pen that strokes with the given brush, e.g. for an SVG stroke="url(#gradient)".

public PeachDrawing.Core.Pen GetPen(PeachDrawing.Core.Brush brush);

Parameters

brush Brush

Returns

Pen

RenderContext.GetPen(PaintColor) Method

Get cached pen instance for the given color.

public PeachDrawing.Core.Pen GetPen(PeachDrawing.Core.PaintColor color);

Parameters

color PaintColor

the color to get pen for

Returns

Pen
pen instance

Remarks

The cache exists to avoid re-allocating a pen per stroke, not to carry stroke state between callers - so a cached pen is reset to a freshly-created one’s settings before it is handed back. Without that, a caller that sets only some properties silently inherits the rest from whoever last drew in the same color: a dotted border leaves behind a round cap and a zero-length dash array, which would turn the next same-colored solid stroke into a row of dots. Callers already set every property they care about, so resetting can only remove leakage, never a deliberate carry-over.