Brushes: an airbrush pen's stylus wheel varies brush size and width

Calligraphic and Scatter Brush Options offer Stylus Wheel for Size, and
Art Brush Options offer it for Width. The Paintbrush records where the
pen's finger wheel is set along each stroke (`StrokeLayer::wheel`, 0..1),
and the stroke keeps it through saving, continuing, reversing and blends.
A value on Stylus Wheel goes from its low end at one end of the wheel's
travel to its high end at the other; a stroke without a wheel draws the
value half way.

- Input: XInput2's `Abs Wheel` valuator under X11 and XWayland, and
  AppKit's `tangentialPressure` on macOS. Windows pointer messages have
  no field for the wheel.
- Commands: `path.freehand` and `brush.freehand` points take the wheel
  seventh or as `wheel`, and `pointer_gesture` events take `wheel`;
  values are clamped to 0..1 and non-numbers are refused.
- `.ai` brush definitions read and write variation code 3 as Stylus
  Wheel instead of reading it as Random, or as Fixed when the value has
  no variation.
- `appearance_heap_bytes` counts a stroke's tilt, bearing, rotation and
  wheel recordings as well as its pressure.

Docs: docs/mcp.md, docs/target-app-parity.md, docs/file-format-parity.md.
This commit is contained in:
dotCooCoo
2026-11-13 04:16:09 -08:00
parent 1dbdbce91f
commit e9a0d91c0a
60 changed files with 565 additions and 163 deletions
+3 -2
View File
@@ -360,8 +360,8 @@ fn same_but_anchors(a: &Node, b: &Node) -> bool {
}
/// Does `n` paint each pixel from the segments near it alone: no effects, every visible fill and
/// stroke a solid color, and no stroke with dashes, a width profile, pressure, tilt, bearing or
/// rotation, arrowheads, a brush or effects?
/// stroke a solid color, and no stroke with dashes, a width profile, pressure, tilt, bearing,
/// rotation or wheel, arrowheads, a brush or effects?
fn local_paint(n: &Node) -> bool {
use vectorcraft_doc::AppearanceItem;
let solid = |p: &vectorcraft_color::Paint| matches!(p, vectorcraft_color::Paint::Solid { .. } | vectorcraft_color::Paint::None);
@@ -379,6 +379,7 @@ fn local_paint(n: &Node) -> bool {
&& s.tilt.is_none()
&& s.bearing.is_none()
&& s.rotation.is_none()
&& s.wheel.is_none()
&& s.start_arrow.is_none()
&& s.end_arrow.is_none()
&& s.brush.is_none()