How faresbakhit/ayin works
Project's Nature and Purpose
• Ayin is a desktop photo editing application. It’s a GUI-based tool with image manipulation features (filters, multiple tabs, undo/redo) and uses external libraries like ImGui for the user interface, SDL2/OpenGL for rendering, and portable-file-dialogs and stb for file handling and image processing.
• The project is structured as a single application rather than a client-server or multi-service system.
File Structure for Architectural Clues
• Top-Level Elements: There are build/configuration files (.clang-format, Makefile, etc.), a README, and a LICENSE. This indicates standard project organization.
• lib Directory: Contains third-party libraries like ImGui, portable-file-dialogs, and stb. The ImGui subfolder also comes with examples and documentation. This tells us that ImGui is the primary UI toolkit with SDL2/OpenGL integration.
• src Directory: Contains the core application source code with files for the Application framework, Commands management (likely supporting undo/redo), Image manipulation (Image, ImageFilter), Photo abstraction, and others. This shows that the business logic and core functionality reside in “src.”
Main Components
a. UI/Presentation Layer:
• Uses ImGui (with SDL2 and OpenGL3 backends) to render the interface.
b. Application Core / Business Logic:
• Handled mostly in the src directory.
• Contains the Application class (initialization, main loop, event management).
• Implements Commands (for undo/redo functionality) and image editing tasks (Image, ImageFilter, Photo).
c. External Libraries & Utilities:
• ImGui (with its backends) provides the immediate mode GUI.
• portable-file-dialogs provides file open/save dialogs.
• stb libraries for image reading/writing.
• Utility modules under src/utils (e.g., win32.hpp) to handle platform-specific functionality.
Relationships and Interactions
• The UI Layer communicates with the Application Core: User input (via the UI) triggers commands and image processing.
• The Application Core maintains state (e.g., image data, command history) and integrates with various modules, such as the undo/redo system.
• External Libraries act as support modules:
• ImGui drives rendering and handles widget interactions.
• SDL2/OpenGL connectors enable cross-platform graphics.
• File-dialog and stb components handle file management and image I/O.
Architectural Patterns and Design Principles
• Separation of Concerns: Differentiate clearly between UI (visual representation), core business logic (command processing, image filters), and file/image utilities.
• Modular Design: Each domain (UI, core logic, utilities) is distinct. This modularity allows easy swapping or updating of components like the UI toolkit or image libraries.
• Immediate Mode GUI Pattern: ImGui’s design is consistent with immediate mode – it redraws UI elements each frame based on the current state held in the core.
Final Reminder
• Use clear labels for each component.