# lardratboy/ditherstudio architecture

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

- Interactive diagram: https://gitdiagram.com/lardratboy/ditherstudio
- Repository: https://github.com/lardratboy/ditherstudio

## Overview

##### Project type and purpose
- From the README and file tree, this is a native Windows desktop application (DitherStudio/DitherBuddy) built with C++ and MFC.
- Its core purpose is to host a Photoshop‐style plugin for RGB555/565 dithering but evolved into a general 2D/3D byte‐stream and image viewer with pan/zoom and export capabilities.

##### File structure
- Top‐level code:
- DitherStudio.* (MFC document/view app: .cpp, .h, .rc, .vcxproj, resource scripts)
- BPTLib/ (core image‐processing library: dithering, compression, surface & pixel operations, file codecs)
- BpaintStuff/ (auxiliary rendering primitives & helper routines)
- res/ (UI resources: bitmaps, cursors)
- Build/ (packaged ZIP of binaries)
- It follows an internal modular pattern: a UI layer (MFC), a core processing layer (BPTLib), and a support layer (BpaintStuff), plus external dependencies managed via vcpkg (glm, boost, angle).

##### README for additional insights
- Describes how the tool works (clipboard/file input → display → PNG/clipboard output).
- Mentions vcpkg dependencies and that it’s not strictly a dithering tool any more but a visualization host.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        UI_Project["Solution & Projects"]:::appModule
        DocumentView["Doc/View Classes"]:::appModule
        EntryGlue["App Entry & Glue"]:::appModule
        Dialogs["Dialogs & Views"]:::appModule
        Resources["Resources"]:::appModule
    end

    subgraph "Business Logic Layer"
        CoreLib["BPTLib: Dithering & Compression"]:::library
    end

    subgraph "Rendering Helper Layer"
        RenderLib["BpaintStuff: Primitives & Raster Ops"]:::library
    end

    subgraph "External Dependencies"
        glm["glm"]:::external
        boost["boost"]:::external
        angle["angle"]:::external
    end

    subgraph "OS & System Services"
        GDI["Win32 GDI/GDI+"]:::os
        Clipboard["Clipboard API"]:::os
        FileSys["File System"]:::os
    end

    subgraph "Sample Data"
        Examples["examples/"]:::appModule
    end

    subgraph "Build Output"
        BuildOut["Build ZIP"]:::appModule
    end

    UI_Project -->|uses| CoreLib
    UI_Project -->|renders via| RenderLib
    CoreLib -->|helpers| RenderLib
    UI_Project -->|draws with| GDI
    UI_Project -->|accesses| Clipboard
    UI_Project -->|accesses| FileSys

    UI_Project -->|links to| glm
    UI_Project -->|links to| boost
    UI_Project -->|links to| angle
    CoreLib -->|links to| glm
    CoreLib -->|links to| boost
    CoreLib -->|links to| angle
    RenderLib -->|links to| glm
    RenderLib -->|links to| boost

    UI_Project --> Examples
    UI_Project --> BuildOut

    click UI_Project "https://github.com/lardratboy/ditherstudio/blob/master/DitherStudio.sln"
    click DocumentView "https://github.com/lardratboy/ditherstudio/blob/master/DitherStudioDoc.cpp"
    click EntryGlue "https://github.com/lardratboy/ditherstudio/blob/master/DitherStudio.cpp"
    click Dialogs "https://github.com/lardratboy/ditherstudio/blob/master/CHistogramVizDlg.cpp"
    click Resources "https://github.com/lardratboy/ditherstudio/blob/master/DitherStudio.rc"
    click CoreLib "https://github.com/lardratboy/ditherstudio/blob/master/BPTLib/include/BPTLib.h"
    click RenderLib "https://github.com/lardratboy/ditherstudio/tree/master/BpaintStuff/"
    click Examples "https://github.com/lardratboy/ditherstudio/tree/master/examples/"
    click BuildOut "https://github.com/lardratboy/ditherstudio/blob/master/Build/DitherStudio_20220124x64.zip"

    classDef appModule fill:#ADD8E6,stroke:#000;
    classDef library fill:#90EE90,stroke:#000;
    classDef external fill:#FFA500,stroke:#000;
    classDef os fill:#f0e68c,stroke:#000,stroke-dasharray: 5 5;
```
