Mon 21 Jul 22:43:21 CEST 2025
This commit is contained in:
parent
b8e908d096
commit
5760a2d98d
32
js/x11/examples/smoketest/shapetest.js
Normal file
32
js/x11/examples/smoketest/shapetest.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
var x11 = require('../../lib');
|
||||||
|
|
||||||
|
x11.createClient(function(err, display) {
|
||||||
|
var X = display.client;
|
||||||
|
var root = display.screen[0].root;
|
||||||
|
X.require('shape', function(err, Shape) {
|
||||||
|
var win = X.AllocID();
|
||||||
|
X.CreateWindow(win, root, 0, 0, 200, 200);
|
||||||
|
X.ChangeWindowAttributes(win, { backgroundPixel: display.screen[0].white_pixel });
|
||||||
|
X.MapWindow(win);
|
||||||
|
X.ClearArea(win, 0, 0, 200, 200, false);
|
||||||
|
|
||||||
|
Shape.SelectInput(win, true);
|
||||||
|
Shape.InputSelected(win, function(err, isSelected) {
|
||||||
|
console.log("IsSelected: " + isSelected);
|
||||||
|
});
|
||||||
|
|
||||||
|
var bitmap = X.AllocID();
|
||||||
|
X.CreatePixmap(bitmap, win, 1, 200, 200);
|
||||||
|
var gc = X.AllocID();
|
||||||
|
X.CreateGC(gc, bitmap, { foreground: 1 });
|
||||||
|
// X.PolyText8(bitmap, gc, 0, 0, ['Hello, Node.JS!', ' Hello, world!']);
|
||||||
|
X.PolyFillArc(bitmap, gc, [0, 0, 200, 200, 0, 360 * 64]);
|
||||||
|
Shape.Mask(Shape.Op.Set, Shape.Kind.Bounding, win, 0, 0, bitmap);
|
||||||
|
|
||||||
|
X.on('event', function(ev) {
|
||||||
|
console.log(ev);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
X.on('error', function(err) { console.log(err); });
|
||||||
|
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user