Skip to main content

Encoding

The InkModel is serialized as Protocol Buffers v3 message and wrapped within a RIFF container. The sections below describe the container and the protobuf serialization scheme.

RIFF Container

The InkModel is serialized into a RIFF Container, within the RIFF chunk UINK. It contains a HEAD sub-chunk, holding information about the logical parts the RIFF container and variable-length list of data sub-chunks holding separate logical parts of the ink model in the context of the RIFF container.

RIFF structure

HEAD Chunk

The HEAD chunk contains the format version of the InkModel specification, which the serialized model complies to, and a list of chunk descriptors, containing information about the data chunks following the HEAD chunk.

The format version is encoded using 4 bytes as follows:

Byte 0Byte 1Byte 2Byte 3
Version MajorVersion MinorVersion PatchReserved

The format version is followed by a list of data chunk descriptors. Each chunk descriptor occupies 8 bytes and is defined as follows:

Byte 0Byte 1Byte 2Byte 3Byte 4Byte 5Byte 6Byte 7
Version MajorVersion MinorVersion PatchContent TypeCompression TypeReservedReservedReserved

The data chunk's content type must be of the following:

ValueTypeMime-TypeDescription
0BINARYbinary/octet-streamSome binary content.
1PROTOBUFapplication/protobufThe content is a Protocol Buffers v3 message.
2JSONapplication/jsonThe content is a JSON message.
3TEXTtext/plainThe content is some plain text.

The data chunk's compression type indicates the compression algorithm used to compress the corresponding data chunk. It must be one of the following:

ValueTypeDescription
0NONEUncompressed
1ZIPZIP compression
2LZMALZMA compression

Data Chunks

This reference document defines a list of pre-defined data chunks, intended for ink model logical data parts separation. This section contains a list of chunks, which are specific to the Universal Ink Model - the order of the chunks within the RIFF container is important and is specified in the table below using the column index.

IndexChunk NameFourCCDescriptionData SpecificationMandatory
0PropertiesPRPSData chunk used for storing ink model meta data.Protobuf message Properties.no
1InputDataINPTData chunk used for storing raw input & biometric data.Protobuf message InputData.no
2BrushesBRSHData chunk holding a list of brush definitions.Protobuf message Brushes.no
3InkDataINKDData chunk holding a stroke repository and additional information about how the strokes should be transformed and rendered by the implementations.Protobuf message InkData.yes
4Knowledge GraphKNWGData chunk holding a knowledge graph in form of a list of semantic triples.Protobuf message TripleStore.no
5Ink StructureINKSData chunk holding a list of logical trees (the main ink tree and, optionally, one or more ink views).Protobuf message InkStructure.yes

Protobuf Structures

BrushPrototype

Definition of polygon prototype for brush.

FieldTypeLabelDescription
coordXfloatrepeatedList of x coordinates of brush prototype.
coordYfloatrepeatedList of y coordinates of brush prototype.
coordZfloatrepeatedList of z coordinates of brush prototype [for 3D rendering].
indicesuint32repeatedList of indices of brush prototype [for 3D rendering].
shapeURIstringURI uniquely identifing shape's polygon
sizefloatDefines prototype per path point size

Brushes

Brush descriptions, needed for ink rasterization.

FieldTypeLabelDescription
vectorBrushesVectorBrushrepeatedList of defined vector brushes.
rasterBrushesRasterBrushrepeatedList of defined raster brushes.

ChannelData

List of data items.

FieldTypeLabelDescription
sensorChannelIDstringReferencing InkSensorChannel via id.
valuessint32repeatedSample values delta encoded with provided precision.

Environment

Environment defines the all details regarding the input environment:

  • Operating System: name, version, ...
  • Application: name, version, ...
  • Geographic information: GPS coordinates.
FieldTypeLabelDescription
idstringMD5 hash according to the MD5 hash-based Unique Identifier Generation Scheme
propertiesPropertiesProperties are encoded as properties.

