public
Created

PutImage + 32 bit pixmap example

  • Download Gist
gistfile1.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
var x11 = require('../../lib/x11');
x11.createClient(function(display) {
X = display.client;
var w = 100;
var h = 200;
var root = display.screen[0].root;
var pix = X.AllocID();
X.CreatePixmap(pix, root, 32, w, h);
var gc = X.AllocID();
X.CreateGC(gc, root);
X.require('render', function(Render) {
var pic = X.AllocID();
Render.CreatePicture(pic, pix, Render.rgba32);
// (format, drawable, gc, width, height, dstX, dstY, leftPad, depth, data)
data = new Buffer(h*w*32);
X.PutImage(2, pix, gc, w, h, 0, 0, 0, 32, data);
});
X.on('error', function(err) { console.log(err); });
});

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.