# steffest/dpaint-js architecture

> Architecture diagram of the GitHub repository steffest/dpaint-js, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/steffest/dpaint-js
- Repository: https://github.com/steffest/dpaint-js

## Overview

DPaint.js is a browser-based pixel-art and animation editor centered on a document-editing workflow: users interact through the editor and tools, modify a layered image and palette, and export to image or Amiga formats. Its major branches include color reduction and dithering, frame-based animation, undo/redo, and Amiga-specific file and emulator support. The graph uses README claims for documented capabilities and the supplied source index or excerpts for implementation links; unsampled modules are not assumed to have inspected call paths.

Main entry points: [`_script/app.js`](https://github.com/steffest/dpaint-js/blob/master/_script/app.js) (Application startup), [`_script/image.js`](https://github.com/steffest/dpaint-js/blob/master/_script/image.js) (Image document), [`_script/ui/editor.js`](https://github.com/steffest/dpaint-js/blob/master/_script/ui/editor.js) (Canvas editor), [`_script/util/layerUtils.js`](https://github.com/steffest/dpaint-js/blob/master/_script/util/layerUtils.js) (Layer composition)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Editor interface"]
  node_app["Application startup<br/>[app.js]"]
  node_ui["UI and panels<br/>[ui.js]"]
  node_input["Input handling<br/>[input.js]"]
  node_editor["Canvas editor<br/>[editor.js]"]
  node_panel["Layer panel<br/>[layerPanel.js]"]
end

subgraph group_document["Document editing"]
  node_document_model["Image document<br/>[image.js]"]
  node_history["Undo and redo<br/>[historyservice.js]"]
  node_layer_utils["Layer composition<br/>[layerUtils.js]"]
  node_vector_tool["Vector tools<br/>[vectorTool.js]"]
  node_bone_tool["Bone tools<br/>[boneTool.js]"]
end

subgraph group_pixels["Pixel processing"]
  node_palette["Palette and cycling<br/>[palette.js]"]
  node_processing["Image processing<br/>[imageProcessing.js]"]
  node_quant_worker["Quantization workers<br/>[quantize.js]"]
  node_quant_worker2["Alternate quantizer<br/>[quantize2.js]"]
end

subgraph group_formats["File formats"]
  node_export["Export generation<br/>[generate.js]"]
  node_iff["IFF ILBM codec<br/>[iff.js]"]
  node_icon["Amiga icon codec<br/>[amigaIcon.js]"]
  node_format_detect["Format detection<br/>[detect.js]"]
end

subgraph group_animation["Animation and Amiga"]
  node_playback["Animation playback<br/>[playbackDriver.js]"]
  node_recorder["Recording and export<br/>[recorder.js]"]
  node_adf["Amiga disk files<br/>[adf.js]"]
  node_amiga_host["Amiga emulator host<br/>[amibase.js]"]
end

node_user(("Artist"))

node_user -->|"uses"| node_app
node_app -->|"initializes"| node_ui
node_app -->|"uses"| node_document_model
node_input -->|"dispatches input"| node_editor
node_editor -->|"edits"| node_document_model
node_editor -->|"uses history"| node_history
node_panel -->|"reads layers"| node_document_model
node_panel -->|"uses history"| node_history
node_document_model -->|"records changes"| node_history
node_document_model -->|"detects format"| node_format_detect
node_document_model -->|"uses codec"| node_icon
node_document_model -->|"uses layer helpers"| node_layer_utils
node_layer_utils -->|"uses vector utilities"| node_vector_tool
node_layer_utils -->|"uses deformation"| node_bone_tool
node_palette -->|"reduces colors"| node_processing
node_processing -->|"dispatches quantization"| node_quant_worker
node_processing -->|"dispatches quantization"| node_quant_worker2
node_export -->|"uses codec"| node_iff
node_export -->|"uses codec"| node_icon
node_app -.->|"supports animation"| node_playback
node_app -.->|"supports recording"| node_recorder
node_app -.->|"supports disk files"| node_adf
node_app -.->|"hosts emulator"| node_amiga_host
node_user -->|"exports work"| node_export
node_user -->|"animates frames"| node_playback
node_user -->|"previews work"| node_amiga_host

click node_app "https://github.com/steffest/dpaint-js/blob/master/_script/app.js"
click node_ui "https://github.com/steffest/dpaint-js/blob/master/_script/ui/ui.js"
click node_input "https://github.com/steffest/dpaint-js/blob/master/_script/ui/input.js"
click node_editor "https://github.com/steffest/dpaint-js/blob/master/_script/ui/editor.js"
click node_panel "https://github.com/steffest/dpaint-js/blob/master/_script/ui/toolPanels/layerPanel.js"
click node_document_model "https://github.com/steffest/dpaint-js/blob/master/_script/image.js"
click node_history "https://github.com/steffest/dpaint-js/blob/master/_script/services/historyservice.js"
click node_layer_utils "https://github.com/steffest/dpaint-js/blob/master/_script/util/layerUtils.js"
click node_vector_tool "https://github.com/steffest/dpaint-js/blob/master/_script/paintTools/vectorTool.js"
click node_bone_tool "https://github.com/steffest/dpaint-js/blob/master/_script/paintTools/boneTool.js"
click node_palette "https://github.com/steffest/dpaint-js/blob/master/_script/ui/palette.js"
click node_processing "https://github.com/steffest/dpaint-js/blob/master/_script/util/imageProcessing.js"
click node_quant_worker "https://github.com/steffest/dpaint-js/blob/master/_script/workers/quantize.js"
click node_quant_worker2 "https://github.com/steffest/dpaint-js/blob/master/_script/workers/quantize2.js"
click node_export "https://github.com/steffest/dpaint-js/blob/master/_script/fileformats/generate.js"
click node_iff "https://github.com/steffest/dpaint-js/blob/master/_script/fileformats/iff.js"
click node_icon "https://github.com/steffest/dpaint-js/blob/master/_script/fileformats/amigaIcon.js"
click node_format_detect "https://github.com/steffest/dpaint-js/blob/master/_script/fileformats/detect.js"
click node_playback "https://github.com/steffest/dpaint-js/blob/master/_script/services/playbackDriver.js"
click node_recorder "https://github.com/steffest/dpaint-js/blob/master/_script/services/recorder.js"
click node_adf "https://github.com/steffest/dpaint-js/blob/master/_script/fileformats/adf.js"
click node_amiga_host "https://github.com/steffest/dpaint-js/blob/master/_script/host/amibase.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_ui,node_input,node_editor,node_panel toneBlue
class node_document_model,node_history,node_layer_utils,node_vector_tool,node_bone_tool toneAmber
class node_palette,node_processing,node_quant_worker,node_quant_worker2 toneMint
class node_export,node_iff,node_icon,node_format_detect toneRose
class node_playback,node_recorder,node_adf,node_amiga_host,node_user toneIndigo
```

## Components

### Editor interface

- [Application startup](https://github.com/steffest/dpaint-js/blob/master/_script/app.js): `_script/app.js`
- [UI and panels](https://github.com/steffest/dpaint-js/blob/master/_script/ui/ui.js): `_script/ui/ui.js`
- [Input handling](https://github.com/steffest/dpaint-js/blob/master/_script/ui/input.js): `_script/ui/input.js`
- [Canvas editor](https://github.com/steffest/dpaint-js/blob/master/_script/ui/editor.js): `_script/ui/editor.js`
- [Layer panel](https://github.com/steffest/dpaint-js/blob/master/_script/ui/toolPanels/layerPanel.js): `_script/ui/toolPanels/layerPanel.js`

### Document editing

- [Image document](https://github.com/steffest/dpaint-js/blob/master/_script/image.js): `_script/image.js`
- [Undo and redo](https://github.com/steffest/dpaint-js/blob/master/_script/services/historyservice.js): `_script/services/historyservice.js`
- [Layer composition](https://github.com/steffest/dpaint-js/blob/master/_script/util/layerUtils.js): `_script/util/layerUtils.js`
- [Vector tools](https://github.com/steffest/dpaint-js/blob/master/_script/paintTools/vectorTool.js): `_script/paintTools/vectorTool.js`
- [Bone tools](https://github.com/steffest/dpaint-js/blob/master/_script/paintTools/boneTool.js): `_script/paintTools/boneTool.js`

### Pixel processing

- [Palette and cycling](https://github.com/steffest/dpaint-js/blob/master/_script/ui/palette.js): `_script/ui/palette.js`
- [Image processing](https://github.com/steffest/dpaint-js/blob/master/_script/util/imageProcessing.js): `_script/util/imageProcessing.js`
- [Quantization workers](https://github.com/steffest/dpaint-js/blob/master/_script/workers/quantize.js): `_script/workers/quantize.js`
- [Alternate quantizer](https://github.com/steffest/dpaint-js/blob/master/_script/workers/quantize2.js): `_script/workers/quantize2.js`

### File formats

- [Export generation](https://github.com/steffest/dpaint-js/blob/master/_script/fileformats/generate.js): `_script/fileformats/generate.js`
- [IFF ILBM codec](https://github.com/steffest/dpaint-js/blob/master/_script/fileformats/iff.js): `_script/fileformats/iff.js`
- [Amiga icon codec](https://github.com/steffest/dpaint-js/blob/master/_script/fileformats/amigaIcon.js): `_script/fileformats/amigaIcon.js`
- [Format detection](https://github.com/steffest/dpaint-js/blob/master/_script/fileformats/detect.js): `_script/fileformats/detect.js`

### Animation and Amiga

- [Animation playback](https://github.com/steffest/dpaint-js/blob/master/_script/services/playbackDriver.js): `_script/services/playbackDriver.js`
- [Recording and export](https://github.com/steffest/dpaint-js/blob/master/_script/services/recorder.js): `_script/services/recorder.js`
- [Amiga disk files](https://github.com/steffest/dpaint-js/blob/master/_script/fileformats/adf.js): `_script/fileformats/adf.js`
- [Amiga emulator host](https://github.com/steffest/dpaint-js/blob/master/_script/host/amibase.js): `_script/host/amibase.js`

### Other components

- **Artist**

## Connections

- Artist → Application startup: uses (evidence: `README.md`)
- Application startup → UI and panels: initializes (evidence: `_script/app.js`)
- Application startup → Image document: uses (evidence: `_script/app.js`)
- Input handling → Canvas editor: dispatches input (evidence: `_script/ui/input.js`)
- Canvas editor → Image document: edits (evidence: `_script/ui/editor.js`)
- Canvas editor → Undo and redo: uses history (evidence: `_script/ui/editor.js`)
- Layer panel → Image document: reads layers (evidence: `_script/ui/toolPanels/layerPanel.js`)
- Layer panel → Undo and redo: uses history (evidence: `_script/ui/toolPanels/layerPanel.js`)
- Image document → Undo and redo: records changes (evidence: `_script/image.js`)
- Image document → Format detection: detects format (evidence: `_script/image.js`)
- Image document → Amiga icon codec: uses codec (evidence: `_script/image.js`)
- Image document → Layer composition: uses layer helpers (evidence: `_script/image.js`)
- Layer composition → Vector tools: uses vector utilities (evidence: `_script/util/layerUtils.js`)
- Layer composition → Bone tools: uses deformation (evidence: `_script/util/layerUtils.js`)
- Palette and cycling → Image processing: reduces colors (evidence: `_script/ui/palette.js`)
- Image processing → Quantization workers: dispatches quantization (evidence: `_script/util/imageProcessing.js`)
- Image processing → Alternate quantizer: dispatches quantization (evidence: `_script/util/imageProcessing.js`)
- Export generation → IFF ILBM codec: uses codec (evidence: `_script/fileformats/generate.js`)
- Export generation → Amiga icon codec: uses codec (evidence: `_script/fileformats/generate.js`)
- Application startup → Animation playback: supports animation
- Application startup → Recording and export: supports recording
- Application startup → Amiga disk files: supports disk files
- Application startup → Amiga emulator host: hosts emulator
- Artist → Export generation: exports work (evidence: `README.md`)
- Artist → Animation playback: animates frames (evidence: `README.md`)
- Artist → Amiga emulator host: previews work (evidence: `README.md`)
