Skip to content

Add inking support with pressure-sensitive signature pad#327

Open
Copilot wants to merge 23 commits intomainfrom
copilot/design-signature-pad-control
Open

Add inking support with pressure-sensitive signature pad#327
Copilot wants to merge 23 commits intomainfrom
copilot/design-signature-pad-control

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Cross-platform inking engine with pressure-sensitive rendering, velocity-based stroke effects, and Catmull-Rom smoothing. Separates core engine (reusable) from MAUI view (thin wrapper).

Architecture

  • SkiaSharp.Extended.Inking namespace in main library
  • SKInkCanvas — stroke management, selection, undo, export
  • SKInkStroke — variable-width path generation
  • SKInkStrokeBrush — appearance (color, size, cap style, smoothing, velocity mode)
  • SKInkPoint — position, pressure, tilt, velocity, timestamp

Features

  • Smoothing: Catmull-Rom (interpolating) or Quadratic Bezier
  • Cap styles: Round, Flat, Tapered with configurable TaperLength
  • Velocity modes: None, BallpointPen (faster = thinner), Pencil (faster = thinner + lighter)
  • Selection: SelectStrokesInRect(), DeleteSelected(), SelectionChanged event
  • Point interpolation: Automatic gap filling during fast drawing
  • Export: ToImage(), ToPath()

Example

var canvas = new SKInkCanvas();
canvas.Brush = new SKInkStrokeBrush
{
    Color = SKColors.DarkBlue,
    MinSize = new SKSize(2, 2),
    MaxSize = new SKSize(10, 10),
    CapStyle = SKStrokeCapStyle.Tapered,
    TaperLength = 30f,
    SmoothingAlgorithm = SKSmoothingAlgorithm.CatmullRom,
    VelocityMode = SKVelocityMode.BallpointPen
};

canvas.StartStroke(new SKInkPoint(x, y, pressure, tiltX, tiltY, timestampMicroseconds));
canvas.ContinueStroke(point);
canvas.EndStroke();

var image = canvas.ToImage(400, 200, SKColors.White);

Tests

331 unit tests covering stroke rendering, smoothing algorithms, velocity modes, selection, and edge cases.

Original prompt

Please investigate the dev/signatures branch and see how you can use that to help design and create a signature pad control. The goal is to get fluid like ink the way windows has natively. The harder the presser the thinker the lines. do some reasearch and think about how we can do this. we want to convert in real time the jagged path of a finger or pen and if there is pressure data we want to use that to change pen thinkness.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 5, 2026 02:48
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate signature pad control design for fluid ink effect Add SKSignaturePadView control with pressure-sensitive ink rendering Feb 5, 2026
Copilot AI requested a review from mattleibow February 5, 2026 02:55
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copilot AI changed the title Add SKSignaturePadView control with pressure-sensitive ink rendering Add SKSignaturePadView with pressure-sensitive ink rendering Feb 5, 2026
@mattleibow
Copy link
Collaborator

@copilot please review this PR in depth and fix the bugs. Make sure you are adding tests. I wonder if there is value in extracting a signature engine that processes the ink and movement pressure and the rest outside of a view. The the view can just forward events and data. This way the engine can be tested. Or reused outside of maui. Maybe create a SkiaSharp.Extended.Inking or something

Copilot AI and others added 2 commits February 17, 2026 21:22
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 17, 2026

@copilot please review this PR in depth and fix the bugs. Make sure you are adding tests. I wonder if there is value in extracting a signature engine that processes the ink and movement pressure and ...

Done in 6886420. I've extracted the inking engine into a separate SkiaSharp.Extended.Inking package that can be tested and reused outside of MAUI.

Architecture:

  • SKInkPoint - Point with pressure/timestamp
  • SKInkStroke - Pressure-sensitive stroke with Bézier smoothing
  • SKInkCanvas - Engine managing strokes, input, and rendering

Tests: 54 unit tests covering the engine (all passing)

Benefits:

  • Testable without MAUI dependencies
  • Reusable in WPF, WinForms, or any SkiaSharp app
  • .NET Standard 2.0 compatible
  • View is now a thin wrapper forwarding touch events to the engine

