Skip to content

Instantly share code, notes, and snippets.

@sidorares
Created May 3, 2012 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sidorares/2583233 to your computer and use it in GitHub Desktop.
Save sidorares/2583233 to your computer and use it in GitHub Desktop.
PutImage + 32 bit pixmap example
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); });
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment