pushinbr / pam-native-canvas
Retained-mode native 2D canvas for PAM Native.
Package info
github.com/push-in/pam-native-canvas
Type:pam-native-plugin
pkg:composer/pushinbr/pam-native-canvas
Requires
- php: ^8.5
- pushinbr/pam-native: ^0.8.0
Requires (Dev)
- phpstan/phpstan: ^2.1
- pushinbr/pam-native-plugin-kit: ^0.2.0
This package is auto-updated.
Last update: 2026-08-25 20:04:05 UTC
README
PAM Native Canvas
Retained-mode 2D graphics built for native frame budgets.
Compose drawing surfaces, paths, paints, and interactions without shipping a WebView or replaying an entire PHP scene every frame.
Documentation · Quick start · What you can build · PAM ecosystem · Issues
Why PAM Native Canvas
Compose drawing surfaces, paths, paints, and interactions without shipping a WebView or replaying an entire PHP scene every frame. The public API is strictly typed for PHP 8.5; expensive or frame-sensitive work stays in Rust or the platform SDK instead of crossing the application boundary every frame.
| Best for | A focused capability you can add to any PAM Native application |
| Native path | Android Canvas · Core Graphics |
| Application model | Composer package + generated native integration |
| Design rule | Independent module; no feed, vertical, or application template bundled |
What you can build
- Charts, signatures, and annotation tools
- Custom controls and data visualization
- Lightweight games and interactive diagrams
Quick start
Already have a PAM Native project? Add only this capability:
pam composer require pushinbr/pam-native-canvas pam doctor --fix
New to PAM? Follow the five-minute PAM Native setup once, then return here. Your application stays a normal Composer project with a committed lockfile.
See it in action
This is a horizontal retained-mode 2D drawing primitive, not a UI framework, feed, application template, GPU shader engine, or 3D engine. PHP builds a bounded display list; Android Canvas and Core Graphics render it without calling PHP for each frame.
use Pam\Native\Canvas\Canvas; use Pam\Native\Canvas\CanvasView; $scene = (new Canvas()) ->clear('#10131aff') ->fillRect(24, 24, 240, 120, '#7557ffff') ->circle(144, 84, 32, '#ffffffff') ->text('PAM', 96, 164, 28, '#ffffffff') ->scene(); return CanvasView::make($scene);
Scenes are immutable, capped at 10,000 commands, and use integer-backed command/event kinds. Platform support: Android API 26+, iOS 15+, PHP 8.5+, PAM Native 0.8.x.