tmp
This commit is contained in:
parent
aec66da3b1
commit
108e1a79ba
|
@ -63,6 +63,9 @@ void prntscreen(const struct message *msg, const struct prog_info *pinfo) {
|
||||||
static int init = 0;
|
static int init = 0;
|
||||||
static int rows;
|
static int rows;
|
||||||
static int cols;
|
static int cols;
|
||||||
|
static char *img = NULL;
|
||||||
|
static int w;
|
||||||
|
static int h;
|
||||||
if (!init) {
|
if (!init) {
|
||||||
// printf("init start\n");
|
// printf("init start\n");
|
||||||
initscr();
|
initscr();
|
||||||
|
@ -71,15 +74,26 @@ void prntscreen(const struct message *msg, const struct prog_info *pinfo) {
|
||||||
init = 1;
|
init = 1;
|
||||||
// printf("init end\n");
|
// printf("init end\n");
|
||||||
}
|
}
|
||||||
|
if (!img && msg->image) {
|
||||||
|
img = msg->image;
|
||||||
|
w = msg->width;
|
||||||
|
h = msg->height;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!img)
|
||||||
|
return;
|
||||||
|
|
||||||
int frame = msg->timestamp;
|
int frame = msg->timestamp;
|
||||||
int right = pinfo->client_offset;
|
int right = pinfo->client_offset;
|
||||||
int left = right + cols;
|
int left = right + cols;
|
||||||
|
|
||||||
// printf("loop\n");
|
// printf("loop\n");
|
||||||
for (int y=0; y<50; y++) { // y<msg->height; y++) {
|
int rowoffset = (rows-h)/2;
|
||||||
|
int coloffset = left-frame;
|
||||||
|
for (int y=0; y<h; y++) { // y<msg->height; y++) {
|
||||||
for (int x=left-frame; x<cols; x++) {
|
for (int x=left-frame; x<cols; x++) {
|
||||||
mvaddch(y, x, ('0' + x-(left-frame)+y));
|
|
||||||
|
mvaddch(y + rowoffset, x, ('0' + x-(left-frame)+y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
|
|
||||||
char *readImage(const char* filename, int *cols, int *rows) {
|
char *readImage(const char* filename, int *cols, int *rows) {
|
||||||
|
|
||||||
|
printf("fopen\n");
|
||||||
FILE *f = fopen(filename, "r");
|
FILE *f = fopen(filename, "r");
|
||||||
|
printf("ok\n");
|
||||||
|
|
||||||
*cols = 0;
|
*cols = 0;
|
||||||
*rows = 0;
|
*rows = 0;
|
||||||
char *linebuf = (char *)malloc(LINELEN);
|
char *linebuf = (char *)malloc(LINELEN);
|
||||||
char *ret = NULL;
|
char *ret = NULL;
|
||||||
if (!f) {
|
if (f) {
|
||||||
while (fgets(linebuf, LINELEN, f)) {
|
while (fgets(linebuf, LINELEN, f)) {
|
||||||
int len = strlen(linebuf);
|
int len = strlen(linebuf);
|
||||||
*cols = len>*cols?len:*cols;
|
*cols = len>*cols?len:*cols;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user