PHPackages                             microscrap/phpdafruit-gfx - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. microscrap/phpdafruit-gfx

ActiveLibrary[Framework](/categories/framework)

microscrap/phpdafruit-gfx
=========================

AdafruitGFX-like Rendering Package for the ScrapyardIO Framework

0.5.0(2w ago)03MITPHPPHP ^8.3

Since Jun 13Pushed 2w agoCompare

[ Source](https://github.com/microscrap/phpdafruit-gfx)[ Packagist](https://packagist.org/packages/microscrap/phpdafruit-gfx)[ Docs](https://scrapyard-io.projectsaturnstudios.com)[ RSS](/packages/microscrap-phpdafruit-gfx/feed)WikiDiscussions 0.5.x Synced 1w ago

READMEChangelogDependencies (7)Versions (6)Used By (0)

microscrap/phpdafruit-gfx - Adafruit-GFX-style rendering for ScrapyardIO
========================================================================

[](#microscrapphpdafruit-gfx---adafruit-gfx-style-rendering-for-scrapyardio)

[![Coverage](https://camo.githubusercontent.com/bc4a14f35ff5918465149325c43464ebe157349920488d41b47c0e81430161ac/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d36342e312532352d6f72616e6765)](#testing-pest-v4)[![Tests](https://camo.githubusercontent.com/291d6489c0daab7b915dd47444b71573e7c68059e37f77801fbd616b46bc9265/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f74657374732d373525323070617373696e672d627269676874677265656e)](#testing-pest-v4)[![PHP](https://camo.githubusercontent.com/bca69d3fed456e791b18070bab206cd22899c4761a0c73dec10850f06550082f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e332d373737626234)](composer.json)[![License](https://camo.githubusercontent.com/b8cadaa967891081f8f165695470689986c028821dd8a040132f6e661795dc0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c7565)](LICENSE.md)

A pure-PHP 2D graphics renderer modeled on [Adafruit-GFX](https://github.com/adafruit/Adafruit-GFX-Library), designed to work with the [ScrapyardIO framework](https://scrapyard-io.projectsaturnstudios.com). It draws into a `scrapyard-io/nuts-and-bolts` `FormatSpecFrameBuffer` and renders through the `scrapyard-io/reality-interface` display layer, so the same drawing API targets monochrome page panels (SSD1306/SH1106) and color TFTs (ST77xx) alike — the buffer's `FormatSpec` decides how pixels are packed on dump.

This package includes:

- A fluent `GFXRenderer` with the full GFX primitive set (pixels, lines, rects, round-rects, circles, ellipses, triangles, text, bitmaps, images, dithering)
- Rotation-aware drawing (0/90/180/270°)
- Partial-refresh buffers: `PageSegmentBuffer` (paged mono) and `DirtyRegionsBuffer` (rectangle-coalescing color TFT)
- A bundled `ClassicFont` plus a library of Adafruit/LVGL-style `PhpdafruitFont` glyph tables

Requirements
------------

[](#requirements)

- PHP 8.3+
- `scrapyard-io/nuts-and-bolts` ^0.4.1
- `scrapyard-io/reality-interface` ^0.4.1
- `ext-gd` *(suggested)* — only for `drawImageFromFile()` / `drawImageDithered()`. Raw pixel paths (`drawBitmap()`, `drawColorMap()`, `ditherFloydSteinberg()`) work without it.

Installation
------------

[](#installation)

```
composer require microscrap/phpdafruit-gfx
```

Usage
-----

[](#usage)

Construct a renderer over any `FormatSpecFrameBuffer`. The `FormatSpec` you give the buffer determines how `render()` packs the bytes for your panel.

```
