# is-ammar/fract-ol architecture

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

- Interactive diagram: https://gitdiagram.com/is-ammar/fract-ol
- Repository: https://github.com/is-ammar/fract-ol

## Overview

##### Project type and purpose
- Fract-ol is a native, desktop graphical application written in C.
- It renders fractals (Mandelbrot, Julia, Tricorn) in real time using the MiniLibX library.
- It combines an interactive event loop (mouse/keyboard), a fractal-computation engine, and a rendering layer.

##### File structure
- Top-level C modules:
– main.c: program entry, argument parsing, initialization
– fractol.h: shared data structures and constants
– hook.c: event registration and callback dispatch
– utils.c / exit.c: helper functions, cleanup
- bonus/ directory:
– Variants of fractal modules (julia_bonus.c, mandelbrot_bonus.c, tricorn_bonus.c, exit_bonus.c, hook_bonus.c, render_bonus.c, utils_bonus.c)
– Mirrors core modules to add extra fractal types
- Build files:
– Makefile: compile rules
– .gitignore: excludes object files, binaries
- Screenshots/ folder: static assets for README

##### README for additional insights
- Dependencies: MiniLibX, standard C compiler
- “How It Works” section details mapping pixels to complex plane, zoom logic, iteration loop

##### Detail without over-splitting
- Logical module (argument parsing, state management, event hooks, fractal math, rendering, exit handling)
- Grouping of bonus folder as a peer to the core pipeline

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Application Core"
        AP["Argument Parser"]:::core
        PS["Program State"]:::core
    end
    AP -->|"initialize with args"| PS
    PS -->|"setup graphics"| EL["Event Loop"]:::core

    subgraph "Event Handling Layer"
        EH["Mouse & Keyboard Hooks"]:::input
    end
    EL --> EH
    EH -->|"update state"| PS
    EH -->|"trigger recompute"| FE["Fractal Engine"]:::compute

    subgraph "Fractal Engine"
        MB["Mandelbrot Computation"]:::compute
        JU["Julia Computation"]:::compute
        TC["Tricorn Computation"]:::compute
    end
    FE --> MB
    FE --> JU
    FE --> TC

    subgraph "Rendering Layer"
        RL["Pixel Mapping & Draw Loop"]:::render
        ML["MiniLibX"]:::external
    end
    MB -->|"pixel colors"| RL
    JU -->|"pixel colors"| RL
    TC -->|"pixel colors"| RL
    RL -->|"draw_pixel() calls"| ML
    RL -->|"display window"| ML

    subgraph "Utility Modules"
        UF["Helper Functions"]:::util
        EX["Exit Routines"]:::util
    end
    EX -->|"cleanup"| OS["OS"]:::external

    subgraph "Bonus Extension Modules"
        BE["Bonus Fractal Variants"]:::extension
    end

    %% Build and assets
    Make["Makefile"]:::build
    Screens["screenshots"]:::asset

    %% Click Events
    click AP "https://github.com/is-ammar/fract-ol/blob/main/main.c"
    click PS "https://github.com/is-ammar/fract-ol/blob/main/fractol.h"
    click EH "https://github.com/is-ammar/fract-ol/blob/main/hook.c"
    click MB "https://github.com/is-ammar/fract-ol/blob/main/mandelbrot.c"
    click JU "https://github.com/is-ammar/fract-ol/blob/main/julia.c"
    click RL "https://github.com/is-ammar/fract-ol/blob/main/render.c"
    click UF "https://github.com/is-ammar/fract-ol/blob/main/utils.c"
    click EX "https://github.com/is-ammar/fract-ol/blob/main/exit.c"
    click Make "https://github.com/is-ammar/fract-ol/tree/main/Makefile"
    click BE "https://github.com/is-ammar/fract-ol/tree/main/bonus/"
    click Screens "https://github.com/is-ammar/fract-ol/tree/main/screenshots/"

    %% Styles
    classDef core fill:#f9f,stroke:#333,stroke-width:2px
    classDef input fill:#bbf,stroke:#333,stroke-width:2px
    classDef compute fill:#fbf,stroke:#333,stroke-width:2px
    classDef render fill:#bfb,stroke:#333,stroke-width:2px
    classDef util fill:#ffb,stroke:#333,stroke-width:2px
    classDef external fill:#ddd,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5
    classDef extension fill:#ffd,stroke:#333,stroke-width:2px
    classDef build fill:#def,stroke:#333,stroke-width:2px
    classDef asset fill:#eef,stroke:#333,stroke-width:2px
```
