mirror of
https://github.com/danbulant/node-x11
synced 2026-05-19 04:18:35 +00:00
simple pngs are displayed now
This commit is contained in:
parent
50a46f10a6
commit
ac65378885
1 changed files with 14 additions and 7 deletions
|
|
@ -1,4 +1,5 @@
|
|||
var logo = require('./node-png').readPng('./node-logo.png');
|
||||
//var logo = require('./node-png').readPng('./node-logo.png');
|
||||
var logo = require('./node-png').readPng(process.argv[2]);
|
||||
var x11 = require('../../lib/x11');
|
||||
|
||||
var Exposure = x11.eventMask.Exposure;
|
||||
|
|
@ -6,6 +7,7 @@ var KeyPress = x11.eventMask.KeyPress;
|
|||
var KeyRelease = x11.eventMask.KeyRelease;
|
||||
var ButtonPress = x11.eventMask.ButtonPress;
|
||||
var ButtonRelease = x11.eventMask.ButtonRelease;
|
||||
var PointerMotion = x11.eventMask.PointerMotion;
|
||||
|
||||
x11.createClient(function(display)
|
||||
{
|
||||
|
|
@ -27,7 +29,7 @@ x11.createClient(function(display)
|
|||
0, 0, logo.width, logo.height,
|
||||
1, 1, 0,
|
||||
{
|
||||
backgroundPixel: white, eventMask: Exposure|KeyPress|ButtonPress
|
||||
backgroundPixel: white, eventMask: Exposure|KeyPress|ButtonPress|PointerMotion
|
||||
}
|
||||
);
|
||||
X.MapWindow(win);
|
||||
|
|
@ -37,19 +39,24 @@ x11.createClient(function(display)
|
|||
|
||||
var pixmaplogo = X.AllocID();
|
||||
X.CreatePixmap(pixmaplogo, win, 24, logo.width, logo.height);
|
||||
var piclogo = X.AllocID();
|
||||
X.PolyFillRectangle(pixmaplogo, gc, [0, 0, 1000, 1000]);
|
||||
X.PutImage(2, pixmaplogo, gc, logo.width, logo.height, 0, 0, 0, 24, logo.data);
|
||||
|
||||
var piclogo = X.AllocID();
|
||||
Render.CreatePicture(piclogo, pixmaplogo, Render.rgb24);
|
||||
|
||||
var picWin = X.AllocID();
|
||||
Render.CreatePicture(picWin, win, Render.rgb24);
|
||||
|
||||
X.on('event', function(ev) {
|
||||
if (ev.type == 12) // expose
|
||||
{
|
||||
Render.Composite(3, piclogo, 0, win, 0, 0, 0, 0, 0, 0, logo.width, logo.height);
|
||||
}
|
||||
{
|
||||
Render.Composite(3, piclogo, 0, picWin, 0, 0, 0, 0, 0, 0, logo.width, logo.height);
|
||||
}
|
||||
});
|
||||
|
||||
X.on('error', function(err) {
|
||||
console.log(err.stack);
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue