# m-yousuf-m/painttool architecture

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

- Interactive diagram: https://gitdiagram.com/m-yousuf-m/painttool
- Repository: https://github.com/m-yousuf-m/painttool

## Overview

##### Project type and purpose
- This is a single‐process, desktop GUI application written in C++ (Visual Studio solution).

##### File structure
- Top level
- Paint.sln / Paint.vcxproj*: Visual Studio solution and project file.
- README.md: high‐level description.
- LICENSE.
- asset/: PSD files for brushes, fills and other UI assets.
- src/: core source code
- main.cpp – application entry point and main event loop
- Source.cpp / Source.h – drawing logic, canvas data structures, tool implementations
- x64/Debug & Paint/Debug: compiled binaries, logs, PDBs (build outputs)

##### README for additional insights
- No mention of external services or plug-ins

##### Elements
- UI components = blue
- Logic/controllers = green
- Data/model = orange
- External or OS services = gray

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Input
    User["User (Mouse/Keyboard)"]:::external

    %% MVC Layers
    subgraph "View Layer"
        UI_Layer["Window Manager / UI Layer"]:::ui
        RenderEngine["Rendering Engine\n(GDI+ / Win32 API)"]:::external
    end

    subgraph "Controller Layer"
        EventLoop["Event Loop & Controller"]:::logic
        ToolsMgr["Tools Manager"]:::logic
        BrushTool["Brush Tool"]:::logic
        EraserTool["Eraser Tool"]:::logic
        ColorMgr["Color Manager\n(Red, Green, Blue)"]:::logic
    end

    subgraph "Model Layer"
        CanvasModel["Canvas Model\n(In-memory Pixel Buffer)"]:::data
    end

    subgraph "Asset & Build"
        AssetMgr["Asset Manager\n(PSD Loader)"]:::external
        BuildSys["Build & Deployment\n(Visual Studio)"]:::external
        Solution["Paint.sln"]:::external
        Project["Paint.vcxproj\n/ Paint.vcxproj.filters"]:::external
    end

    %% Flow
    User -->|"input events"| UI_Layer
    UI_Layer -->|"dispatch events"| EventLoop
    EventLoop -->|"select tool"| ToolsMgr
    EventLoop -->|"select color"| ColorMgr
    ToolsMgr -->|"use brush"| BrushTool
    ToolsMgr -->|"use eraser"| EraserTool
    BrushTool -->|"draw commands"| CanvasModel
    EraserTool -->|"erase commands"| CanvasModel
    ColorMgr -->|"color choice"| CanvasModel
    CanvasModel -->|"pixel data"| RenderEngine
    RenderEngine -->|"render frame"| UI_Layer
    AssetMgr -->|"load assets"| UI_Layer
    AssetMgr -->|"provide icons"| ToolsMgr

    Solution -.-> BuildSys
    Project -.-> BuildSys
    BuildSys -->|"compile & link"| UI_Layer

    %% Click Events
    click UI_Layer "https://github.com/m-yousuf-m/painttool/blob/main/src/main.cpp"
    click EventLoop "https://github.com/m-yousuf-m/painttool/blob/main/src/main.cpp"
    click ToolsMgr "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.cpp"
    click ToolsMgr "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.h"
    click BrushTool "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.cpp"
    click BrushTool "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.h"
    click EraserTool "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.cpp"
    click EraserTool "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.h"
    click ColorMgr "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.cpp"
    click ColorMgr "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.h"
    click CanvasModel "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.cpp"
    click CanvasModel "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.h"
    click RenderEngine "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.cpp"
    click RenderEngine "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.h"
    click AssetMgr "https://github.com/m-yousuf-m/painttool/tree/main/asset/"
    click AssetMgr "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.cpp"
    click AssetMgr "https://github.com/m-yousuf-m/painttool/blob/main/src/Source.h"
    click Solution "https://github.com/m-yousuf-m/painttool/blob/main/Paint.sln"
    click Project "https://github.com/m-yousuf-m/painttool/blob/main/Paint.vcxproj"
    click Project "https://github.com/m-yousuf-m/painttool/blob/main/Paint.vcxproj.filters"

    %% Styles
    classDef ui fill:#8cc1ff,stroke:#333,stroke-width:1px
    classDef logic fill:#a0f4a0,stroke:#333,stroke-width:1px
    classDef data fill:#ffcc80,stroke:#333,stroke-width:1px
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:1px
```
