native-canvas
Overview
The purpose and intent of this project was to create a library that allows for developers to create a browser canvas element that runs natively, without the need of a WebBrowser. Allowing for developers to code and develop portable canvas based applications that can run both on the WebBrowser and natively on any NodeJS platform.
Requirements
- NodeJS 10+
Getting Stated
- Install the native-canvas library
npm install native-canvas
A Simple Example
// Load the library; // Use the globally exposed canvasconst ctx = canvas; ctxlineWidth = 1;ctxfillStyle = "#FF0000";ctx;
View the samples directory to see more examples.
Running a Browser Example
// Load the library; // Title the title attributedocumenttitle = 'Create Canvas with Document'; // Provides the current running canvasconst canvas = document;const ctx = canvas; canvasheight = 150; ctxlineWidth = 1; ctx;ctx;ctx;ctx;ctx;
Raspberry Pi
To install on Raspberry Pi, you need to prep your environment by installing a few dev libraries.
sudo apt install \ libpixman-1-dev \ libcairo2-dev \ libpango1.0-dev \ libjpeg-dev \ libgif-dev \ libsdl2-dev
Screenshots
Acknowledgments
Special Thanks to @dmcquillan314 for the support!