# th3paypal/bmp-photo-editor architecture

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

- Interactive diagram: https://gitdiagram.com/th3paypal/bmp-photo-editor
- Repository: https://github.com/th3paypal/bmp-photo-editor

## Overview

This is a command-line BMP image processor: it reads an image, applies requested filters in argument order, and writes the result. The main workflow and supported filters are documented in the README; the sampled code confirms the image model, BMP I/O, filter implementations, and token parsing. The application entry point was read but its source excerpt is not included, so orchestration links rely on README evidence. Filter capabilities share one implementation file and are shown as distinct domain stages.

Main entry points: [`filter.h`](https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.h) (Filter interface), [`image_processor.cpp`](https://github.com/th3paypal/bmp-photo-editor/blob/main/image_processor.cpp) (Processor), [`Reader.cpp`](https://github.com/th3paypal/bmp-photo-editor/blob/main/Reader.cpp) (BMP reader), [`Image.h`](https://github.com/th3paypal/bmp-photo-editor/blob/main/Image.h) (Pixel image)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_app["Processor"]
  node_tokens["Argument tokens<br/>[parse.cpp]"]
end

subgraph group_bmp["BMP I/O"]
  node_reader["BMP reader<br/>[Reader.cpp]"]
  node_writer["BMP writer<br/>[Writer.cpp]"]
end

subgraph group_image["Image model"]
  node_model["Pixel image<br/>[Image.h]"]
  node_color["Pixel color<br/>[Color.h]"]
end

subgraph group_filters["Image filters"]
  node_filter_api["Filter interface<br/>[filter.h]"]
  node_factory["Filter factory<br/>[filter.cpp]"]
  node_basic["Basic filters<br/>[filter.cpp]"]
  node_blur["Gaussian blur<br/>[filter.cpp]"]
  node_edge["Edge detection<br/>[filter.cpp]"]
  node_circular["Circular blur<br/>[filter.cpp]"]
end

node_user(("CLI user"))
node_input["Input BMP"]
node_output["Output BMP"]

node_user -->|"runs"| node_app
node_app -->|"parses arguments"| node_tokens
node_app -->|"loads BMP"| node_reader
node_input -->|"provides bytes"| node_reader
node_reader -->|"builds image"| node_model
node_app -->|"creates filters"| node_factory
node_factory -->|"creates implementation"| node_filter_api
node_app -->|"applies in order"| node_filter_api
node_filter_api -->|"transforms pixels"| node_model
node_basic -->|"implements"| node_filter_api
node_blur -->|"implements"| node_filter_api
node_edge -->|"implements"| node_filter_api
node_circular -->|"implements"| node_filter_api
node_app -->|"saves image"| node_writer
node_writer -->|"writes BMP"| node_output
node_model -->|"stores pixels"| node_color

click node_app "https://github.com/th3paypal/bmp-photo-editor/blob/main/image_processor.cpp"
click node_tokens "https://github.com/th3paypal/bmp-photo-editor/blob/main/parse.cpp"
click node_reader "https://github.com/th3paypal/bmp-photo-editor/blob/main/Reader.cpp"
click node_writer "https://github.com/th3paypal/bmp-photo-editor/blob/main/Writer.cpp"
click node_model "https://github.com/th3paypal/bmp-photo-editor/blob/main/Image.h"
click node_color "https://github.com/th3paypal/bmp-photo-editor/blob/main/Color.h"
click node_filter_api "https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.h"
click node_factory "https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.cpp"
click node_basic "https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.cpp"
click node_blur "https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.cpp"
click node_edge "https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.cpp"
click node_circular "https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.cpp"

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_tokens,node_user toneBlue
class node_reader,node_writer toneAmber
class node_model,node_color toneMint
class node_filter_api,node_factory,node_basic,node_blur,node_edge,node_circular toneRose
class node_input,node_output toneIndigo
```

## Components

### Command line

- [Processor](https://github.com/th3paypal/bmp-photo-editor/blob/main/image_processor.cpp): `image_processor.cpp`
- [Argument tokens](https://github.com/th3paypal/bmp-photo-editor/blob/main/parse.cpp): `parse.cpp`

### BMP I/O

- [BMP reader](https://github.com/th3paypal/bmp-photo-editor/blob/main/Reader.cpp): `Reader.cpp`
- [BMP writer](https://github.com/th3paypal/bmp-photo-editor/blob/main/Writer.cpp): `Writer.cpp`

### Image model

- [Pixel image](https://github.com/th3paypal/bmp-photo-editor/blob/main/Image.h): `Image.h`
- [Pixel color](https://github.com/th3paypal/bmp-photo-editor/blob/main/Color.h): `Color.h`

### Image filters

- [Filter interface](https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.h): `filter.h`
- [Filter factory](https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.cpp): `filter.cpp`
- [Basic filters](https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.cpp): `filter.cpp`
- [Gaussian blur](https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.cpp): `filter.cpp`
- [Edge detection](https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.cpp): `filter.cpp`
- [Circular blur](https://github.com/th3paypal/bmp-photo-editor/blob/main/filter.cpp): `filter.cpp`

### Other components

- **CLI user**
- **Input BMP**
- **Output BMP**

## Connections

- CLI user → Processor: runs (evidence: `readme.md`)
- Processor → Argument tokens: parses arguments (evidence: `readme.md`)
- Processor → BMP reader: loads BMP (evidence: `readme.md`)
- Input BMP → BMP reader: provides bytes (evidence: `readme.md`)
- BMP reader → Pixel image: builds image (evidence: `Reader.cpp`)
- Processor → Filter factory: creates filters (evidence: `readme.md`)
- Filter factory → Filter interface: creates implementation (evidence: `filter.cpp`)
- Processor → Filter interface: applies in order (evidence: `readme.md`)
- Filter interface → Pixel image: transforms pixels (evidence: `filter.h`)
- Basic filters → Filter interface: implements (evidence: `filter.h`)
- Gaussian blur → Filter interface: implements (evidence: `filter.h`)
- Edge detection → Filter interface: implements (evidence: `filter.h`)
- Circular blur → Filter interface: implements (evidence: `filter.h`)
- Processor → BMP writer: saves image (evidence: `readme.md`)
- BMP writer → Output BMP: writes BMP (evidence: `Writer.cpp`)
- Pixel image → Pixel color: stores pixels (evidence: `Image.h`)
