# retreev/saeroun architecture

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

- Interactive diagram: https://gitdiagram.com/retreev/saeroun
- Repository: https://github.com/retreev/saeroun

## Overview

Saeroun is a Pangya UI-markup preview tool and library. The CLI locates UI and frame XML plus image assets, deserializes the XML into resource models, builds frame metadata, and invokes the renderer; rendered element images are then saved. Rendering covers forms, bases, and item types including buttons, frames, text, gauges, and viewers, with optional debug overlays. The graph includes the core XML model and rendering helpers; some renderer capabilities are documented or indexed but their full implementations were not sampled, so only evidenced relationships are shown.

Main entry points: [`Saeroun.CLI/Program.cs`](https://github.com/retreev/saeroun/blob/main/Saeroun.CLI/Program.cs) (CLI orchestration), [`Saeroun.Serialization/Models/Element.cs`](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Element.cs) (Element), [`Saeroun.Renderer/ImageSharpRenderer.cs`](https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/ImageSharpRenderer.cs) (Element renderer), [`Saeroun.Serialization/Factories/FrameInfoFactory.cs`](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Factories/FrameInfoFactory.cs) (Frame metadata builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Preview workflow"]
  node_program["CLI orchestration<br/>[Program.cs]"]
  node_xml["XML deserialization<br/>[Program.cs]"]
  node_output["Rendered image files<br/>[Program.cs]"]
end

subgraph group_serialization["XML model"]
  node_framefactory["Frame metadata builder"]
  node_resource["Resource<br/>[Resource.cs]"]
  node_element["Element<br/>[Element.cs]"]
  node_item["Item<br/>[Item.cs]"]
  node_base["Base properties<br/>[Base.cs]"]
  node_frame["Frame model<br/>[Frame.cs]"]
  node_layer["Layer model<br/>[Layer.cs]"]
  node_parameter["Item parameters<br/>[Parameter.cs]"]
  node_frameinfo["Frame info<br/>[FrameInfo.cs]"]
  node_frameatlas["Frame info atlas<br/>[FrameInfoAtlas.cs]"]
end

subgraph group_rendering["Image rendering"]
  node_renderer["Element renderer"]
  node_drawmethods["Element drawing methods"]
  node_fileatlas["Asset lookup<br/>[FileAtlas.cs]"]
  node_dimensions["Dimension parsing<br/>[DimensionHelper.cs]"]
  node_colors["Color conversion<br/>[ColorHelper.cs]"]
  node_strings["String helpers"]
end

node_user(("CLI user"))

node_user -->|"invokes"| node_program
node_program -->|"opens XML"| node_xml
node_xml -->|"deserializes as"| node_resource
node_program -->|"builds frame index"| node_framefactory
node_framefactory -->|"reads elements"| node_element
node_framefactory -->|"creates entries"| node_frameinfo
node_framefactory -->|"returns index"| node_frameatlas
node_program -->|"renders resource"| node_renderer
node_program -->|"provides asset index"| node_fileatlas
node_program -->|"provides frame index"| node_frameatlas
node_renderer -->|"reads elements"| node_resource
node_renderer -->|"renders each"| node_element
node_renderer -->|"dispatches drawing"| node_drawmethods
node_renderer -->|"returns images for saving"| node_output
node_drawmethods -->|"loads assets"| node_fileatlas
node_drawmethods -->|"parses geometry"| node_dimensions
node_drawmethods -->|"converts colors"| node_colors
node_element -->|"contains items"| node_item
node_element -->|"defines base"| node_base
node_element -->|"defines frame variants"| node_frame
node_element -->|"contains layers"| node_layer
node_item -->|"contains parameters"| node_parameter
node_frameatlas -->|"maps frame entries"| node_frameinfo

click node_program "https://github.com/retreev/saeroun/blob/main/Saeroun.CLI/Program.cs"
click node_xml "https://github.com/retreev/saeroun/blob/main/Saeroun.CLI/Program.cs"
click node_framefactory "https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Factories/FrameInfoFactory.cs"
click node_resource "https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Resource.cs"
click node_element "https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Element.cs"
click node_item "https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Item.cs"
click node_base "https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Base.cs"
click node_frame "https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Frame.cs"
click node_layer "https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Layer.cs"
click node_parameter "https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Parameter.cs"
click node_frameinfo "https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/DTO/FrameInfo.cs"
click node_frameatlas "https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/DTO/FrameInfoAtlas.cs"
click node_renderer "https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/ImageSharpRenderer.cs"
click node_drawmethods "https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/Extensions/ImageProcessingContextExtensions.cs"
click node_fileatlas "https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/FileAtlas.cs"
click node_dimensions "https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/Helpers/DimensionHelper.cs"
click node_colors "https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/Helpers/ColorHelper.cs"
click node_strings "https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/Extensions/StringExtensions.cs"
click node_output "https://github.com/retreev/saeroun/blob/main/Saeroun.CLI/Program.cs"

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_program,node_xml,node_output,node_user toneBlue
class node_framefactory,node_resource,node_element,node_item,node_base,node_frame,node_layer,node_parameter,node_frameinfo,node_frameatlas toneAmber
class node_renderer,node_drawmethods,node_fileatlas,node_dimensions,node_colors,node_strings toneMint
```

## Components

### Preview workflow

- [CLI orchestration](https://github.com/retreev/saeroun/blob/main/Saeroun.CLI/Program.cs): `Saeroun.CLI/Program.cs`
- [XML deserialization](https://github.com/retreev/saeroun/blob/main/Saeroun.CLI/Program.cs): `Saeroun.CLI/Program.cs`
- [Rendered image files](https://github.com/retreev/saeroun/blob/main/Saeroun.CLI/Program.cs): `Saeroun.CLI/Program.cs`

### XML model

- [Frame metadata builder](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Factories/FrameInfoFactory.cs): `Saeroun.Serialization/Factories/FrameInfoFactory.cs`
- [Resource](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Resource.cs): `Saeroun.Serialization/Models/Resource.cs`
- [Element](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Element.cs): `Saeroun.Serialization/Models/Element.cs`
- [Item](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Item.cs): `Saeroun.Serialization/Models/Item.cs`
- [Base properties](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Base.cs): `Saeroun.Serialization/Models/Base.cs`
- [Frame model](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Frame.cs): `Saeroun.Serialization/Models/Frame.cs`
- [Layer model](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Layer.cs): `Saeroun.Serialization/Models/Layer.cs`
- [Item parameters](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/Models/Parameter.cs): `Saeroun.Serialization/Models/Parameter.cs`
- [Frame info](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/DTO/FrameInfo.cs): `Saeroun.Serialization/DTO/FrameInfo.cs`
- [Frame info atlas](https://github.com/retreev/saeroun/blob/main/Saeroun.Serialization/DTO/FrameInfoAtlas.cs): `Saeroun.Serialization/DTO/FrameInfoAtlas.cs`

### Image rendering

- [Element renderer](https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/ImageSharpRenderer.cs): `Saeroun.Renderer/ImageSharpRenderer.cs`
- [Element drawing methods](https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/Extensions/ImageProcessingContextExtensions.cs): `Saeroun.Renderer/Extensions/ImageProcessingContextExtensions.cs`
- [Asset lookup](https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/FileAtlas.cs): `Saeroun.Renderer/FileAtlas.cs`
- [Dimension parsing](https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/Helpers/DimensionHelper.cs): `Saeroun.Renderer/Helpers/DimensionHelper.cs`
- [Color conversion](https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/Helpers/ColorHelper.cs): `Saeroun.Renderer/Helpers/ColorHelper.cs`
- [String helpers](https://github.com/retreev/saeroun/blob/main/Saeroun.Renderer/Extensions/StringExtensions.cs): `Saeroun.Renderer/Extensions/StringExtensions.cs`

### Other components

- **CLI user**

## Connections

- CLI user → CLI orchestration: invokes (evidence: `Saeroun.CLI/Program.cs`)
- CLI orchestration → XML deserialization: opens XML (evidence: `Saeroun.CLI/Program.cs`)
- XML deserialization → Resource: deserializes as (evidence: `Saeroun.CLI/Program.cs`)
- CLI orchestration → Frame metadata builder: builds frame index (evidence: `Saeroun.CLI/Program.cs`)
- Frame metadata builder → Element: reads elements (evidence: `Saeroun.Serialization/Factories/FrameInfoFactory.cs`)
- Frame metadata builder → Frame info: creates entries (evidence: `Saeroun.Serialization/Factories/FrameInfoFactory.cs`)
- Frame metadata builder → Frame info atlas: returns index (evidence: `Saeroun.Serialization/Factories/FrameInfoFactory.cs`)
- CLI orchestration → Element renderer: renders resource (evidence: `Saeroun.CLI/Program.cs`)
- CLI orchestration → Asset lookup: provides asset index (evidence: `Saeroun.CLI/Program.cs`)
- CLI orchestration → Frame info atlas: provides frame index (evidence: `Saeroun.CLI/Program.cs`)
- Element renderer → Resource: reads elements (evidence: `Saeroun.Renderer/ImageSharpRenderer.cs`)
- Element renderer → Element: renders each (evidence: `Saeroun.Renderer/ImageSharpRenderer.cs`)
- Element renderer → Element drawing methods: dispatches drawing (evidence: `Saeroun.Renderer/ImageSharpRenderer.cs`)
- Element renderer → Rendered image files: returns images for saving (evidence: `Saeroun.CLI/Program.cs`)
- Element drawing methods → Asset lookup: loads assets (evidence: `Saeroun.Renderer/Extensions/ImageProcessingContextExtensions.cs`)
- Element drawing methods → Dimension parsing: parses geometry (evidence: `Saeroun.Renderer/Extensions/ImageProcessingContextExtensions.cs`)
- Element drawing methods → Color conversion: converts colors (evidence: `Saeroun.Renderer/Extensions/ImageProcessingContextExtensions.cs`)
- Element → Item: contains items (evidence: `Saeroun.Serialization/Models/Element.cs`)
- Element → Base properties: defines base (evidence: `Saeroun.Serialization/Models/Element.cs`)
- Element → Frame model: defines frame variants (evidence: `Saeroun.Serialization/Models/Element.cs`)
- Element → Layer model: contains layers (evidence: `Saeroun.Serialization/Models/Element.cs`)
- Item → Item parameters: contains parameters (evidence: `Saeroun.Serialization/Models/Item.cs`)
- Frame info atlas → Frame info: maps frame entries (evidence: `Saeroun.Serialization/DTO/FrameInfoAtlas.cs`)
