MD

Paint Operation

canonical/paint-operation.md

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:

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