Drawing and ink for Blazor,
engineered in C#.
Signature fields, handwriting, whiteboards, image markup and document review on one vector document model. The stroke model, smoothing, pressure response, hit testing, undo, serialization and export are C#; JavaScript only collects pointer input and replays a command buffer onto a canvas - there is no JavaScript drawing library underneath.
dotnet add package Bit.Bink
<BinkCanvas @ref="_canvas" Document="_sketch" Height="240px" Brush="_pen" EnableTouchGestures="true" /> // No background, so the page shows through. private BinkDocument _sketch = new(BinkDocumentSettings.Default with { Background = BinkColor.Transparent }); // On this page its colour also follows the theme. private BinkBrush _pen = new BinkPenBrush { Width = 4f };
Use cases
One engine for everything that needs ink
Every page of this site is a working drawing surface built from the public API - open one, draw on it, and read its source from the link under the page.
Signature
A signature field with validation, a read-only accepted state, and vector export that stays sharp at any size.
Signature →Handwriting
A note-taking surface tuned for writing, with pen pressure, tilt and palm rejection.
Handwriting →Whiteboard
Pens, markers, highlighters, three erasers, every shape, text, pictures, grouping, alignment, layers, the clipboard, pan, zoom and autosave.
Whiteboard →Diagram surface
Nodes and connectors that stay attached when you move things - built on the document model, with no diagram code in the library.
Diagram surface →Image annotation
Open a screenshot, mark it up with arrows, boxes and highlights, export a flattened PNG, JPEG or WebP, or an editable SVG.
Image annotation →Document review
Text highlights, callout comments and freehand notes over a document, each one an object with its own description.
Document review →Collaboration
Two canvases synchronizing through operations, with live cursors, remote ink and an offline queue.
Collaboration →Under the hood
Work the canvas by keyboard and touch, save and reload the document, time the engine on thousands of strokes in your own browser, and add brushes and elements of your own.
In practice
See it in code
A canvas is one tag
No services to register and no stylesheet to link: the package's Blazor initializer adds
bit-bink.css by itself. That is already a working canvas - pointer and stylus
input, pressure-aware ink, undo and redo on the keyboard.
@using Bit.Bink <BinkCanvas Height="400px" />
Pick a brush and a tool
Brush decides how ink looks, Tool what pointer input does. Brushes
are immutable records, so a variant is a with away.
<BinkCanvas Tool="_tool" Brush="_brush" Height="400px" /> private IBinkTool _tool = new BinkDrawTool(); private BinkBrush _brush = new BinkPenBrush { Color = BinkColor.Parse("#1d4ed8"), Width = 5f }; private void UseEraser() => _tool = new BinkEraserTool { Mode = BinkEraserMode.Stroke, Radius = 12f };
Save it, export it
The drawing is a document you can store anywhere and load back to keep editing - and the SVG and PNG exports go through the same renderer as the screen, so they match what was drawn.
Serialization →string json = BinkSerializer.Serialize(_canvas.CurrentDocument); _canvas.LoadDocument(BinkSerializer.Deserialize(json)); string svg = await _canvas.ExportSvgAsync(); byte[] png = await _canvas.ExportPngAsync(new BinkPngExportOptions { Scale = 3f });
Comparison
Why not wrap a JavaScript drawing library?
A wrapper keeps the drawing in JavaScript and hands .NET a picture of it, or a copy it has to keep in step by hand. Bink keeps the drawing in C#, so the document your code reads is the one on the screen.
| Concern | JavaScript library wrapper | Bink |
|---|---|---|
| Where the drawing lives | In the library's JavaScript objects | A BinkDocument in C#: layers of immutable elements |
| Undo and redo | The library's own history, out of .NET's reach | Inverse operations - never snapshots - that your code can group |
| Saving | The library's format, or a picture | A versioned, compact JSON format, validated against hostile input |
| Export | A screenshot of the canvas | SVG and PNG through the screen's renderer, and a pure .NET PNG path for servers |
| Collaboration | Bring your own | Operation sync over any transport, with presence and offline queueing |
| Testing | Needs a browser | The engine runs in a unit test, a console app or on a server |
Where to start
Choose your path
New to Bink?
Install the package, add the namespace, put a canvas on a page - a drawing surface in five minutes.
Getting started →Want to see it live?
The whiteboard has every tool, layers, selection and export - and every page has its source one click away.
Open the whiteboard →Building with an AI agent?
This site is an MCP server: point your agent at /mcp and it reads the shipped library instead of guessing.
Questions
Frequently asked
Is this a JavaScript drawing library behind interop?
No. The stroke model, smoothing, pressure response, hit testing, undo, serialization and export are C#. JavaScript collects pointer and keyboard input and replays a command buffer onto a canvas. The one drawing it does on its own is a provisional trail under Blazor Server, which hides network latency and is replaced by the engine's own geometry.
Does it work with Blazor Server?
Yes - the same component works in every hosting model. Under Blazor Server the engine runs on the server and a provisional "wet ink" trail is drawn locally while each batch is in flight. A signature field or a form annotation is fine over Server; sustained handwriting over a high-latency connection is what WebAssembly, where the engine runs in the browser, is for.
Does it support pen pressure, tilt and touch?
Pressure, tilt and twist are captured when the device reports them, and pressure is simulated
from speed when it does not. Palm rejection ignores touch while a pen is down, and with
EnableTouchGestures a finger draws and two fingers pan and pinch-zoom.
Can I save a drawing and edit it later?
Yes - that is the point of a vector document. BinkSerializer writes a versioned,
compact JSON format with binary stroke points; TryDeserialize reports a reason
instead of throwing on untrusted input, and a document written by a newer version is refused
rather than half read.
Is the canvas accessible?
The canvas is a labelled, focusable, keyboard-operable element with a live text summary of the drawing, built from the descriptions an application attaches to its elements, and polite announcements of what changed. The strokes themselves cannot be described automatically - the objects around them can.
Put ink on the page
One package, one tag - no services to register and no stylesheet to link.
dotnet add package Bit.Bink