static void perf_GETBOX(TeleUser *u, TeleEvent *ev) { /* Get a pixel matrix */ TeleCmdGetPutData *d = (TeleCmdGetPutData *) ev->data; T_Long reply_sequence; uint8_t *dest; if ((d->x < 0) || (d->y < 0) || (d->x + d->width > vis_mode.virt.x) || (d->y + d->height > vis_mode.virt.y)) { fprintf(stderr, "teleserver: ILLEGAL GETBOX.\n"); return; } /* if */ if ((d->width * d->height * d->bpp) > ((ev->size - ev->rawstart) * (signed)sizeof(long))) { fprintf(stderr, "teleserver: NOT ENOUGH ROOM FOR GETBOX.\n"); return; } /* if */ reply_sequence = ev->sequence; tserver_new_event(u, ev, TELE_CMD_GETBOX, sizeof(TeleCmdGetPutData)-4, d->width * d->height * d->bpp); ev->sequence = reply_sequence; dest = (uint8_t *)d->pixel; ggiGetBox(vis, d->x, d->y, d->width, d->height, dest); tserver_write(u, ev); } /* perf_GETBOX */
//get image (real screen only) void x_getimg(int x1, int y1, int x2, int y2, char *bitmap) { short int w=(short int)(x2-x1)+1; short int h=(short int)(y2-y1)+1; memcpy(bitmap,&w,sizeof(short int)); memcpy(&bitmap[sizeof(short int)],&h,sizeof(short int)); // if(x1>=0 && x2<=x_maxx() && y1>=0 && y2<=x_maxy()) #ifdef GGI ggiGetBox(ggiVis, x1, y1, w, h, (void *) &bitmap[2*sizeof(short int)]); #else gl_getbox(x1, y1, w, h,&bitmap[2*sizeof(short int)]); #endif }
static void animate_one_frame(ggi_visual_t vis, int x, int y, int w, int h, ggi_pixel * buf, int x2) { ggiDrawHLine(vis, x, y, w); ggiDrawHLine(vis, x, y + h - 1, w); ggiDrawVLine(vis, x, y, h); ggiDrawVLine(vis, x + w - 1, y, h); ggiDrawBox(vis, x + 2, y + 2, w - 4, h - 4); ggiGetBox(vis, x + 5, y + 5, w - 10, h / 2 - 7, buf); ggiPutBox(vis, x + 5, y + 5, w - 10, h / 2 - 7, buf); ggiCopyBox(vis, x + 5, y + h / 2, w - 10, h / 2 - 5, x + 5, y + h / 2); ggiPuts(vis, x + 7, y + 7, "Get/Put"); ggiPuts(vis, x + 7, y + h / 2 + 2, "Copy"); ggiDrawBox(vis, x2, y, 5, 5); }