# joaobaptmg/pathrenderinglab architecture

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

- Interactive diagram: https://gitdiagram.com/joaobaptmg/pathrenderinglab
- Repository: https://github.com/joaobaptmg/pathrenderinglab

## Overview

PathRenderingLab is an experimental SVG vector renderer: it parses SVG paths, converts fills and strokes into GPU-oriented triangle primitives, and runs a MonoGame display. The README documents solid, linear-gradient, and radial-gradient paint support and distinguishes ordinary, curve, and double-curve triangles. The graph reflects the sampled entry point and compiler-related files; internal calls between unsampled compiler stages are omitted where their wiring is uncertain.

Main entry points: [`PathRenderingLab/Program.cs`](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/Program.cs) (Application entry), [`PathRenderingLab/PathCompiler/PathCompiler.cs`](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/PathCompiler.cs) (Path compiler), [`Bitlush.AvlTree/AvlTree.cs`](https://github.com/joaobaptmg/pathrenderinglab/blob/master/Bitlush.AvlTree/AvlTree.cs) (AVL tree), [`PathRenderingLab/PaintServers/PaintServerCreator.cs`](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PaintServers/PaintServerCreator.cs) (Paint conversion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["SVG input"]
  node_svgdoc["SVG document"]
  node_program["Application entry<br/>[Program.cs]"]
  node_paintcreator["Paint conversion"]
end

subgraph group_geometry["Path geometry"]
  node_path["Path model<br/>[Path.cs]"]
  node_compiler["Path compiler<br/>[PathCompiler.cs]"]
  node_curves["Curve geometry<br/>[Curve.cs]"]
  node_dcel["Planar topology<br/>[DCEL.cs]"]
  node_triangulator["Polygon triangulation<br/>[Triangulator.cs]"]
  node_drawing["Compiled drawing<br/>[CompiledDrawing.cs]"]
  node_triangles["Triangle primitives<br/>[Triangle.cs]"]
  node_curvetriangles["Curve primitives<br/>[CurveTriangle.cs]"]
  node_doubletriangles["Double-curve primitives"]
end

subgraph group_render["Rendering"]
  node_paintservers["Paint servers<br/>[IPaintServer.cs]"]
  node_game["MonoGame renderer"]
end

subgraph group_support["Geometry support"]
  node_avltree["AVL tree<br/>[AvlTree.cs]"]
  node_avlnode["AVL nodes<br/>[AvlNode.cs]"]
  node_enumerator["Tree enumerator"]
end

node_user(("User"))
node_gpu(("Graphics device"))

node_user -->|"starts with SVG"| node_program
node_program -->|"opens file"| node_svgdoc
node_program -->|"collects paths"| node_path
node_program -->|"compiles fill and stroke"| node_compiler
node_program -->|"converts paint"| node_paintcreator
node_paintcreator -->|"creates"| node_paintservers
node_compiler -->|"processes curves"| node_curves
node_compiler -->|"builds topology"| node_dcel
node_compiler -->|"triangulates contours"| node_triangulator
node_compiler -->|"produces"| node_drawing
node_triangulator -->|"uses ordered edges"| node_avltree
node_avltree -->|"stores nodes"| node_avlnode
node_avltree -->|"creates enumerator"| node_enumerator
node_program -->|"passes drawing data"| node_game
node_game -->|"renders primitives"| node_gpu

click node_program "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/Program.cs"
click node_paintcreator "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PaintServers/PaintServerCreator.cs"
click node_paintservers "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PaintServers/IPaintServer.cs"
click node_path "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/Path.cs"
click node_compiler "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/PathCompiler.cs"
click node_curves "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/Curve.cs"
click node_dcel "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/DCEL/DCEL.cs"
click node_triangulator "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/Triangulator/Triangulator.cs"
click node_drawing "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/CompiledDrawing.cs"
click node_triangles "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/Triangle.cs"
click node_curvetriangles "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/CurveTriangle.cs"
click node_doubletriangles "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/DoubleCurveTriangle.cs"
click node_game "https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathRenderingLab.cs"
click node_avltree "https://github.com/joaobaptmg/pathrenderinglab/blob/master/Bitlush.AvlTree/AvlTree.cs"
click node_avlnode "https://github.com/joaobaptmg/pathrenderinglab/blob/master/Bitlush.AvlTree/AvlNode.cs"
click node_enumerator "https://github.com/joaobaptmg/pathrenderinglab/blob/master/Bitlush.AvlTree/AvlNodeEnumerator.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_svgdoc,node_program,node_paintcreator,node_user toneBlue
class node_path,node_compiler,node_curves,node_dcel,node_triangulator,node_drawing,node_triangles,node_curvetriangles,node_doubletriangles toneAmber
class node_paintservers,node_game toneMint
class node_avltree,node_avlnode,node_enumerator toneRose
class node_gpu toneIndigo
```

## Components

### SVG input

- **SVG document**
- [Application entry](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/Program.cs): `PathRenderingLab/Program.cs`
- [Paint conversion](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PaintServers/PaintServerCreator.cs): `PathRenderingLab/PaintServers/PaintServerCreator.cs`

### Path geometry

- [Path model](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/Path.cs): `PathRenderingLab/Path.cs`
- [Path compiler](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/PathCompiler.cs): `PathRenderingLab/PathCompiler/PathCompiler.cs`
- [Curve geometry](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/Curve.cs): `PathRenderingLab/PathCompiler/Curve.cs`
- [Planar topology](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/DCEL/DCEL.cs): `PathRenderingLab/PathCompiler/DCEL/DCEL.cs`
- [Polygon triangulation](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/Triangulator/Triangulator.cs): `PathRenderingLab/PathCompiler/Triangulator/Triangulator.cs`
- [Compiled drawing](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/CompiledDrawing.cs): `PathRenderingLab/PathCompiler/CompiledDrawing.cs`
- [Triangle primitives](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/Triangle.cs): `PathRenderingLab/PathCompiler/Triangle.cs`
- [Curve primitives](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/CurveTriangle.cs): `PathRenderingLab/PathCompiler/CurveTriangle.cs`
- [Double-curve primitives](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathCompiler/DoubleCurveTriangle.cs): `PathRenderingLab/PathCompiler/DoubleCurveTriangle.cs`

### Rendering

- [Paint servers](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PaintServers/IPaintServer.cs): `PathRenderingLab/PaintServers/IPaintServer.cs`
- [MonoGame renderer](https://github.com/joaobaptmg/pathrenderinglab/blob/master/PathRenderingLab/PathRenderingLab.cs): `PathRenderingLab/PathRenderingLab.cs`

### Geometry support

- [AVL tree](https://github.com/joaobaptmg/pathrenderinglab/blob/master/Bitlush.AvlTree/AvlTree.cs): `Bitlush.AvlTree/AvlTree.cs`
- [AVL nodes](https://github.com/joaobaptmg/pathrenderinglab/blob/master/Bitlush.AvlTree/AvlNode.cs): `Bitlush.AvlTree/AvlNode.cs`
- [Tree enumerator](https://github.com/joaobaptmg/pathrenderinglab/blob/master/Bitlush.AvlTree/AvlNodeEnumerator.cs): `Bitlush.AvlTree/AvlNodeEnumerator.cs`

### Other components

- **User**
- **Graphics device**

## Connections

- User → Application entry: starts with SVG
- Application entry → SVG document: opens file
- Application entry → Path model: collects paths
- Application entry → Path compiler: compiles fill and stroke
- Application entry → Paint conversion: converts paint
- Paint conversion → Paint servers: creates
- Path compiler → Curve geometry: processes curves
- Path compiler → Planar topology: builds topology
- Path compiler → Polygon triangulation: triangulates contours
- Path compiler → Compiled drawing: produces
- Polygon triangulation → AVL tree: uses ordered edges
- AVL tree → AVL nodes: stores nodes
- AVL tree → Tree enumerator: creates enumerator
- Application entry → MonoGame renderer: passes drawing data
- MonoGame renderer → Graphics device: renders primitives
