Architecture & Responsibility Division

KreoPix is engineered using a Strict Layered Architecture based on the Model-View-Controller (MVC) design pattern. This modular approach ensures that image processing logic, user interface state, and system orchestration remain decoupled, allowing for high extensibility and easier debugging.

High-Level System Hierarchy

The application is orchestrated by a central bootstrapper, the AppRoot class, which assembles the functional layers during the startup sequence.

Architectural Blueprint

graph TD
    subgraph Core_Layer [Core Layer: Domain & State]
        AS[AppState]
        IM[Image & Layer Models]
    end

    subgraph Services_Layer [Services Layer: Business Logic]
        FS[File & Image Service]
        BE[Brush Engine]
        FB[Filter & Blend Service]
    end

    subgraph Controller_Layer [Controller Layer: Orchestration]
        AC[AppController]
    end

    subgraph UI_Layer [UI Layer: Presentation]
        ML[MainLayout / Canvas]
        TB[Tools & Sidebars]
    end

    %% Relationships
    AppRoot[AppRoot Bootstrapper] --> AS
    AppRoot --> FS
    AppRoot --> AC
    AC --> ML
    AC -.-> FS
    ML --> TB

Layer Definitions & Responsibilities

To maintain a scalable codebase, responsibilities are divided into four distinct tiers:

Core Layer

This is the lowest level of the application, representing the data and the "source of truth".

AppState: Manages the global configuration and the current status of the application.

Image Data Model: Defines how layers and pixel data are structured before processing.

Services Layer This layer contains the "heavy lifters" classes dedicated to specific technical tasks without being aware of the UI.

FileService: Handles I/O operations, such as opening and saving project files.

Brush & Rendering Engine: Manages the mathematical logic for stroke interpolation and pixel placement.

Filter Service: Utilizes OpenCV and NumPy to perform algorithmic image manipulations.

Controller Layer The AppController acts as the brain of the operation, coordinating communication between the UI and the Services.

Dependency Injection: The AppRoot injects instances of AppState and FileService into the controller to ensure low coupling.

UI Synchronization: It listens for events from the MainLayout and triggers the corresponding business logic in the Services.

UI Layer Built using tkinter, this layer is strictly for user interaction and visual feedback.

Canvas Panel: Manages the coordinate system for drawing.

Components: Includes the Tools Panel, Layer Manager, and Color Brushes.

Features

APIs

Libraries and Tools