# kazefx2/image_en_decrypto architecture

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

- Interactive diagram: https://gitdiagram.com/kazefx2/image_en_decrypto
- Repository: https://github.com/kazefx2/image_en_decrypto

## Overview

##### Project type and purpose
- This is a cross-platform desktop application (“image_en_decrypto”) combining a Qt/QML-based user interface with a C++/CUDA-powered core library that performs image (and audio/video) encryption and decryption.
- The Core directory implements the cryptographic algorithms (ImageEncrypto, ImageDecrypto, AudioEncrypto, AudioDecrypto, Cuda acceleration, random utilities) and a set of concurrency and data-structure submodules (ThreadPool, Mutex, Semaphore, RWLock, ConditionVariable, Bitmap, plus various C data structures).
- The UI directory holds the Qt/QML front end, C++ glue code, resource files, translation assets, and references third-party UI components.

##### File structure
- Top-level CMakeLists.txt orchestrates a multi-target build: Core, UI, tests, scripts.
- Core/SubModules contains reusable building-block libraries, each with public/private headers, source, size metrics, tests, and its own CMakeLists.
- Core/include and Core/src implement the domain logic of cryptography and CUDA calls.
- UI embeds a QML frontend under UI/qml, with C++ providers under UI/src/component that expose Core functionality to QML.
- scripts, cmake, and inputs contain build/deployment helpers (DMG builder, dependency solver, run scripts).
- README.md confirms the C/C++/Cuda sub-modules and highlights the ImageEncrypto and ImageDecrypto entry points.

##### README for additional insights
- The README lists each concurrency primitive and data-structure submodule, plus encrypt/decrypt functions.
- Screenshots indicate the UI on multiple OSes, implying cross-platform packaging considerations.

##### Diagramming recommendations
- Use clear labels for each component (e.g., “ImageEncrypto API”, “ThreadPool Service”, “QML MainWindow”).
- Blue rectangles for UI/QML
- Green for Presentation providers
- Dark green for Core Crypto library
- Orange for SubModules (threading, data structures)
- Purple for GPU/CUDA
- Gray for build/deploy scripts

