# ximiyad123/fbprinter architecture

> Architecture diagram of the GitHub repository ximiyad123/fbprinter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ximiyad123/fbprinter
- Repository: https://github.com/ximiyad123/fbprinter

## Overview

fbprinter is a C utility for rendering text and image files onto a configured physical framebuffer. The principal workflow is CLI arguments or an INI file → framebuffer setup and optional clearing → format dispatch → text/image drawing → framebuffer pixels. The graph preserves distinct format renderers and the pixel/font layers. The README is empty; relationships below are supported by the CLI excerpt and SOURCE INDEX references, which do not expose every call detail.

Main entry points: [`src/renderer.c`](https://github.com/ximiyad123/fbprinter/blob/main/src/renderer.c) (Format Router), [`include/framebuffer.h`](https://github.com/ximiyad123/fbprinter/blob/main/include/framebuffer.h) (Mapped Framebuffer), [`cli/main.c`](https://github.com/ximiyad123/fbprinter/blob/main/cli/main.c) (Command Line), [`src/libfbprinter.c`](https://github.com/ximiyad123/fbprinter/blob/main/src/libfbprinter.c) (Printer Control)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Configuration and API"]
  node_cli["Command Line<br/>[main.c]"]
  node_ini["INI Loader<br/>[ini_parser.c]"]
  node_api["Public API<br/>[fbprinter.h]"]
  node_printer["Printer Control<br/>[libfbprinter.c]"]
end

subgraph group_dispatch["Format Rendering"]
  node_router["Format Router<br/>[renderer.c]"]
  node_text["Text Renderer<br/>[text.c]"]
  node_png["PNG Renderer<br/>[png.c]"]
  node_jpeg["JPEG Renderer<br/>[jpg.c]"]
  node_gif["GIF Renderer<br/>[gif.c]"]
end

subgraph group_drawing["Drawing and Pixels"]
  node_image["RGBA Drawing<br/>[image.c]"]
  node_font["Bitmap Font<br/>[font.h]"]
end

subgraph group_device["Framebuffer Device"]
  node_pixels["Pixel Operations<br/>[framebuffer.c]"]
  node_framebuffer[("Mapped Framebuffer<br/>[framebuffer.h]")]
end

node_user(("CLI User"))

node_user -->|"runs"| node_cli
node_cli -->|"loads config"| node_ini
node_cli -->|"opens and renders"| node_api
node_api -->|"implements API"| node_printer
node_printer -->|"opens and clears"| node_framebuffer
node_printer -->|"dispatches render"| node_router
node_router -->|"routes text"| node_text
node_router -->|"routes PNG"| node_png
node_router -->|"routes JPEG"| node_jpeg
node_router -->|"routes GIF"| node_gif
node_text -->|"draws pixels"| node_framebuffer
node_text -->|"uses glyphs"| node_font
node_png -->|"draws image"| node_image
node_jpeg -->|"draws image"| node_image
node_image -->|"draws pixels"| node_framebuffer
node_gif -->|"draws pixels"| node_framebuffer
node_framebuffer -->|"uses operations"| node_pixels

click node_cli "https://github.com/ximiyad123/fbprinter/blob/main/cli/main.c"
click node_ini "https://github.com/ximiyad123/fbprinter/blob/main/src/ini_parser.c"
click node_api "https://github.com/ximiyad123/fbprinter/blob/main/include/fbprinter.h"
click node_printer "https://github.com/ximiyad123/fbprinter/blob/main/src/libfbprinter.c"
click node_router "https://github.com/ximiyad123/fbprinter/blob/main/src/renderer.c"
click node_text "https://github.com/ximiyad123/fbprinter/blob/main/src/text.c"
click node_png "https://github.com/ximiyad123/fbprinter/blob/main/src/png.c"
click node_jpeg "https://github.com/ximiyad123/fbprinter/blob/main/src/jpg.c"
click node_gif "https://github.com/ximiyad123/fbprinter/blob/main/src/gif.c"
click node_image "https://github.com/ximiyad123/fbprinter/blob/main/src/image.c"
click node_font "https://github.com/ximiyad123/fbprinter/blob/main/include/font.h"
click node_pixels "https://github.com/ximiyad123/fbprinter/blob/main/src/framebuffer.c"
click node_framebuffer "https://github.com/ximiyad123/fbprinter/blob/main/include/framebuffer.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_ini,node_api,node_printer,node_user toneBlue
class node_router,node_text,node_png,node_jpeg,node_gif toneAmber
class node_image,node_font toneMint
class node_pixels,node_framebuffer toneRose
```

## Components

### Configuration and API

- [Command Line](https://github.com/ximiyad123/fbprinter/blob/main/cli/main.c): `cli/main.c`
- [INI Loader](https://github.com/ximiyad123/fbprinter/blob/main/src/ini_parser.c): `src/ini_parser.c`
- [Public API](https://github.com/ximiyad123/fbprinter/blob/main/include/fbprinter.h): `include/fbprinter.h`
- [Printer Control](https://github.com/ximiyad123/fbprinter/blob/main/src/libfbprinter.c): `src/libfbprinter.c`

### Format Rendering

- [Format Router](https://github.com/ximiyad123/fbprinter/blob/main/src/renderer.c): `src/renderer.c`
- [Text Renderer](https://github.com/ximiyad123/fbprinter/blob/main/src/text.c): `src/text.c`
- [PNG Renderer](https://github.com/ximiyad123/fbprinter/blob/main/src/png.c): `src/png.c`
- [JPEG Renderer](https://github.com/ximiyad123/fbprinter/blob/main/src/jpg.c): `src/jpg.c`
- [GIF Renderer](https://github.com/ximiyad123/fbprinter/blob/main/src/gif.c): `src/gif.c`

### Drawing and Pixels

- [RGBA Drawing](https://github.com/ximiyad123/fbprinter/blob/main/src/image.c): `src/image.c`
- [Bitmap Font](https://github.com/ximiyad123/fbprinter/blob/main/include/font.h): `include/font.h`

### Framebuffer Device

- [Pixel Operations](https://github.com/ximiyad123/fbprinter/blob/main/src/framebuffer.c): `src/framebuffer.c`
- [Mapped Framebuffer](https://github.com/ximiyad123/fbprinter/blob/main/include/framebuffer.h): `include/framebuffer.h`

### Other components

- **CLI User**

## Connections

- CLI User → Command Line: runs (evidence: `cli/main.c`)
- Command Line → INI Loader: loads config (evidence: `cli/main.c`)
- Command Line → Public API: opens and renders (evidence: `cli/main.c`)
- Public API → Printer Control: implements API (evidence: `src/libfbprinter.c`)
- Printer Control → Mapped Framebuffer: opens and clears (evidence: `src/libfbprinter.c`)
- Printer Control → Format Router: dispatches render (evidence: `src/libfbprinter.c`)
- Format Router → Text Renderer: routes text (evidence: `src/renderer.c`)
- Format Router → PNG Renderer: routes PNG (evidence: `src/renderer.c`)
- Format Router → JPEG Renderer: routes JPEG (evidence: `src/renderer.c`)
- Format Router → GIF Renderer: routes GIF (evidence: `src/renderer.c`)
- Text Renderer → Mapped Framebuffer: draws pixels (evidence: `src/text.c`)
- Text Renderer → Bitmap Font: uses glyphs (evidence: `src/text.c`)
- PNG Renderer → RGBA Drawing: draws image (evidence: `src/png.c`)
- JPEG Renderer → RGBA Drawing: draws image (evidence: `src/jpg.c`)
- RGBA Drawing → Mapped Framebuffer: draws pixels (evidence: `src/image.c`)
- GIF Renderer → Mapped Framebuffer: draws pixels (evidence: `src/gif.c`)
- Mapped Framebuffer → Pixel Operations: uses operations (evidence: `src/framebuffer.c`)
