# mbasaglia/glaxnimate architecture

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

- Interactive diagram: https://gitdiagram.com/mbasaglia/glaxnimate
- Repository: https://github.com/mbasaglia/glaxnimate

## Overview

##### Project Type and Purpose
- Glaxnimate is a desktop (and mobile) vector-graphics animation application written in C++ with Qt5, offering import/export via various formats, a plugin architecture, and Python scripting bindings. It also builds for Android and exposes a Python module.

##### File Structure
- Top-level: CMakeLists.txt (build), data/ (assets & built-in plugins), external/ (third-party libs), src/ (core engine, GUI, Python bindings, Android port), test/ (unit tests), deploy/ (release scripts), docs/ (documentation), .github/.gitlab-ci (CI pipelines).
- src/core: the engine (model, math, I/O formats, plugin API).
- src/gui: Qt-based UI (views, controllers, widgets, tools).
- src/python: Python extension module wrapping core.
- src/android: Android-specific UI and JNI glue atop core.
- data/plugins: built-in Python plugins (AnimatedRaster, HueShift, etc.).
- deploy & CI folders: packaging and multi-platform build automation.

##### README Insights
- Confirms C++17 + Qt5 GUI, Python3 integration, reliance on external libraries (Potrace, libav, libarchive, zlib), multi-platform builds (Linux, macOS, Windows, Android).

##### Diagramming the Architecture
a. Main Components
- Core Engine Layer
- Model (src/core/model)
- Math & Geometry (src/core/math)
- I/O Subsystem (src/core/io)
- Plugin API (src/core/plugin)
- UI Layer
- Desktop GUI (src/gui: graphics, tools, widgets, item models)
- Android Frontend (src/android, JNI glue)
- Scripting Layer
- Python Extension (src/python) exposing core/plugin interfaces
- Python-based plugins (data/plugins/*.py)
- Data & Assets
- Built-in assets, emoji, templates, palettes (data/)
- External Dependencies
- Qt5, Potrace, libav*, libarchive, zlib
- Third-party modules (external/)
- Build & CI
- CMake, deploy scripts, GitHub/GitLab pipelines

b. Relationships & Data Flows
- Desktop GUI ←→ Core Engine
- GUI invokes core operations (model updates, rendering, file I/O).
- Core sends updates/events to GUI’s view components.
- Android Frontend ←→ Core Engine
- JNI layer calls into core for rendering and I/O.
- Scripting & Plugins ←→ Core Engine
- Python module & plugin manager load/execute scripts using core/plugin API.
- Core Engine ←→ I/O Subsystem ←→ External Libraries
- Format readers/writers depend on libav, libarchive, potrace, zlib.
- Build System → All Components
- CMake orchestrates compilation and linking for each target.
- CI Pipelines → Build & Test → Deploy
- Automated workflows for packaging (flatpak, snap, AppImage, pip).

c. Architectural Patterns & Principles
- Layered Architecture: clear separation of engine, UI, scripting, deployment.
- Model–View–Controller (model in core, views/widgets in GUI, controllers in tools & commands).
- Plugin‐Service Pattern: core/plugin defines interfaces for extensibility.
- Single vs. Multi‐Platform Abstraction: core is platform-agnostic, frontends handle OS specifics.

d. Key Technologies & Frameworks
- Language: C++17, Python3.
- GUI: Qt5 (Widgets, QML not used here).
- Build: CMake ≥3.5.
- External: Potrace (vectorization), FFmpeg/libav (video), libarchive (bundles), zlib.
- Packaging: flatpak, snapcraft, AppImage, pip, platform-specific scripts.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Build & CI Layer
    subgraph "Build & CI Processes"
        direction TB
        buildSys["Build System\n(CMakeLists.txt)"]:::build
        ciGH["GitHub Actions\n(.github/workflows)"]:::build
        ciGL["GitLab CI\n(.gitlab/ci)"]:::build
        deploy["Deploy & Packaging\n(deploy/)"]:::build
    end

    %% External & Data Layer
    subgraph "External Libraries & Data Assets"
        direction TB
        externalDeps["External Dependencies\n(external/)"]:::external
        dataAssets["Data & Assets\n(data/)"]:::external
    end

    %% Scripting Layer
    subgraph "Scripting & Plugins"
        direction TB
        pythonMod["Python Extension Module\n(src/python)"]:::scripting
        pythonPlugins["Built-in Python Plugins\n(data/plugins)"]:::scripting
    end

    %% Core Engine Layer
    subgraph "Core Engine"
        direction TB
        model["Model Layer\n(src/core/model)"]:::core
        math["Math & Geometry\n(src/core/math)"]:::core
        io["I/O Subsystem\n(src/core/io)"]:::core
        pluginAPI["Plugin API\n(src/core/plugin)"]:::core
    end

    %% UI Layer
    subgraph "Frontends"
        direction TB
        desktopGUI["Desktop GUI Frontend\n(src/gui)"]:::ui
        androidUI["Android Frontend (JNI & UI)\n(src/android)"]:::ui
    end

    %% Connections
    buildSys --> ciGH
    buildSys --> ciGL
    buildSys --> deploy
    buildSys --> pythonMod
    buildSys --> model
    buildSys --> desktopGUI
    buildSys --> androidUI

    externalDeps --> io
    dataAssets --> pythonPlugins

    pythonMod --> pluginAPI
    pythonPlugins --> pluginAPI

    desktopGUI -->|commands| pluginAPI
    desktopGUI -->|uses| model
    desktopGUI -->|renders| math

    androidUI -->|JNI calls| pluginAPI
    androidUI -->|uses| model
    androidUI -->|renders| math

    io -->|reads/writes| externalDeps

    model --> math
    math --> io

    pluginAPI --> model
    pluginAPI --> io

    %% Click Events
    click model "https://github.com/mbasaglia/glaxnimate/tree/master/src/core/model"
    click math "https://github.com/mbasaglia/glaxnimate/tree/master/src/core/math"
    click io "https://github.com/mbasaglia/glaxnimate/tree/master/src/core/io"
    click pluginAPI "https://github.com/mbasaglia/glaxnimate/tree/master/src/core/plugin"
    click desktopGUI "https://github.com/mbasaglia/glaxnimate/tree/master/src/gui"
    click androidUI "https://github.com/mbasaglia/glaxnimate/tree/master/src/android"
    click pythonMod "https://github.com/mbasaglia/glaxnimate/tree/master/src/python"
    click pythonPlugins "https://github.com/mbasaglia/glaxnimate/tree/master/data/plugins"
    click dataAssets "https://github.com/mbasaglia/glaxnimate/tree/master/data/"
    click externalDeps "https://github.com/mbasaglia/glaxnimate/tree/master/external/"
    click buildSys "https://github.com/mbasaglia/glaxnimate/blob/master/CMakeLists.txt"
    click ciGH "https://github.com/mbasaglia/glaxnimate/tree/master/.github/workflows"
    click ciGL "https://github.com/mbasaglia/glaxnimate/tree/master/.gitlab/ci"
    click deploy "https://github.com/mbasaglia/glaxnimate/tree/master/deploy/"

    %% Styles
    classDef core fill:#D6EAF8,stroke:#1F618D,color:#1B4F72
    classDef ui fill:#D5F5E3,stroke:#27AE60,color:#1E8449
    classDef scripting fill:#FDEBD0,stroke:#D68910,color:#B9770E
    classDef external fill:#E5E8E8,stroke:#566573,color:#2C3E50
    classDef build fill:#F4ECF7,stroke:#8E44AD,color:#6C3483
```