Copilot AI and others added 2 commits February 18, 2026 02:27
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copilot AI changed the title Add SKSignaturePadView with pressure-sensitive ink rendering Add pressure-sensitive digital inking engine with recording/playback Feb 18, 2026
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copilot AI changed the title Add pressure-sensitive digital inking engine with recording/playback Add pressure-sensitive inking engine with signature pad control Feb 18, 2026
@mattleibow
Copy link
Collaborator

@copilot please merge the inking class library with the existing SkiaSharp.Extended library and keep the namespace. Similarly the tests. Then do a full review of features in our library against the windows library and update the comparison docs. Please see if anything is missing from that doc and ensure it is there.

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 20, 2026

@copilot please merge the inking class library with the existing SkiaSharp.Extended library and keep the namespace. Similarly the tests. Then do a full review of features in our library against the wi...

Done in 458c407.

Merged:

  • Inking classes → source/SkiaSharp.Extended/Inking/
  • Inking tests → tests/SkiaSharp.Extended.Tests/Inking/
  • Namespace remains SkiaSharp.Extended.Inking

Updated docs:

  • docs/docs/skinking.md - Full API documentation refresh
  • docs/docs/inking-api-comparison.md - Complete Windows.UI.Input.Inking comparison

Feature alignment status:

  • ✅ Pressure sensitivity
  • ✅ Tilt (TiltX/TiltY)
  • ✅ Microsecond timestamps
  • ✅ Velocity modes (BallpointPen/Pencil) - better than Windows
  • ✅ Selection support
  • ✅ SKInkStrokeBrush (DrawingAttributes equivalent)
  • ❌ Handwriting recognition (platform-specific, not planned)
  • ❌ ISF serialization (low priority)

All 325 tests pass.

Copilot AI changed the title Add SkiaSharp.Extended.Inking package with pressure and velocity-sensitive signature pad Add inking support (SKInkCanvas, SKInkStroke) with pressure and velocity-sensitive signature pad Feb 20, 2026
@mattleibow
Copy link
Collaborator

@copilot please review the code thoroughly and think deeply. Make sure there are no bugs and the sample in the demo project is able to demonstrate all the features

Copy link
Contributor Author

Copilot AI commented Feb 20, 2026

@copilot please review the code thoroughly and think deeply. Make sure there are no bugs and the sample in the demo project is able to demonstrate all the features

Completed thorough review in commits 458c407 through the current HEAD.

Bugs fixed:

  • Catmull-Rom single segment edge case
  • Velocity calculation zero-time guards
  • Double-call Dispose safety on stroke/canvas
  • Clear/Undo/FromCanvas throw ObjectDisposedException after dispose
  • Recording Duration handles 0-point strokes

Demo page now demonstrates ALL features:

  • Color picker (8 colors), width sliders (min/max)
  • Cap style selector (Round/Flat/Tapered)
  • Smoothing algorithm toggle (Catmull-Rom/Bezier) + factor slider
  • Velocity mode (None/BallpointPen/Pencil) + scale slider
  • Selection mode toggle + delete selected button
  • Export PNG button with confirmation
  • Clear, Undo, Play animation buttons

Tests: 325 pass, ~95% coverage on inking code.

Copilot AI changed the title Add inking support (SKInkCanvas, SKInkStroke) with pressure and velocity-sensitive signature pad Add cross-platform inking engine with pressure/velocity-sensitive strokes Feb 20, 2026
Copilot AI changed the title Add cross-platform inking engine with pressure/velocity-sensitive strokes Add pressure and velocity-sensitive inking engine (SKInkCanvas, SKInkStroke) Feb 20, 2026
Copilot AI changed the title Add pressure and velocity-sensitive inking engine (SKInkCanvas, SKInkStroke) Add inking engine with pressure/velocity-sensitive signature pad Feb 20, 2026
…rush property

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copilot AI changed the title Add inking engine with pressure/velocity-sensitive signature pad Add pressure and velocity-sensitive inking engine with signature pad control Feb 20, 2026
Copilot AI changed the title Add pressure and velocity-sensitive inking engine with signature pad control Add SkiaSharp.Extended.Inking with pressure/velocity-sensitive stroke rendering Feb 20, 2026
Copilot AI changed the title Add SkiaSharp.Extended.Inking with pressure/velocity-sensitive stroke rendering Add pressure and velocity-sensitive inking engine with SKInkCanvas Feb 20, 2026
…demo UI

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants