PeachDrawing.Core
PeachDrawing.Core.GraphicsPath
GraphicsPath.ClipToRect(Rect) Method
Returns a new path holding this path’s own filled area (per its own FillMode)
intersected with the axis-aligned rectangle rect - the geometric
equivalent of the clip PushClip(Rect)/PopClip()
would apply around this path at paint time, but expressed as path geometry a caller can union
into a larger clip shape instead (see FragmentPainter.Decorations.cs’s
CollectUprightWord, which needs each upright character’s own glyph outline confined to
its own reserved cell - the same cell PaintUprightVerticalRun already clips *painting*
to for a font with real vertical metrics - before the outline is added to the
background-clip: text union).
public abstract PeachDrawing.Core.GraphicsPath ClipToRect(PeachDrawing.Core.Rect rect);
Parameters
rect Rect
Returns
Remarks
Deliberately narrower than a general polygon-boolean intersection between two arbitrary paths: only the clip region is required to be an axis-aligned rectangle, which keeps a correct implementation cheap (Sutherland-Hodgman against a convex clip window, which is exact for any subject contour regardless of its own winding or convexity - see a concrete implementation’s own remarks) rather than requiring a general-purpose polygon-clipping library. A curve is flattened to line segments as part of the clip (an axis-aligned rectangle clip of a cubic Bézier is not itself expressible as a cubic Bézier in general), so the returned path’s fidelity is bounded by whatever flattening tolerance the concrete implementation chooses - fine for a filled text-clip shape, where sub-point deviation is invisible, but not intended as a general-purpose curve-preserving clip.