Paint Operation
Purpose
A Paint operation is an edit record inside Paint source Resource content.
Paint operations describe how to reproduce a Paint document from an empty canvas. They are stored by Paint in the source Resource content and interpreted by Paint-compatible renderers.
A Paint operation is not a canonical Action. A canonical Action describes an available interaction. A Paint operation records document edit state.
Ownership
Paint owns Paint operation semantics.
Storage stores Paint operation bytes only as part of an immutable source Resource. Storage does not interpret Paint operations.
Runtimes may render Paint operations when presenting a Paint document, but runtimes do not own Paint operation semantics.
Structure
A Paint operation contains:
id- Identifier for this operation within the source Resource content.type- Paint operation type.created- Timestamp for the operation.tool- Tool that produced the operation.style- Visual style data required to render the operation.geometry- Geometry data required to render the operation.
Initial supported operation type:
stroke
Example stroke:
{
"id": "paint.operation:...",
"type": "stroke",
"created": "...",
"tool": "pencil",
"style": {
"color": "#000000",
"width": 4
},
"geometry": {
"points": [
{"x": 10, "y": 20},
{"x": 24, "y": 32}
]
}
}
Source Resource Content
Paint operations are stored in the source Resource content:
{
"width": 1024,
"height": 768,
"operations": [
{
"id": "paint.operation:...",
"type": "stroke",
"created": "...",
"tool": "pencil",
"style": {
"color": "#000000",
"width": 4
},
"geometry": {
"points": [
{"x": 10, "y": 20},
{"x": 24, "y": 32}
]
}
}
]
}
Immutability
Paint operations are part of immutable source Resource content.
Adding, undoing, redoing, clearing, or otherwise changing a Paint document creates a new source Resource. Past source Resources remain unchanged.
Characteristics
- Paint operations are document state, not user-facing Actions.
- Paint operations are ordered within source Resource content.
- Paint operations do not contain Storage paths.
- Paint operations do not contain runtime HTML.
- Paint operations must contain enough data to reproduce the drawing deterministically.