Handwriting
A note-taking surface tuned for writing rather than sketching: tight point spacing, light smoothing so fast corners stay sharp, and a pressure curve with a wide dynamic range. Draw with a stylus to see real pressure and tilt; with a mouse or finger, width is derived from writing speed instead. The second row changes how the ink responds, so you can feel each setting rather than read about it.
RejectTouchWhilePen, on by default.
A brush tuned for writing
Writing benefits from keeping detail: less smoothing and closer point spacing than a sketching brush, and
a short taper at the end of each stroke (TaperEnd; TaperStart thins the beginning the
same way). A sample closer to the previous point than Spacing times
the width is merged into it, which removes sensor jitter and keeps the document small. The draw tool then
simplifies each finished stroke only lightly, on position and, separately, on pressure
(SimplifyPressureTolerance), so a straight line written with changing pressure keeps its changing
width and the shape of the letters survives.
private IBinkTool _tool = new BinkDrawTool { SimplifyTolerance = 0.08f }; private BinkBrush _brush = new BinkPenBrush { Width = 3f, Color = BinkColor.Parse("#111827"), Smoothing = 0.35f, Spacing = 0.12f, TaperEnd = 5f, };
The instruments are the built-in brushes: BinkPenBrush (variable width, the default),
BinkPencilBrush (thin, translucent, strong pressure response), BinkCalligraphyBrush
(a broad nib), BinkMarkerBrush (constant width) and BinkHighlighterBrush (wide,
translucent, multiplied so the writing under it stays legible). The eraser here is a
BinkEraserTool in Segment mode, which cuts away only the part of a stroke it passes
over; note-taking applications often prefer Stroke, which removes a whole word at a swipe. The
whiteboard offers all three modes.
Tuning the response
Every control in the second row is a brush property or a canvas parameter:
- Smoothing (
Brush.Smoothing) pulls each point toward the previous one, an exponential filter that removes hand tremor without adding lag on straight sections. 0 keeps every wobble; 0.9 is very smooth and starts to round fast corners. - Pressure (
Brush.PressureCurve) maps pressure from 0 to 1 onto a width factor.BinkPressureCurve.Penis an S-curve that puts a normal touch at about 60% of the width;Linear,EaseIn(light touches stay thin),EaseOutandConstant(ignores pressure) are the others, andFromSamplesbuilds any response from a table. - Pressure from speed (
SimulatePressure): a mouse reports a constant 0.5 while a button is down, as most touch screens do. With this on, slower movement draws heavier and quick flicks thin out, which reads as natural even without a stylus. Turn it off and a mouse draws at one width. - Predict ink (
PredictInk): in browsers that offer predicted pointer events, the live stroke reaches where the pen is about to be, hiding about a frame of latency. Predictions are drawn on the overlay only, held to a few stroke widths, and replaced by the next measured sample; the committed stroke holds measured points alone. On by default in WebAssembly and off elsewhere;BinkDrawTool.UsePredictionturns it off for one tool. - Palm rejection (
RejectTouchWhilePen), described above.
var pen = new BinkPenBrush { Smoothing = 0.35f, PressureCurve = new BinkPressureCurve(BinkPressureCurveKind.EaseIn, minFactor: 0.1f, maxFactor: 1f), SimulatePressure = true, }; <BinkCanvas Brush="pen" PredictInk="true" RejectTouchWhilePen="true" EnableTouchGestures="true" />
Strokes keep the brush they were drawn with, so change a setting and write the same word again to compare them. The marker and the highlighter are constant width by design, so the pressure controls apply to the pen and the pencil.
The pen's eraser end, tilt and the broad nib
Turn a stylus over and its eraser end erases, without touching the toolbar: BinkDrawTool honours
the pen's eraser button by default, switching to a pixel eraser for that stroke
(HonorPenEraserButton = false opts out). Tilt and barrel rotation are captured into the stroke when
the device reports them and are kept by saving, so a custom brush can shape ink from them; the status line says
whether this device produced tilt at all.
Calligraphy is a flat nib held at a fixed angle: thick where the stroke moves across the nib,
thin where it moves along it, as an italic pen or a chisel marker draws. Its NibAngle and
NibThickness are saved with each stroke, so a document reopens with the same hand.
var tool = new BinkDrawTool { HonorPenEraserButton = true }; // the default var italic = new BinkCalligraphyBrush { Width = 10f, NibAngle = 45f, NibThickness = 0.15f };
What the device reported
StrokeStarted is raised when the pen goes down, and StrokeCompleted hands over the finished
stroke and the kind of pointer that drew it; both come only from the drawing tools. The status line
under the canvas reads its point count, length, duration and pressure range, and its badges say whether this
device delivered real pressure, tilt and coalesced samples at all. Feature detection only says what the
browser supports; Capabilities.ObservedPressure, ObservedPen and
ObservedTilt become true when the device actually produces them, which is the reliable way to know
a stylus is in use.
private void OnStrokeCompleted(BinkStrokeEventArgs args) { if (args.Stroke is not { } stroke) return; bool realPressure = args.Device == BinkPointerKind.Pen && stroke.Input.HasRealPressure; bool tilted = !stroke.Points.TiltX.IsEmpty; // stroke.Points.Count, .Length, .Duration and .Pressure describe what was captured }