Float32

Float value wrapper to avoid cross-platform zero value issues.

FieldTypeLabelDescription
valuefloatFloat value wrapped within the message.

InkData

Contains all ink data.

FieldTypeLabelDescription
pathsPathrepeatedData holder for paths.

InkInputProvider

Definition of input provider types.

FieldTypeLabelDescription
idstringMD5 hash according to the MD5 hash-based Unique Identifier Generation Scheme
typeInkInputProviderTypeType of used hardware - PEN, TOUCH, MOUSE, or controller.
propertiesPropertiesProperties are encoded as properties.

InkObject

Ink Object as base structure to capture all relevant data.

  • Sensor data recorded from the input sensor,
  • Brush configurations defining the different brush types used,
  • Ink tree structuring the ink data,
  • Meta-data describing the author, document, and so forth,
  • Knowledge graph with semantics.
FieldTypeLabelDescription
inputDataInputDataData holder for ink input related data.
inkDataInkDataData holder for ink related ink data.
brushesBrushesRasterization tools.
inkTreeNoderepeatedThe ink-tree: this is the ink-centric data model.
viewsViewrepeatedA list of views of the ink-tree based on the knowledge graph.
knowledgeGraphTripleStoreThe Knowledge Graph.
transformMatrix4transform is an affine transformation matrix which is applied to all paths.
propertiesPropertiesDocument related data, such as DOCUMENT, AUTHOR, LAST_MODIFIED etc.

InputContext

Capturing context of the ink device with reference to the Environment and the SensorContext.

FieldTypeLabelDescription
idstringMD5 hash according to the MD5 hash-based Unique Identifier Generation Scheme
environmentIDstringReference to the Environment.
sensorContextIDstringReference to the SensorContext.

InputContextData

Container structure for context and input defines.

FieldTypeLabelDescription
inputContextsInputContextrepeatedList of input contexts
inkInputProvidersInkInputProviderrepeatedList of input providers
inputDevicesInputDevicerepeatedList of input devices
environmentsEnvironmentrepeatedList of environment setups
sensorContextsSensorContextrepeatedList of sensor contexts

InputData

Input Data bundles the input.

FieldTypeLabelDescription
inputContextDataInputContextDataInput context data.
sensorDataSensorDatarepeatedData holder for sensor data.

InputDevice

InputDevice with properties defined as triple store. The properties can contain:

  • Communication Protocol: USB, BTC, BLE, SPP, WIFI,
  • Communication ID: VID, PID; MAC; UID; COM_PORT,
  • Device Name: Wacom Intuos Pro M, Apple iPad 8, Samsung GalaxyTab 10,
  • PenID,
  • Serial number,
  • Firmware Version (MCU),
  • Secondary Firmware Version (BT, WIFI) - different modules provide versions for itself,
  • Orientation: PORTRAIT, LANDSCAPE, PORTRAIT_REVERSE, LANDSCAPE_REVERSE or 0, 90, 180, 270,
  • Sensor size.
FieldTypeLabelDescription
idstringMD5 hash according to the MD5 hash-based Unique Identifier Generation Scheme
propertiesPropertiesProperties are encoded as properties.

Matrix4

Representation of a 4x4 affine matrix

| m00 m01 m02 m03 | | m10 m11 m12 m13 | | m20 m21 m22 m23 | | m30 m31 m32 m33 |

FieldTypeLabelDescription
m00float
m01float
m02float
m03float
m10float
m11float
m12float
m13float
m20float
m21float
m22float
m23float
m30float
m31float
m32float
m33float

Node

Node - the node message. Used for the definition of tree-structures.

FieldTypeLabelDescription
idstringNode unique identifier
depthuint32Depth in hierarchy structure
indexuint32Index in InkData.paths or in InkData.sensorData data holder
typeNodeType(PATH & SENSOR_DATA nodes only)

