How to use the robotjs.captureScreen function in robotjs

To help you get started, we’ve selected a few robotjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zz85 / contact.js / src / touchpad.js View on Github external
sendScreen() {
		var screen = robot.captureScreen();
		var ts = Date.now();

		var imgBytes = screen.width * screen.height * screen.bytesPerPixel;
		var buffer = new ArrayBuffer(20 + imgBytes);
		var header = new Float64Array(buffer, 0, 2);
		header.set([wire.WIRE['si'], ts]);
		var screenView = new Uint16Array(buffer, 16, 2);
		screenView.set([ screen.width, screen.height ]);

		var imgView = new Uint8Array(buffer, 20, imgBytes);
		imgView.set(screen.image);

		this.sendRaw(buffer);
	}