# fingsinz/fphoto architecture

> Architecture diagram of the GitHub repository fingsinz/fphoto, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fingsinz/fphoto
- Repository: https://github.com/fingsinz/fphoto

## Overview

##### Project type and purpose
- FPHOTO is a native desktop image-processing application written in C++ using Qt for its GUI.

##### File structure
- Top-level solution: FPHOTO.sln (Visual Studio project)
- Main source directory: FPHOTO/
- FPHOTO.ui, FPHOTO.qrc → Qt Designer UI form and resources
- main.cpp → application entry point, QApplication setup
- FPHOTO.cpp/h → main window class (UI + signal/slot wiring)
- ImgInstance.cpp/h → image data model (pixel buffer, metadata)
- ImgProcess.cpp/h → core image‐processing algorithms
- PhotoShow.cpp/h → widget responsible for rendering images on screen
- Utils.cpp/h → helper functions (file I/O wrappers, conversions)

##### README for additional insights
- Confirms use of Qt 5.15.2 and MSVC2019 toolchain under VS2022
- No external services—purely local, event-driven GUI + algorithmic engine

##### Detailed breakdown of components
- User: desktop end-user
- UI Layer
- MainWindow («QWidget»)
- PhotoShow («QWidget»)
- Controller/Core Logic
- ImgProcess («C++ Class»)
– Geometry (zoom, rotate, flip, crop)
– Histogram (stats, equalization)
– Spatial Filters (smooth, sharpen)
– Morphology (dilate, erode, open, close)
– Segmentation (manual, auto, OTSU, region growing)
– Drawing (lines, rectangles, circles, text)
- Data Model
- ImgInstance («Pixel Buffer + Metadata»)
- Utilities
- Utils («File I/O, Format Conversions»)
- Persistence
- File System (JPEG, PNG, BMP readers/writers)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "UI Layer"
        MainWindow["MainWindow «QWidget»"]:::ui
        PhotoShow["PhotoShow «QWidget»"]:::ui
    end

    subgraph "Controller / Core Logic"
        ImgProcess["ImgProcess «C++ Class»"]:::core
    end

    subgraph "Data Model"
        ImgInstance["ImgInstance «Pixel Buffer + Metadata»"]:::model
    end

    subgraph "Utilities"
        Utils["Utils «File I/O, Format Conversions»"]:::util
    end

    subgraph "Persistence"
        FileSystem["File System (JPEG, PNG, BMP)"]:::external
    end

    User["User"]:::external
    main["main.cpp"]:::util
    QtRes["FPHOTO.qrc"]:::util
    Proj["Project Definition"]:::external

    User -->|"interacts"| MainWindow
    main -->|"instantiates"| MainWindow
    MainWindow -->|"signals: openImage(), applyFilter(), saveImage()"| ImgProcess
    ImgProcess -->|"operates on"| ImgInstance
    ImgInstance -->|"notifies updateView()"| PhotoShow
    MainWindow -->|"calls updateView() on"| PhotoShow
    MainWindow -->|"loads resources"| QtRes
    MainWindow -->|"calls Utils for I/O"| Utils
    Utils -->|"reads/writes"| FileSystem
    Utils -->|"passes image data"| ImgInstance

    click MainWindow "https://github.com/fingsinz/fphoto/blob/master/FPHOTO/FPHOTO.cpp"
    click PhotoShow "https://github.com/fingsinz/fphoto/blob/master/FPHOTO/PhotoShow.cpp"
    click ImgProcess "https://github.com/fingsinz/fphoto/blob/master/FPHOTO/ImgProcess.cpp"
    click ImgInstance "https://github.com/fingsinz/fphoto/blob/master/FPHOTO/ImgInstance.cpp"
    click Utils "https://github.com/fingsinz/fphoto/blob/master/FPHOTO/Utils.cpp"
    click main "https://github.com/fingsinz/fphoto/blob/master/FPHOTO/main.cpp"
    click QtRes "https://github.com/fingsinz/fphoto/blob/master/FPHOTO/FPHOTO.qrc"
    click Proj "https://github.com/fingsinz/fphoto/blob/master/FPHOTO.sln"

    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef core fill:#90EE90,stroke:#333,stroke-width:1px
    classDef model fill:#FFFFE0,stroke:#333,stroke-width:1px
    classDef util fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#f0f0f0,stroke:#333,stroke-width:1px
```
