ntk
node.js desktop UI toolkit
A set of wrappers around low level node-x11 module to simplify X Window UI progamming - windows creation, event handling, 2d/3d graphics etc.
Installation
npm install ntk
Basic usage
;
2d graphics
Each window ( or pixmap ) can be used to create 2d and 3d canvas. 2d canvas implements HTML context2d api ( some features not yet supported ) via XRender extension, and most operations are performed on the X Server side ( image composition, scaling, blur, text composition, gradients etc ). Initial font rendering is performed by ntk using freetype2 module and fonts names mapped to file names using font-manager module.
var ntk = ; ntk;
ctx.drawImage()
also accepts node-canvas as a source, for images with lot's of drawing calls it might be more efficient to perform all drawing locally and transfer pixels to server when ready:
var ntk = ;var Canvas = ; var canvas = 800 800;var canvasCtx = canvas; { // ...} ntk;
3d graphics
At the moment only indirect GLX is supported with most of OpenGL 1.4 api implemented. Note that on some systems indirect GLX might be disabled by default, you'll need to enable it for gl to work.
var ntk = ; var width = 300;var height = 300;var angle = 0; { gl; gl; gl; if width < height gl; else gl;} { gl; gl; gl; gl; gl; gl; gl; gl; gl; gl; gl; gl; gl; gl; gl; gl;} var texture = ; ntk;
High level widgets / layout management etc
Likely to be implemented outside as part of react-x11