2015-02-01 13:43:52 -08:00
|
|
|
var blessed = require('../')
|
|
|
|
, screen;
|
|
|
|
|
|
|
|
screen = blessed.screen({
|
|
|
|
dump: __dirname + '/logs/image.log',
|
|
|
|
smartCSR: true
|
|
|
|
});
|
|
|
|
|
2015-02-09 00:21:58 -08:00
|
|
|
// To ensure our w3mimgdisplay search works:
|
2015-02-09 00:19:35 -08:00
|
|
|
blessed.image.w3mdisplay = '/does/not/exist';
|
|
|
|
|
|
|
|
var file = process.argv[2] || __dirname + '/test-image.png';
|
|
|
|
|
2015-02-09 00:21:58 -08:00
|
|
|
var image = blessed.image({
|
2015-02-01 13:43:52 -08:00
|
|
|
parent: screen,
|
|
|
|
left: 'center',
|
|
|
|
top: 'center',
|
2015-02-01 14:01:55 -08:00
|
|
|
width: 'shrink',
|
|
|
|
height: 'shrink',
|
2015-02-09 00:19:35 -08:00
|
|
|
bg: 'green'
|
2015-02-01 13:43:52 -08:00
|
|
|
});
|
|
|
|
|
2015-02-09 00:19:35 -08:00
|
|
|
setTimeout(function() {
|
2015-02-09 00:21:58 -08:00
|
|
|
image.setImage(file);
|
2015-02-09 00:19:35 -08:00
|
|
|
screen.render();
|
|
|
|
}, 1000);
|
|
|
|
|
2015-02-09 01:43:16 -08:00
|
|
|
//setTimeout(function() {
|
|
|
|
// image.setImage(file);
|
|
|
|
// image.rtop = 4;
|
|
|
|
// image.rleft = 10;
|
|
|
|
// screen.render();
|
|
|
|
// setTimeout(function() {
|
|
|
|
// image.setImage(file);
|
|
|
|
// image.rtop = 2;
|
|
|
|
// image.rleft = 7;
|
|
|
|
// screen.render();
|
|
|
|
// }, 1000);
|
|
|
|
//}, 5000);
|
|
|
|
|
2015-02-09 00:21:58 -08:00
|
|
|
image.focus();
|
2015-02-01 13:43:52 -08:00
|
|
|
|
2015-02-08 23:42:44 -08:00
|
|
|
screen.key('i', function() {
|
2015-02-09 00:21:58 -08:00
|
|
|
screen.displayImage(file);
|
2015-02-08 23:42:44 -08:00
|
|
|
});
|
|
|
|
|
2015-02-01 13:43:52 -08:00
|
|
|
screen.key('q', function() {
|
|
|
|
return process.exit(0);
|
|
|
|
});
|
|
|
|
|
|
|
|
screen.render();
|