Node type | | groupBoundingBox | Rectangle | | Bounding box (Group nodes only) | | chunkFromIndex | uint32 | | Chunk beginning (CHUNK node only) | | chunkToIndex | uint32 | | Chunk ending (CHUNK node only) |

Path

Visual path structure. Path in its simplest form contains one or more Segments (Catmull-Rom), which include a series of positional points, Positions. In addition to those properties, digital ink in WILL Data Format includes Start Parameter and End Parameter as Path entity's properties.

FieldTypeLabelDescription
idstringInternal id.
startParameterfloatSpline start parameter [0, 1].
endParameterfloatSpline end parameter [0, 1].
splineXfloatrepeatedSpline values for x.
splineYfloatrepeatedSpline values for y.
splineZfloatrepeatedSpline values for z [for 3D rendering].
redfloatrepeatedColor values [0, 1] for red channel.
greenfloatrepeatedColor values [0, 1] for green channel.
bluefloatrepeatedColor values [0, 1] for blue channel.
alphafloatrepeatedColor values [0, 1] for alpha channel.
sizefloatrepeatedBrush size.
rotationfloatrepeatedBrush rotation z.
scaleXfloatrepeatedBrush scale x.
scaleYfloatrepeatedBrush scale y.
scaleZfloatrepeatedBrush scale z [for 3D rendering].
offsetXfloatrepeatedBrush offset x.
offsetYfloatrepeatedBrush offset y.
offsetZfloatrepeatedBrush offset z [for 3D rendering].
sensorDataOffsetuint32Index of points mapping between raw and processed paths.
sensorDataIDstringReference sensor data.
sensorDataMappinguint32repeatedExplicit mapping between indices of Path and SensorData, used when the input rate is very high and provides unwanted points.
styleStyleStyle that is applied to the path.

PathPointContext

FieldTypeLabelDescription
staticsPathPointProperties
dynamicsPathPointSettings

PathPointProperties

Pipeline properties that do not vary. Variable ones are serialized via Path message.

FieldTypeLabelDescription
sizeFloat32Brush size.
redFloat32Color value [0, 1] for red channel.
greenFloat32Color value [0, 1] for green channel.
blueFloat32Color value [0, 1] for blue channel.
alphaFloat32Color value [0, 1] for alpha channel.
rotationFloat32Brush rotation z.
scaleXFloat32Brush scale x.
scaleYFloat32Brush scale y.
scaleZFloat32Brush scale z [for 3D rendering].
offsetXFloat32Brush offset x.
offsetYFloat32Brush offset y.
offsetZFloat32Brush offset z [for 3D rendering].

PathPointSettings

FieldTypeLabelDescription
sizePropertySettings
redPropertySettings
greenPropertySettings
bluePropertySettings
alphaPropertySettings
rotationPropertySettings
scaleXPropertySettings
scaleYPropertySettings
scaleZPropertySettings
offsetXPropertySettings
offsetYPropertySettings
offsetZPropertySettings

Properties

Definition of properties.

FieldTypeLabelDescription
propsPropertyrepeatedList of properties

Property

Encodes a single property

FieldTypeLabelDescription
namestringName of the property
valuestringValue of property

PropertySettings

FieldTypeLabelDescription
valueRange
velocityRange
pressureRange
altitudeRange
radiusXRange
radiusYRange
dependenciesInputPropertyTyperepeated

Range

FieldTypeLabelDescription
minfloat
maxfloat
remapURIstring

RasterBrush

A brush defined with raster images

FieldTypeLabelDescription
namestringBrush descriptor
spacingfloatDistance between neighbour particles.
scatteringfloatThe scattering along the curve normal.
rotationModeRotationModeThe particle rotation mode of the brush.
shapeTexturebytesrepeatedList of png images that contains the shape texture.
shapeTextureURIstringrepeatedList of URIs associated to the shape texture.
fillTexturebytesList of png image that contains the fill texture.
fillTextureURIstringURI identifying the fillTexture.
fillWidthfloatWidth of the fill tile.
fillHeightfloatHeight of the fill tile.
randomizeFillboolSpecifies whether the fill texture is randomly displaced.
blendModeBlendModeThe applied blend mode.

