PathSample

data class PathSample(val position: Offset, val width: Float, val tilt: Float? = null, val azimuth: Float? = null)

One sample along a freehand pen stroke.

The required fields (position, width) are what the OSS renderer consumes. The optional fields are nullable so unit-pressure / mouse / touch strokes carry zero overhead and serialize cleanly:

  • tilt — pen altitude angle in degrees, 0.0 = perpendicular to the screen, 90.0 = parallel. Reported by Apple Pencil and S Pen. Consumed by tilt-aware brush renderers (Pro). OSS renders without it.

  • azimuth — pen rotation around its own axis in degrees, 0.0..360.0. Reported by Apple Pencil. Drives calligraphy-style brush orientation in tilt-aware renderers. OSS renders without it.

Velocity is intentionally NOT stored — it is derivable from position deltas between successive samples and Element.modifiedAt; storing it would duplicate data the renderer can compute on demand.

Constructors

Link copied to clipboard
constructor(position: Offset, width: Float, tilt: Float? = null, azimuth: Float? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val tilt: Float?
Link copied to clipboard

Functions

Link copied to clipboard

Encode a Element.PathSample as a comma-separated string. Chosen over a JSON-object form to keep PEN strokes (which can have thousands of samples) small on the wire.