##### Detail without overthinking
- Do not omit the synchronization primitives—they’re central to performance.
- If needed, add annotations for platform-specific build outputs (Windows installer script, macOS version header generated by CMake).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        QML["Qt/QML UI Layer"]:::ui
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Providers["Qt/C++ Presentation Providers"]:::presentation
        AppInfo["AppInfo"]:::presentation
        Globals["GlobalVariables"]:::presentation
        MainCpp["main.cpp"]:::presentation
        SettingsHelper["SettingsHelper"]:::presentation
        TranslateHelper["TranslateHelper"]:::presentation
        KeyKeeper["KeyKeeper"]:::presentation
    end

    %% Core Crypto Library
    subgraph "Core Crypto Library"
        direction TB
        ImageAPI["ImageCrypto API"]:::core
        ImgEnc["ImageEncrypto"]:::core
        ImgDec["ImageDecrypto"]:::core
        AudEnc["AudioEncrypto"]:::core
        AudDec["AudioDecrypto"]:::core
        Random["Random Utilities"]:::core
        Util["Util"]:::core
    end

    %% GPU Acceleration
    subgraph "CUDA Module"
        direction TB
        CudaH["Cuda.cuh"]:::gpu
        CudaCU["Cuda.cu"]:::gpu
    end

    %% SubModules Library Suite
    subgraph "SubModules Suite"
        direction TB
        ThreadPool["ThreadPool"]:::submodules
        Mutex["Mutex"]:::submodules
        Semaphore["Semaphore"]:::submodules
        RWLock["RWLock"]:::submodules
        Condition["ConditionVariable"]:::submodules
        Bitmap["Bitmap"]:::submodules
        AutoMem["AutoMemoryPool"]:::submodules
        Logger["Logger"]:::submodules
        CList["C_component/list"]:::submodules
        RBTree["C_component/rbtree"]:::submodules
        SetMem["C_component/setmem"]:::submodules
        CParser["C_component/c_parser"]:::submodules
    end

    %% Tooling
    subgraph "Build & Deployment Tooling"
        direction TB
        RootCMake["CMakeLists.txt (root)"]:::tooling
        CoreCMake["Core/CMakeLists.txt"]:::tooling
        UICMake["UI/CMakeLists.txt"]:::tooling
        CMakeDir["cmake/"]:::tooling
        UICMakeDir["UI/.cmake/"]:::tooling
        Scripts["scripts/"]:::tooling
    end

    %% Relationships
    QML -->|uses| Providers
    Providers -->|calls| ImageAPI
    ImageAPI -->|implements| ImgEnc
    ImageAPI -->|implements| ImgDec
    ImageAPI -->|implements| AudEnc
    ImageAPI -->|implements| AudDec
    ImgEnc -->|uses| CudaH
    ImgEnc -->|executes| CudaCU
    ImgEnc -->|dispatches| ThreadPool
    ImgDec -->|dispatches| ThreadPool
    AudEnc -->|dispatches| ThreadPool
    AudDec -->|dispatches| ThreadPool
    ThreadPool -->|sync with| Mutex
    ThreadPool -->|sync with| Semaphore
    ThreadPool -->|sync with| RWLock
    ThreadPool -->|sync with| Condition
    ImgEnc -->|allocates| Bitmap
    ImgEnc -->|logs| Logger
    ImgDec -->|logs| Logger
    Random -->|utility for| ImgEnc
    Util -->|utility for| ImgEnc
    Util -->|utility for| ImgDec
    Providers -->|loads| SettingsHelper
    Providers -->|loads| TranslateHelper

    %% Click Events
    click QML "https://github.com/kazefx2/image_en_decrypto/tree/master/UI/qml/"
    click Providers "https://github.com/kazefx2/image_en_decrypto/tree/master/UI/src/component/"
    click AppInfo "https://github.com/kazefx2/image_en_decrypto/blob/master/UI/include/AppInfo.h"
    click AppInfo "https://github.com/kazefx2/image_en_decrypto/blob/master/UI/src/AppInfo.cpp"
    click Globals "https://github.com/kazefx2/image_en_decrypto/blob/master/UI/include/GlobalVariables.h"
    click Globals "https://github.com/kazefx2/image_en_decrypto/blob/master/UI/src/GlobalVariables.cpp"
    click MainCpp "https://github.com/kazefx2/image_en_decrypto/blob/master/UI/src/main.cpp"
    click SettingsHelper "https://github.com/kazefx2/image_en_decrypto/blob/master/UI/include/helper/SettingsHelper.h"
    click SettingsHelper "https://github.com/kazefx2/image_en_decrypto/blob/master/UI/src/helper/SettingsHelper.cpp"
    click TranslateHelper "https://github.com/kazefx2/image_en_decrypto/blob/master/UI/include/helper/TranslateHelper.h"
    click TranslateHelper "https://github.com/kazefx2/image_en_decrypto/blob/master/UI/src/helper/TranslateHelper.cpp"
    click ImgEnc "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/include/private/ImageEncrypto.h"
    click ImgEnc "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/src/ImageEncrypto.cpp"
    click ImgDec "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/include/private/ImageDecrypto.h"
    click ImgDec "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/src/ImageDecrypto.cpp"
    click AudEnc "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/include/private/AudioEncrypto.h"
    click AudEnc "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/src/AudioEncrypto.cpp"
    click AudDec "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/include/private/AudioDecrypto.h"
    click AudDec "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/src/AudioDecrypto.cpp"
    click Random "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/include/private/Random.h"
    click Random "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/src/Random.cpp"
    click Util "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/include/private/Util.h"
    click Util "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/src/Util.cpp"
    click CudaH "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/include/private/Cuda.cuh"
    click CudaCU "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/src/Cuda.cu"
    click ThreadPool "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/ThreadPool/"
    click Mutex "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/Mutex/"
    click Semaphore "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/Semaphore/"
    click RWLock "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/RWLock/"
    click Condition "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/ConditionVariable/"
    click Bitmap "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/Bitmap/"
    click AutoMem "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/AutoMemoryPool/"
    click Logger "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/Logger/"
    click CList "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/C_component/list/"
    click RBTree "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/C_component/rbtree/"
    click SetMem "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/C_component/setmem/"
    click CParser "https://github.com/kazefx2/image_en_decrypto/tree/master/Core/SubModules/C_component/c_parser/"
    click RootCMake "https://github.com/kazefx2/image_en_decrypto/blob/master/CMakeLists.txt"
    click CoreCMake "https://github.com/kazefx2/image_en_decrypto/blob/master/Core/CMakeLists.txt"
    click UICMake "https://github.com/kazefx2/image_en_decrypto/blob/master/UI/CMakeLists.txt"
    click CMakeDir "https://github.com/kazefx2/image_en_decrypto/tree/master/cmake/"
    click UICMakeDir "https://github.com/kazefx2/image_en_decrypto/tree/master/UI/.cmake/"
    click Scripts "https://github.com/kazefx2/image_en_decrypto/tree/master/scripts/"

    %% Styles
    classDef ui fill:#D0E6F7,stroke:#4A90E2
    classDef presentation fill:#DFF2D8,stroke:#3A873E
    classDef core fill:#A3D39C,stroke:#2E7D32
    classDef submodules fill:#FAD7A0,stroke:#D35400
    classDef gpu fill:#E0BBE4,stroke:#9B59B6
    classDef tooling fill:#E5E5E5,stroke:#7F8C8D
```