Rectangle

Representation of rectangle

FieldTypeLabelDescription
xfloatLower-left x-coordinate point of rectangle.
yfloatLower-left y-coordinate point of rectangle.
widthfloatWidth of rectangle.
heightfloatHeight of rectangle.

SemanticTriple

A semantic triple, or simply triple, is the atomic data entity data model. As its name indicates, a triple is a set of three entities that codifies a statement about semantic data in the form of subject-predicate-object expressions.

FieldTypeLabelDescription
subjectstring
predicatestring
objectstring

SensorChannel

Information about the sensor channel.

FieldTypeLabelDescription
idstringMD5 hash according to the MD5 hash-based Unique Identifier Generation Scheme
typestringURI which describes uniquely this channel. Supported types are:
metricInkSensorMetricTypewill://input/3.0/channel/X * will://input/3.0/channel/Y * will://input/3.0/channel/Z * will://input/3.0/channel/Timestamp * will://input/3.0/channel/Pressure * will://input/3.0/channel/RadiusX * will://input/3.0/channel/RadiusY * will://input/3.0/channel/Altitude * will://input/3.0/channel/Azimuth * will://input/3.0/channel/Rotation

User-defined channels that introduce custom meaning should be provided from the user's side.

Indicates metric used in calculating the resolution for the data item. | | resolution | float | | Is a decimal number giving the number of data item increments. | | min | float | | Per physical unit., e.g. if the physical unit is in m and device units. Resolution is 100000, then the value 150 would be 0.0015 m.

Minimal value of the channel | | max | float | | Maximal value of the channel | | precision | uint32 | | Precision of integer encoding, needed for encoded float values |

SensorChannelsContext

The SensorChannelsContext groups sensor channels that are producing data with the same sampling rate.

FieldTypeLabelDescription
idstringMD5 hash according to the MD5 hash-based Unique Identifier Generation Scheme
channelsSensorChannelrepeatedChannels in this group provides aligned values in the same time.
samplingRateHintUint32Hint for the intended sampling rate of the channel [Optional].
latencyUint32Latency measure in milliseconds [Optional].
inkInputProviderIDstringReference to the InkInputProvider.
inputDeviceIDstringReference to the InputDevice.

SensorContext

Each input device has a SensorContext describing the available sensors of a device. One file can contain Ink data from two devices of the same type with a shared context.

FieldTypeLabelDescription
idstringMD5 hash according to the MD5 hash-based Unique Identifier Generation Scheme
sensorChannelsContextSensorChannelsContextrepeatedProperties are encoded as semantic triples.

SensorData

SensorData is the central data structure for storing raw data from the ink sensor.

FieldTypeLabelDescription
idstring
inputContextIDstringReferencing the InputContext via id.
stateInkStateState of the ink.
timestampuint64Timestamp for first sample of the stroke, measured in milliseconds
dataChannelsChannelDatarepeated(time when first X & Y are reported). Data channels encode the data list.

Style

A style message, used for Path customization.

FieldTypeLabelDescription
propertiesPathPointPropertiesStatic values of properties which do not exist per per path point
brushURIstringReference to Brush used for stroke rasterization
particlesRandomSeeduint32Particles random seed, required for particle strokes
renderModeURIstringDefines additional information about stroke visualisation, such as ERASER

Tool

FieldTypeLabelDescription
vectorBrushVectorBrush
rasterBrushRasterBrush
blendModeBlendMode
contextPathPointContext

TripleStore

TripleStore - encapsulates a list of TripleGroups

FieldTypeLabelDescription
statementsSemanticTriplerepeatedList of semantic triples.

Uint32

Unsigned integer value wrapper to avoid cross-platform zero value issues.

FieldTypeLabelDescription
valueuint32Unsigned integer value wrapped within the message.

VectorBrush

A brush defined with a polygon (polyhedron for 3D)

FieldTypeLabelDescription
namestringBrush descriptor
prototypeBrushPrototyperepeatedPolygon prototype for the brush.
spacingfloatSpacing value.

View

View - a message representing a view of the ink-tree, which is serialized in the form of another tree.

FieldTypeLabelDescription
namestringView descriptor URI (unique in the model scope)
treeNoderepeatedThe tree structure of the current view

BlendMode

The blend mode enum lists the different blend modes that can be applied to raster brushes.

NameNumberDescription
BLEND_NORMAL0
BLEND_NORMAL_REVERSE1
BLEND_NONE2
BLEND_ERASE3
BLEND_MIN4
BLEND_MAX5
BLEND_ADD6
BLEND_SUBTRACT7
BLEND_SUBTRACT_REVERSE8
BLEND_MULTIPLY_NO_ALPHA9
BLEND_MULTIPLY_NO_ALPHA_INVERT10

InkInputProviderType

Defining the different types of input.

NameNumberDescription
PEN0Stylus, smart pens, pen displays, signature capturing device, ...
TOUCH1Touch controller input: Finger or passive stylus.
MOUSE2Mouse device.
CONTROLLER33-DOF or 6-DOF input devices.

InkSensorMetricType

Supported metric types

NameNumberDescription
LENGTH0Underling si unit is meter.
TIME1Underling si unit is second.
FORCE2Underling si unit is newton.
ANGLE3Underling si unit is radian.
NORMALIZED4Percentage, expressed as a fraction (1.0 = 100%) relative to max-min.
LOGICAL5Logical value, true / false values.
DIMENSIONLESS6No metric defined for sensor.

InkState

The ink device state defines the state of the Ink device. WILL 3.0 supports different modes:

  • Writing on a plane,
  • Hovering above a surface,
  • Moving in the air (VR/AR/MR) interaction,
  • Only hovering in the air.
NameNumberDescription
PLANE0Ink device is writing on a surface.
HOVERING1Hovering over a surface.
IN_VOLUME2Using the ink device in the air, with active inking.
VOLUME_HOVERING3Moving the pen in the air with disabled inking.

InputPropertyType

NameNumberDescription
PRESSURE0Pressure value.
RADIUS_X1Touch radius by X.
RADIUS_Y2Touch radius by Y.
AZIMUTH3Azimuth angle of the pen (yaw).
ALTITUDE4Elevation angle of the pen (pitch).
ROTATION5Rotation (counter-clockwise rotation about pen axis).

NodeType

Defines the node type.

NameNumberDescription
PATH_GROUP0
SENSOR_DATA_GROUP1
PATH2
SENSOR_DATA3

RotationMode

The rotation parameter specifies the rotation of the particle.

NameNumberDescription
NONE0Indicates that the shape will not be rotated.
RANDOM1Indicates that the shape will be rotated randomly before it renders.
TRAJECTORY2Indicates that the shape will be rotated to match the path trajectory.

Scalar Value Types

.proto TypeNotesC++ TypeJava TypePython Type
doubledoubledoublefloat
floatfloatfloatfloat
int32Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead.int32intint
int64Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead.int64longint/long
uint32Uses variable-length encoding.uint32intint/long
uint64Uses variable-length encoding.uint64longint/long
sint32Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s.int32intint
sint64Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s.int64longint/long
fixed32Always four bytes. More efficient than uint32 if values are often greater than 2^28.uint32intint
fixed64Always eight bytes. More efficient than uint64 if values are often greater than 2^56.uint64longint/long
sfixed32Always four bytes.int32intint
sfixed64Always eight bytes.int64longint/long
boolboolbooleanboolean
stringA string must always contain UTF-8 encoded or 7-bit ASCII text.stringStringstr/unicode
bytesMay contain any arbitrary sequence of bytes.stringByteStringstr